Closed mowshon closed 5 years ago
Mike can correct me if I'm wrong, but it seems vertex_colors
aren't currently supported by the obj
loader. It's currently undergoing a rewrite, and while it seems to be a consideration the implementation is commented out.
In terms of rendering, it seems vertex colors aren't currently supported for mesh rendering either.
If you're happy hacking the source code, the following worked for me:
'vertex_colors': vc[mask_v]
here and 'vertex_colors': vc
herevertices = np.concatenate([vertices, [[0, 0, 0]]], axis=0)
vertex_colors = np.concatenate([vertex_colors, [[0, 0, 0]]], axis=0)
import trimesh
obj_scene = trimesh.load('face.obj')
geom = obj_scene.geometry.values()
scene = trimesh.scene.Scene()
for g in geom:
pc = trimesh.PointCloud(g.vertices, g.visual.vertex_colors)
scene.add_geometry(pc)
scene.show()
![face](https://user-images.githubusercontent.com/659115/58931930-fe290c00-87a4-11e9-9550-41f2b99fc768.png)
@jackd, I did everything according to your instructions and it worked for me. It is a pity that this is not in the stable version. I'll try to figure it out. You helped me a lot.
@mikedh do you plan to support vertex colors from a .obj file for the future?
Unfortunately all the OBJ files I downloaded from that side didn't open in meshlab or trimesh and appeared to have index issues.
Yep, supporting vertex colors is quite straightforward and we'll support it in the new OBJ loader.
Hey, these now load cleanly in the release/major
branch (scheduled to be released 7/15/2019), including vertex colors. The main problem was an index issue which is now fixed. It's a shame these files are so large, otherwise it would be great to put them in unit tests as they have several edge cases :).
Mike truly struggling to convert 200 obj files from Texture to Vertex Colors...Reason being there is bleed in the obj files which are all textured pink (HEX #ffc0cb)...The idea is to convert the texture to vertex colors (Faces more optimal) and delete all the pink faces/vertices from the mesh...
Not to fazed about retexturing the updated mesh as I can easily accomplish this in the photogrammetry software. Any chance there is a workflow like this for Trimesh ?? I have tried to follow the above yet coming up dry every time...
pip list:
I have a obj file from http://cvl-demos.cs.nott.ac.uk/vrn/ You can download and try this tool by yourself, after that you can download the .obj file Source: https://specials-images.forbesimg.com/imageserve/5c76b4b84bbe6f24ad99c370/416x416.jpg?background=000000&cropX1=0&cropX2=4000&cropY1=0&cropY2=4000
bill-gates.obj (with VERTEX COLORS) contains something like that:
I have tried this code:
The face color is always gray.