erich666 / Mineways

Exports models from Minecraft for 3D printing or rendering
http://mineways.com
Other
399 stars 59 forks source link

Support for importing resource packs, especially with Optifine Normal and Specular maps #42

Closed chexo3 closed 3 years ago

chexo3 commented 5 years ago

It'd be helpful if we could import a resource pack to use for exporting to rendering programs like Blender. With support for unpacking the normal and specular maps for Optifine some of them include.

erich666 commented 5 years ago

Mineways exports to OBJ and VRML formats currently. Wavefront OBJ/MTL is ancient, and over the years various companies have made unofficial extensions for importing specular and normal maps. However, I don't know much about these and Blender - do you have any example files with specular and normal maps that Blender imports correctly? Looking here, I'm guessing if I added a "bump" and "map_Ks" field to each material and provided a way to add these textures in, that might work. Basically, I need a bit of help on the Blender side to know what you'd need.

As it stand, the little research I've done sadly does not discuss the MTL file attributes that Blender reads in. The forums don't turn up anything helpful, either. I figure I could eventually reverse-engineer Blender and figure out what it actually wants, but I thought I'd save myself a few hours and ask you.

chexo3 commented 5 years ago

Yeah, unfortunately I’m not well versed with blender either. I’m not sure where normal maps are applied unfortunately. Someone could probably make a script to auto generate nodes for applying a normal map to each material. But I might be better served trying to figure out how to do it manually first.

erich666 commented 5 years ago

Let me know what you find.

Me, I'm trying to add another option to Mineways now (when I find the time), which is to try exporting each tile separately. This would make editing tiles after export a breeze, would have better filtering (no mipmap border "leaking"), and open the way to adding code to simplify the meshes (since separate tiles can then repeat). Does this sound useful? We'll see...

TheDuckCow commented 5 years ago

@chexo3 happy to help out regarding Blender specifically, noting the manual setups vary between Blender Internal (for 2.7 and older), and for Cycles / Eevee (both are about the same settings, Eevee being 2.8 only).

But this being said, I want to call out this thread around the 'clever' use of extra passes in some resource packs. It makes it a little more convoluted to directly use some packs properly, even following standard implementation of extra normal/spec/metal/bump/etc passes of standard PBR workflows. For blender, I will be working around this oddity by doing shader-defined splitting of channels and treating each channel as it's own map accordingly, but is not something I image could be encapsulated easily through any standard material interchange file format like mtl (but rather done by the 3D engine-side, in this case in Blender via the MCprep addon).

erich666 commented 4 years ago

It's the holidays, so I have some coding time available. If you have anything you'd love to see improved in this or other areas, let me know @TheDuckCow (or anyone else).

TheDuckCow commented 4 years ago

Thanks Eric! No specific features I have in mind regarding this (what I mention above has more to do with material shading and more intricate node compositing beyond what you could do with raw texture image exports in obj files).

Edit: Do you already have the ability to export normal maps and specular maps? From a user perspective, even if only for the "export as tiles" option, could be a useful feature. Even if the obj file directly can't utilize, extraction would still be useful.

I think the main other thing we discussed (which is still a challenge, I know) would be to call the mineways executable from a command prompt, and have it execute the script totally headless... that, and/or have the option to take script inputs via continuous standard input stream (so that the world could be kept open in memory in a parallel process via a parent program, and execute new commands as dictated by the user in the still-open instance, passed through via stdin). Right now you can only run one script, can't provide new inputs thereafter (it either quits, or becomes an orphaned process with no UI and no way to pass new commands).

erich666 commented 3 years ago

I've finally added this feature with the Mineways 8.00 release. Whew. It's a start: right now it goes to USD, which can be read in by Omniverse Create. I'm hoping to someday have USD -> Blender, though right now it's time for a rest...