Voxelers / mcthings

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

Add support for MagicVoxel materials in Minecraft: Glass #120

Closed acs closed 4 years ago

acs commented 4 years ago

For example, the glass ball must be of glass :)

Screenshot from 2020-07-13 06-15-13

acs commented 4 years ago

Time to review the VOX format: #99

Reading the original and extended format definition in the current version the material is defined in the MATL chunk

(4) Material Chunk : "MATL"

int32   : material id
DICT    : material properties
      (_type : str) _diffuse, _metal, _glass, _emit
      (_weight : float) range 0 ~ 1
      (_rough : float)
      (_spec : float)
      (_ior : float)
      (_att : float)
      (_flux : float)
      (_plastic)

Probably we have a "material id" for each voxel, like XYZI and colors, but I need to review the format!

It seems that for each color in the palette we have its material:

[export]$ strings vxs.vox | grep MATL | wc -l
256

To check it, just change the MATL for a color, save it, and diff it with the previous version.

acs commented 4 years ago

Time to explore. For doing it I will use the model with the voxel logo inside a crystal (glass) ball.

Screenshot from 2020-07-15 06-17-29 Screenshot from 2020-07-15 06-17-15

Simple, we have two colors:

So we need to read the materials palette and use it in order to select the block to be used in Minecraft.

acs commented 4 years ago

Without supporting materials it looks like:

Screenshot from 2020-07-15 06-24-50

Interesting result, close to the model version in MV, but pretty far from the rendered one.

acs commented 4 years ago

All done:

Screenshot from 2020-07-15 08-03-00

Glass and metal are mapped to glass and iron in MC. And this opens the door to use other blocks in MC.