Hi, I'm using MeshVS_MeshPrsBuilder for the fast display of STL meshes, which is so much faster than the more standard StlAPI.
( IMHO converting meshes -> breps by default is a bad idea... the docs also dont state that this conversion is going on, which is worrying )
Even though I'm setting the following flags ( MeshVS_DA_SmoothShading and MeshVS_DA_Reflection are necessary for gouraud shading ):
I'm not arriving to smooth shading.
Any ideas what might be going wrong?
I've been glancing over the c++ classes and can't figure out why smooth shading wont pan out...
Thanks,
-jelle
Mark Blome
2013/01/10 20:53
Hi Jelle,
I think this fails because SmoothShading requires mean normal vectors at mesh nodes, not element normal vectors.
MeshVS_MeshPrsBuilder will ask the data source (any class derived from MeshVS_DataSource) about nodal normal
vectors using the function GetNodeNormal(). However by default in MeshVS_DataSource this function returns false,
which will deactivate smooth shading:
In PythonOCC provided SMESH_MeshVSLink (derived from MeshVS_DataSource ) implemented by Sioutis Fotios this function is not implemented.
I will implement this function and let you know if that would solve this problem (I am working on SMESH_MeshVSLink for speed improvements when displaying
volume meshes at the moment anyway).
Regards,
Mark
Mark Blome
2013/01/11 14:24
Hi,
smooth shading works nicely with surface meshes if a MeshVS_DataSource3D derived class is
provided to MeshVS_MeshPrsBuilder that implements nodal normal vectors (GetNodeNormal method).
In the attached ZIP file such a class is implemented and two examples are shown (smooth shading visualization
of 2 surface grids created with NETGEN).
Mark
You have to be logged in to download the attached file