MPI-IS / mesh

MPI-IS Mesh Processing Library
Other
663 stars 152 forks source link

Displaying a textured mesh #2

Closed emanhamed closed 5 years ago

emanhamed commented 6 years ago

I have 3D textured mesh of type .obj where the texture is defined by both .mtl and .bmp I have been trying to display the mesh using mesh.py and meshViewer.py but the texture is not overlaying. This is how I'm defining the mesh. meshFile = Mesh(filename='/home/eman/frame0.obj') Do I need to explicitly refer to the texture files? thanks for help

anuragranj commented 6 years ago

Can you check if meshFile.texture_image or meshFile.texture_filepath exists? If it does, you can use MeshViewer.set_texture(). See here:

https://github.com/MPI-IS/mesh/blob/master/mesh/meshviewer.py#L573-L580

We will push some tutorial docs soon.

emanhamed commented 6 years ago

Hi! I was able to display the texture on the imported mesh. However, when I try to display the same mesh but after rotating it, the texture is not displayed. I'm using this code:


meshFile = Mesh(v =vertices, f= tris)
meshFile.texture_filepath='/media/samba/frame1.bmp'
mv = MeshViewer()
mv.dynamic_meshes= [meshFile]``
so vertices in this case are different than the initial vertices ! 

Also, the case when I succeeded to display the texture on the mesh was when I imported the mesh using the filename not the vertices and faces. So, is there a way to display the texture while feeding the vertices, faces and the texture image ? 

Thanks for your help 
anuragranj commented 6 years ago

The problem is not very clear to me. Can you paste the outputs here, how the mesh looks, and what removes the texture?

anuragranj commented 5 years ago

Closed due to no activity.