Kitware/vtk-js

After setUserMatrix, Actor become pure black.

Opened this issue · 5 comments

Bug description

Loading polydata with vtkSTLReader from stl file, then create an vtkActor, setUserMatrix,
the actor looks strange, it become pure black.

Steps to reproduce

Please see, demo

Detailed Behavior

No response

Expected Behavior

Just play right as without setUserMatrix.

Environment

  • vtk.js version:
  • Browsers:
  • OS:

This is likely not a bug, it is because your user matrix "flips" the point normals. It is therefore assumed that the normals are pointing towards the center of the object instead of pointing outward. The lighting mechanism needs to have the dot product between the normals and the light direction is negative so that it lit correctly.

How to update the point normals to make it towards the center? I think, this should be done in method: setUserMatrix.

No, it shouldn't be done in UserMatrix. The flip might be intentional.

You can look at vtkPolyDataNormals

Where to see the flipped normals? I do not know when and where to update the normals.

Where to see the flipped normals?

You can't see them (because the user matrix is applied at render time), but the blackness is explained by flipepd normals.

I do not know when and where to update the normals.

You can set the output of the vtkPolyDataNormals filter as the input of the mapper.