marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
1.98k stars 257 forks source link

smooth shading #1024

Closed LogWell closed 5 months ago

LogWell commented 5 months ago

When vis. mesh with uv coords, the smooth shading cannot work: vedo SMPL_A.obj

SMPL_A.txt SMPL_A0.txt

marcomusy commented 5 months ago

You need to compute_normals().

LogWell commented 5 months ago

Yes, neither of these two meshes have normals saved, but why can SMPL_A0 be displayed smoothly but SMPL_A cannot?

marcomusy commented 5 months ago

In your first message this is not explained at all, please explain the issue clearly.

In

vedo.mesh.Mesh at (0x2ffb5a0)                                              
file name     : /home/musy/Downloads/SMPL_A0.obj
elements      : vertices=6,890 polygons=13,776 lines=0

whereas in

vedo.mesh.Mesh at (0x5e15160)                                              
file name     : /home/musy/Downloads/SMPL_A.obj
elements      : vertices=41,328 polygons=13,776 lines=0

so there all vertices are duplicated in SMPL_A.

Removing them allows the phong algorithm to work:

Mesh("SMPL_A.obj").clean().phong().show()

Screenshot from 2024-01-19 18-38-50