I just ran into something strange when importing OBJ files.
I am writing a Grasshopper definition to export meshes with vertex colors for multi-color 3D printing. The script manually assigns vertex colors to a mesh on a black-white gradient. When the mesh is baked to Rhino, everything looks great:
The problem comes if I export the mesh to OBJ (including VCs) and then import the mesh again into Rhino, to verify everything went well. I get this coloring:
As you see, I get these white vertices in areas where they should be much darker. Although I actually enjoy the aesthetics of this glitch, it is unintentional nonetheless…
Upon inspection of the vertex colors and the OBJ file, I have detected that these white spots happen on vertices with vertex color 1, 1, 1. My theory is: is it possible that the OBJ importer is trying to make best guesses about the numerical range of the vc ([0,1] or [0,255]), but it is doing it per-vertex, not holistically, and therefore, believes 1,1,1 vcs are full white? And could there be a workaround to this that does not involve writing a full OBJ importer from scratch…?
Have you determined whether downstream apps, besides Rhino, open with the vertex colors correct? That will tell me if it’s an import or export problem. Probably would be best to just have the baked object in a 3dm file so I can see what’s going on.
Problem is, most other apps that visualize meshes with vertex colors take the colors in normalized range, not 0,255 as Rhino exports it. So having trouble cross-checking this…
Hang on. I just carefully re-read the thread here. So you’re saying that a color 1,1,1, which ought be very dark grey is coming in white instead? Definitely a bug.
I know there’s something in there to try to determine whether the color is 0.0-1.0 or 0-255 but I do think it’s a per vertex thing. At the moment at least. It would be easy enough to sample a number of arbitrary colors to set a flag for the entire file though.
I’ll dig into this today and I don’t need a 3dm file.
You can set whether you want colors to be 0.0-1.0 or 0-255 in the mesh tab of the export options. If you’re using that. It should be in the dotnet options too. I’ll check. One sec.
I believe the numeric range for VCs option is new in R8 both for the export menu and for RC, that’s why I hadn’t seen it (many of my students are still in R7).