Fix/enable surface normals #14
Comments
@larsoner I have added this issue according to your comment in the pull request. I have been studying the PySurfer code and I am not sure I understand correctly how surface normals are used in PySurfer. Have you implied vertex normals that are used for shading corrections, so the surface does not look triangulated (flat vs smooth shading)? |
By the way, inflated surface does not seem as much triangulated as pial surface. |
Yes vertex normals are used for smooth shading. There should be a way to enable it for the WebGL meshes. To compute the vertex normals ( https://github.com/mne-tools/mne-python/blob/master/mne/surface.py#L291 |
I am not sure whether simple enabling in WebGL will help, since ipyvolume uses custom vertex and surface shaders for implementing its plot_mesh/plot_trisurf functions. |
If it uses smooth shading / lighting, it should already make use of the vertex normals (IIUC it is standard to do so) |
This is the source code for the shaders I was talking about: I am not sure whether this is exactly vertex normal implementation, what do you think? I would need ask in ipyvolume chat or smth. |
I would ask the ipyvolume folks |
According to ipyvolume folks they use flat shading. |
You could ask about the possibility of using smooth shading. It's worth a PR to ipyvolume if it's not too much work |
Yes, it will be possible to add smooth shading to ipyvolume. |
Surface normals should fix/smooth out the appearance of individual triangles.
An example of a OpenGL-ES2 compatible Phong shading (at least I think it works properly):
https://github.com/vispy/vispy/blob/master/vispy/visuals/mesh.py#L21
Surface normals calculation will be added with pull request #31,
ipyvolume
support for the smooth shading should be added later.The text was updated successfully, but these errors were encountered: