python script to convert .OBJ files into Minecraft, rendering them in game with a core shader.

Overview

samples:

image image image

random notes about the tool

general output format:

(animation not supported yet but planned)

image

vertex id

Minecraft's gl_VertexID isn't per model, so it's difficult to find the relative id of a vertex in a model unless you have a constant number of vertices

i thought up a trick to assign each face a unique pixel uv, then encoding the offset of the pixel from top left (relative 0,0 in the texture, some random place in the atlas)

with the offset data i am able to calculate the relative face id, and gl_VertexID % 4 gives the corner.

image

Python

i learned Python just to write this lol

apparantly anything that has to do with js can't keep rgb values correctly when alpha isnt max

Comments
  • Half of the model is missing

    Half of the model is missing

    Hello, I have this (https://we.tl/t-pjtMWXc144) model that has been decimated through Blender in order to reduce faces, every 3D viewer I have tried displays it with no problems but when converting it to Minecraft more than half the model is missing.

    This gets fixed if I triangulate faces in Blender but that adds 3+ times the faces.

    To me, it would seem that objmc has a problem converting quads since most of the model is made up of them.

    In game: download

    3D viewer: download

    opened by GeorgeMixas 10
  • models wont load with optifine installed

    models wont load with optifine installed

    When I create a 3D resource pack as usual, the blocks become transparent as shown in the image. How do I create a resource pack that will display correctly? Also, should I put the shaders directory in the assets/minecraft directory?

    I'm looking forward to your answer.

    image

    wontfix 
    opened by kumitatepazuru 6
  • Non full blocks don't render models

    Non full blocks don't render models

    Models don't render on non full blocks. For example I wanna add a model to my amethyst but can't as it doesn't render but if I put the same model on to cobblestone it works just fine.

    image

    opened by tobyplowy 5
  • Command arguments system

    Command arguments system

    A system that allows settings to be specified as arguments, using argparse (standard library) This will improve usability, as you can see the list of arguments when you add --help at runtime, and there is no need to change variables in the file. Also, since we are using the standard library, there is no need for users to add libraries, and the additional code used in this system is short, so developers can be flexible as they move forward.

    enhancement 
    opened by kumitatepazuru 5
  • The

    The "optifine compat" shader failed to load

    Here's the error I have in the consol :

    Caused by: java.lang.RuntimeException: could not reload shaders at epe.b(GameRenderer.java:706) at epe.a(GameRenderer.java:410) at afl.a(SourceFile:15) at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787) ... 121 more Caused by: yk: Invalid shaders/core/rendertype_solid.json: Couldn't compile vertex program (objmc_optifine, render/block) : 0(46) : error C1503: undefined variable "fog_distance" at yk.a(SourceFile:48) at epw.<init>(ShaderInstance.java:225) at epw.<init>(ShaderInstance.java:103) at epe.b(GameRenderer.java:528) ... 124 more Caused by: java.io.IOException: Couldn't compile vertex program (objmc_optifine, render/block) : 0(46) : error C1503: undefined variable "fog_distance" at dry.b(Program.java:94) at dry.a(Program.java:55) at epw.a(ShaderInstance.java:269) at epw.<init>(ShaderInstance.java:198) ... 126 more

    bug 
    opened by Daminator4113 3
  • Cannot convert .obj file.

    Cannot convert .obj file.

    The script just won't work and I'm not sure why. I ran in in command prompt and got this error message line 65, in d["positions"].append([float(i) for i in line.strip().split(" ")[1:]]) ValueError: could not convert string to float: ''

    bug 
    opened by Web7283 3
  • Choose files from a file dialog

    Choose files from a file dialog

    Allows to choose files from a file dialog. I also fixed the "file extension" because it was causing problems with folders containing a "." in the name.

    enhancement 
    opened by Daminator4113 2
  • Question: Blockbench support?

    Question: Blockbench support?

    Hello, i'm trying to add a models to my Custom Block but i want to resize the model first. I didn't test if it does work ingame.

    But when i umport it i makes that:

    image

    So i just want to know if you make support for that in the future

    PS: Idk realy what shaders ect.. , i'm just using a model that i downloaded on the web

    Thanks, Raft

    opened by Raft08 1
  • Follow entity rotation

    Follow entity rotation

    • Rotations along the Y axis will affect the model
    • Precision is not great, if you look up close you can see some jittering so it's probably best to allow users to turn it off in case they are not using it
    enhancement 
    opened by 5uso 1
  • Config system

    Config system

    i made config file system, and you don't need to modify code file (to prevent corruption)

    CFG structure: 1 line - obj (separated by commas) 2 line - frames (separated by commas) 3 line - duration 4 line - textures (separated by commas) 5 line - output (format: block_id, texture_name. separated by commas)

    duplicate 
    opened by bogdikon 1
  • History

    History

    add history saving/loading add some hotkeys:

    • esc: quit
    • enter: run objmc
    • ctrl c: copy history
    • ctrl v: paste history
    • ctrl s: save history to file
    • ctrl d: load history from file
    • ctrl r: run history
    • ctrl x: delete one item
    opened by Godlander 0
  • Normal map with OBJMC ?

    Normal map with OBJMC ?

    Hello. Thanks for OBJMC. I am new (1 week-) but managed to open your Python tool/import my OBJ in game. I am new to Blender as well (1 week-) and here is my question (since I am not sure that I found an answer in your page) :

    • Does OBJMC supports normal map please ? As far as I know normal map file is a second texture file and OBJMC accepts one texture file only. I didn't find a way yet to get "1 texture only". Normal map reduces a lot the vertices faces so it would be awesome.

    In all case, thank you for your tool and time.

    opened by adrienduvalet 2
  • No module named

    No module named "PIL"

    There's an error in line 9 of your code, it does not allow the program to work.

    "line 9, in from PIL import Image, ImageOps ModuleNotFoundError: No module named 'PIL'"

    I use Anaconda, and it says that it already has the Pillow thing. What is happening?

    opened by thesun101lolhaha 2
  • [Bug] Generating the same model multiple times in a row keeps adding i*nfaces to the .json only when using objmc.exe

    [Bug] Generating the same model multiple times in a row keeps adding i*nfaces to the .json only when using objmc.exe

    This bug is only present when using the objmc.exe. Basically, each time you generate the .json in the same program instance, the file regenerates but it has i*nfaces where i is the times you have generated the model in a row.

    This is very bad because if you start tweaking the settings and generating the model multiple times you end up with big files and with unecesar geometry.

    In the following image is an example of generating the same model 4 times in a row, with the model only having 42 faces, but each time we get i*42 faces.

    image

    opened by mattcarter11 1
  • Rotate model, questions

    Rotate model, questions

    Hello, I have a few questions that I would like to ask, is it possible to rotate how the model appears when the player is in first/third person view instead of holding it like a normal item?

    Will the resourcepack generated by objmc work on future Minecraft versions and are there any plans at all to make this work with optifine/sodium?

    Also, how would I go about making the model rotate when thrown on the ground similar to how vanilla items rotate?

    and lastly a huge thank you for making this tool!!!, people have been waiting years to use obj files in minecraft.

    opened by GeorgeMixas 2
