Voxelers / mcthings

A Python framework for creating 3D scenes in Minecraft and Minetest
Apache License 2.0
57 stars 10 forks source link

Create Schematics from Voxel formats #98

Closed acs closed 4 years ago

acs commented 4 years ago

The workflow is described in http://makeit.zone/3d-conversion-for-minecraft.html#.XuUSqJaxUUo and it is:

3D format -> poly2vox -> kv6 -> kv6toschematics -> schematics

VoxelShop can export directly to kv6, so we can avoid poly2vox step:

https://trove.fandom.com/wiki/Common_Voxel_Editors «It can import from .qb, .vox, .vxl, .rawvox, .kvx and export to .qb, .vox, .pnx, .kv6, .dae, and .png for render. »

It is not ideal, because goxel and magicavoxels are already using voxels, and with this workflow, we go from voxels to polygons and then to voxels and then to schematic.

But let's play with it.

The kv6toschematics is a dark piece that it is not officially available anymore. And you need to get from:

https://starmadedock.net/threads/anyone-got-a-copy-of-kv6toschematic.30345/ Just download the poly2vox software.. it will have a copy of kv6 to schematic within it. http://advsys.net/ken/poly2vox.zip

But it is not included anymore ...

acs commented 4 years ago

Interesting comparison between voxel formats:

https://gamedev.stackexchange.com/questions/19437/what-are-the-pros-and-cons-of-these-voxel-data-file-formats

acs commented 4 years ago

So in and ideal world, we must go from the voxel format, based on "cubes" to schematic format.

So my bet is to select the better voxel format (most supported, with converters to it, well documented, simple but complete, with python libs ...) and create a converter. To the Schematic legacy version, not the Sponge one in the first iteration.

My feeling is to support the vox format (with an incomplete python lib supporting it) and create a converter in python.

With it, Goxel and MagicaVoxel and others supporting this vox format can be editores for Minecraft.

Have in mind https://gitlab.com/bztsrc/mtsedit/blob/master/docs/import.md that it is pretty recent.

acs commented 4 years ago

Right now our only option is to use binvox: 3D -> Schematic

acs commented 4 years ago

Qubicle

https://www.minddesk.com/get.php has support for Schematics?

Mod supported voxel games like Minecraft and Staxel

https://getqubicle.com/learn/article.php?id=21

But it does not work in Linux, but it works in Steam, that works in a web browser?

acs commented 4 years ago

The main issues is mapping the coloured voxels to MInecraft blocks. And this is something that changes in Minecraft between =<1.12 and >1.13. So it is a bit tricky.

acs commented 4 years ago

VoxEdit

https://medium.com/sandbox-game/voxedit-how-to-get-your-assets-into-minecraft-4be598b838f6

Use Tinkercad to convert .stl file to schematic

Wow, this could be the right approach now!

Yes, I can import the OBJ file and convert it to a schematic, but I can not import the materials, so the colors are lost :(

After playing with Tinkercad, one you import a OBJ model, it is just a figure (thing) inside de Scene.

And each figure can only have one color. If we want a spaceship in Tinkercad multicolor, we need to create it with different objects inside Tinkercad. Or import the OBJ as different pieces, one for each color.

acs commented 4 years ago

binvox

It seems that with this hack you can import OBJ with different materials:

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-tools/1265878-converting-obj-into-schematic-in-color

You need to create different schematics, one per each material. It could be easy to load all schematics in McThings and assembly them.

In binvox page: https://www.patrickmin.com/binvox/ «write tutorial about voxelizing model with separate components into voxel model with differently "coloured" parts: in general, how to separately voxelize objects so they end up in the same coordinate system» This is exactly what we want for the space ship. But first, we need to have separate components. And once we have them, the assembly could be done by McThings.

In https://www.patrickmin.com/minecraft/: «TODO: coloured meshes to convert to coloured voxels »

And it seems this is a common technique: https://forums.autodesk.com/t5/maya-modeling/splitting-mesh-based-on-material/td-p/4288054 and in Blender https://wiki.nexusmods.com/index.php/Splitting_meshes_in_Blender

I have some issues using it, because with the spaceship I have just one material, the palette used. So I can not select by material :( But it seems that with this scripts, it can be done: https://blender.stackexchange.com/questions/89632/can-i-select-by-color-when-not-the-same-material But this one if for selecting objects, not faces of an object! But we can implement it!

We want to select by face texture diffuse a it is implemented in this script: https://blenderartists.org/t/select-all-faces-with-same-hex-value-in-edit-mode/592292/7?u=alvaro_del_castillo

https://www.youtube.com/watch?v=q78-sqlWJwI

acs commented 4 years ago

And this one?

https://drububu.com/miscellaneous/voxelizer/?out=obj

acs commented 4 years ago

Blender

Create a script to select by color (there is just one material, the palette) faces.

https://blender.stackexchange.com/questions/51782/get-material-and-color-of-material-on-a-face-of-an-object-in-python

We need to learn a lot about how with the same material, you can have different colors for the faces.

https://blenderartists.org/t/one-material-multiple-meshes-different-colors/622422

And then with it, select face by color and not by material.

https://blender.stackexchange.com/questions/48820/multiple-texture-in-a-single-material/55767

https://www.youtube.com/watch?v=kPqWYl0YzQ8

https://github.com/MrCheeze/obj2mc

This obj2mc is what I planned to do! But the ouput is a JSON file, WTF? It is pretty old, 6 years ago, so probably it is only useful as a confirmation that it is a good idea to create a Blender plugin to convert from a remesh cubes 3D in blender to Minecraft.

This is so interesting that I have created a specific issue for it: https://github.com/juntosdesdecasa/mcthings/issues/100

acs commented 4 years ago

The Minetest Schematic format is different from the Minercratf one: https://dev.minetest.net/Minetest_Schematic_File_Format

acs commented 4 years ago

MagicaVoxel

This is the richest voxel editor I have tested. The workflow must be from its vox format to schematic, to avoid the voxels->polys->voxels conversion. But binvox works with polys so in this workflow, this is the way to go.

acs commented 4 years ago

Mesh to Voxels: Colors

This is a research topic, howto define the colors in the voxels from the ones in the 3D mesh: http://www.npal.cs.tsukuba.ac.jp/~zhang/projects/SG15-ManZHANG-mini_block_artwork.pdf (Conference Paper · March 2017 with 26 Reads).

So if we work at some point converting from voxels to 3D, and from 3D to voxels, the colors will be lost during the process.

acs commented 4 years ago

Summary: voxels to schematics

acs commented 4 years ago

Ok, all done here now. The next task is:

https://github.com/juntosdesdecasa/mcthings/issues/99

An importer from voxel to schematics.