The .obj files I export are missing data for vertex colors. Is there a way to include color information in the .obj file? If not, what are the alternatives?
|
Blender can export PLY files (.ply), which are text-based, very easy to parse, and include vertices colors. The hard way is to change the OBJ exporter code so that it includes the vertices colors (thus breaking obj compatibility). |
|||||||||||||||||
|
|
Wavefront OBJ supports materials, which color groups of meshes the same color. Material statements look like this:
So, Kd is the diffuse component, Ks specular. These would be specified inside a .mtl file that accompanies the .obj file. Inside the .obj file are statements like
This means the faces specified there are to use the redMtl material. When you're parsing the obj file, this translates down to per-vertex color. If there are lots of different colors, you will have a lot of different materials, but you can do it. Here's a video of how to assign a particular group of faces a different material. You can assign a different material to each face in a mesh if you wish. |
||||
|
|