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

Fix toggling receiveShadow without changing material #17413

Merged
merged 1 commit into from
Sep 3, 2019

Conversation

Oletus
Copy link
Contributor

@Oletus Oletus commented Sep 3, 2019

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.

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.
@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 3, 2019

I can confirm that this PR fixes #11400! The related fiddle now works with the mentioned workarounds.

I'm not sure we need a new example though. It feels strange to demonstrate something that should have been worked right from the beginning^^.

@mrdoob
Copy link
Owner

mrdoob commented Sep 3, 2019

Beautiful!

I'm not sure we need a new example though. It feels strange to demonstrate something that should have been worked right from the beginning^^.

Agreed. I'll delete the example.

@mrdoob mrdoob added this to the r109 milestone Sep 3, 2019
@mrdoob mrdoob merged commit f4c6da9 into mrdoob:dev Sep 3, 2019
@mrdoob
Copy link
Owner

mrdoob commented Sep 3, 2019

Thanks!

@@ -1792,6 +1792,13 @@ function WebGLRenderer( parameters ) {

}

if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {

materialProperties.receiveShadow = object.receiveShadow;
Copy link
Owner

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, precisely.

@mrdoob
Copy link
Owner

mrdoob commented Sep 4, 2019

Hmm... I only see this locally, but seems to me that the cloth is self-shadowing? 🤔

Screen Shot 2019-09-03 at 5 56 51 PM

Compared to r108:

Screen Shot 2019-09-03 at 5 57 26 PM

@Oletus Oletus deleted the fix-receiveShadow branch September 4, 2019 06:12
@Oletus
Copy link
Contributor Author

Oletus commented Sep 4, 2019

Ah yes, still needed to fix the shadowmask code that's used by MeshLambertMaterial. Here's a PR with the remaining fix: #17423

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

Successfully merging this pull request may close these issues.

3 participants