Owner
hi how r u
null
MCRPC (Minecraft Resource Pack Comparator) checks your resource pack against any version of Minecraft to show resources missing from your pack for that version.

Minecraft Resource Pack Comparator MCRPC checks your resource pack against any version of Minecraft to show resources missing from your pack for that

null 3 Nov 3, 2022
Minecraft.nix - Command line Minecraft launcher managed by nix

minecraft.nix Inspired by this thread, this flake contains derivations of both v

null 12 Sep 6, 2022
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022
Minecraft clone using Python Ursina game engine!

Minecraft clone using Python Ursina game engine!

Taehee Lee 35 Jan 3, 2023
Minecraft-Bedrock-Modpack-Maker - Simple tool to combine multiple addons into one. Not finished

Minecraft-Bedrock-Modpack-Maker Simple tool to combine multiple addons into one. Not finished! Any contributing is welcome. How to use: Move all .mcpa

MivianCoin 1 Jan 6, 2022
HTTP API for FGO game data. Transform the raw game data into something a bit more manageable.

FGO game data API HTTP API for FGO game data. Transform the raw game data into something a bit more manageable. View the API documentation here: https

Atlas Academy 51 Dec 26, 2022
Open-source project written in the ursina engine, simulating the popular game Minecraft.

Voxelcraft is an open-source project written in the ursina engine, simulating the popular game Minecraft.

