Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After setUserMatrix, Actor become pure black. #3148

Open
neo15201788751 opened this issue Oct 17, 2024 · 5 comments
Open

After setUserMatrix, Actor become pure black. #3148

neo15201788751 opened this issue Oct 17, 2024 · 5 comments
Labels

Comments

@neo15201788751
Copy link

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:
@neo15201788751 neo15201788751 added the type: bug 🐞 Errors in functionality label Oct 17, 2024
@finetjul finetjul added type: question❓ Help wanted and removed type: bug 🐞 Errors in functionality labels Oct 17, 2024
@finetjul
Copy link
Member

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.

@neo15201788751
Copy link
Author

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

@finetjul
Copy link
Member

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

You can look at vtkPolyDataNormals

@finetjul finetjul changed the title [Bug] After setUserMatrix, Actor become pure black. After setUserMatrix, Actor become pure black. Oct 18, 2024
@neo15201788751
Copy link
Author

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

@finetjul
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants