Stonehearth renderers do not transfer color nor texCoords data to the shader when OBJ file is loaded and it is the only accepted mesh format except Qubicle Binary (this is a voxel game so face colours look fine, no need to use image textures). As a result an OBJ mesh imported into the game has to be all set to one color. I figured out there is a workaround to this problem but it requires a hacky preparation of the OBJ file so vertex color is coded in vertPos.
This requires me to code the following:
- All vertices of a face must have the same color data. Vertices belonging to faces of different colors must be duplicated. This basically means a split by face color script, while I’d love to have an option to conveniently paint the colors in Blender after importing a mesh I can bake the colors from a texture as well so all I need for now is a split script.
- Vertex coordinates must be rounded to 3 decimal places, the next 3 X/Y/Z digits code R/G/B value (000-255) so vertex color is converted to RGB, divided by 10^6 and added to vertex coordinates. This can then be easily managed by modded GLSL shader.
As I’ve never scripted a single line in Blender help would be most appreciated.