-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Fix toggling receiveShadow without changing material #17413
Conversation
Fix the case where there are two objects with the same material in the scene and one has receiveShadow=true and the other has receiveShadow=false. This also prevents possible extra shader compiles when the same material is reused with receiveShadow enabled or disabled in the same scene.
Beautiful!
Agreed. I'll delete the example. |
Thanks! |
@@ -1792,6 +1792,13 @@ function WebGLRenderer( parameters ) { | |||
|
|||
} | |||
|
|||
if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) { | |||
|
|||
materialProperties.receiveShadow = object.receiveShadow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line acts as a cache, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, precisely.
Ah yes, still needed to fix the shadowmask code that's used by MeshLambertMaterial. Here's a PR with the remaining fix: #17423 |
Fix the case where there are two objects with the same material in the scene and one has receiveShadow=true and the other has receiveShadow=false.
This also prevents possible extra shader compiles when the same material is reused with receiveShadow enabled or disabled in the same scene.