Calinescu Mihai 21 Oct 6, 2022
A simple python script to pregenerate minecraft worlds.

mcloady mcloady is a lightweight python script used to pre-generate Minecraft terrain using MCRcon and carpet mod (optional). Inspired by Pre-Generati

null 5 Dec 8, 2021
A simple script which allows you to see how much GEXP you earned for playing in the last Minecraft Hypixel server session

Project Landscape A simple script which allows you to see how much GEXP you earned for playing in the Minecraft Server Hypixel Usage Install python 3.

Vincenzo Deluca 4 Dec 18, 2021
Script to remap minecraft 1.12 java classes.

Remapper Script to remap minecraft 1.12 java classes. Usage You must have Python installed. You must have the script, mappings, and files / folders in

null 8 Dec 2, 2022
Minecraft Script to Tellraw Datapack Generator

Minecraft Script to Tellraw Datapack Geneator (STDG) can generate a chain of tellraw command in datapack from script.

null 1 Jan 28, 2022
Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.

MinecraftLandRiverGen View the following youtube video to set up a world that can interact with the python programs

null 23 Dec 25, 2022
PyCraft - A Minecraft launcher made in python

A Minecraft launcher made in python. The main objective of this launcher is to enable players to enjoy minecraft (especially those without a mojang/microsoft account). This launcher is not illegal as all files are downloaded from libraries.minecraft.net

null 38 Dec 12, 2022
A Minecraft clone written in python and pyglet.

PyCraft A Minecraft clone written in python and pyglet. Running PyCraft To run PyCraft, run the following code: git clone https://github.com/TheWebCra

The WebCrafters 17 Dec 29, 2022
A 16x16 clone of Minecraft Classic, written in Python with the Ursina Engine

VoxelCraft A 16x16 clone of Minecraft Classic, written in Python with the Ursina Engine Features:Trees, Water(But there's no gravity, so if you break

null 2 Jun 23, 2022
A minecraft bedrock server software written in python (3.X)

Podrum README also available in: English ???? Français ???? Deutsch ???? Español ???? Tiếng Việt ???? Italiana ???? Русский ???? 中文 ???? Is a Minecraf

Podrum 53 Nov 11, 2022
Multi minecraft server helper for python

呐 Yuki 您的群组服操作小助手。 使用Python3编写。使用 .yaml 配置文件记录子服,配合Screen管理Linux系统上的Minecraft子服,支持MCDR子服与非MCDR子服。 功能: 开启所有子服 关闭所有子服 重载所有子服MCDR 重载所有子服ChatBridge 使用方法:

null 3 Mar 17, 2022
2D Minecraft Clone made with Python & Pygame & OpenGL

2D Minecraft Clone This is a 2D clone of the well-known game Minecraft made in Python using Pygame and ModernGL I started this mostly as a self-improv

Kadir Aksoy 2 Sep 25, 2022
A Python based program that displays Your Minecraft Server's Status Infos.

Minecraft-server-Status This (very) small python script allows you to view any Minecraft server's status Information Usage Download the file, install

Jonas_Jones 2 Oct 5, 2022