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

WebGLShadowMap: Add support for rendering shadows with alpha maps and alpha test. #22410

Merged
merged 5 commits into from
Aug 24, 2021

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Aug 24, 2021

Fixes #4744

Description

Used #22287 as reference.

Screen.Recording.2021-08-24.at.6.26.11.PM.mov

@mrdoob mrdoob added this to the r132 milestone Aug 24, 2021
Comment on lines 245 to 246
if ( ( _renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 ) ||
( material.displacementMap && material.displacementScale !== 0 ) || material.alphaMap ) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Not a bit fan of this code. But, to be honest, I've not tried to understand it...

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 24, 2021

After this PR, this code shouldn't be needed.

Can anyone think of use cases for customDepthMaterial or can we remove it? 😇

@mrdoob
Copy link
Owner Author

mrdoob commented Aug 24, 2021

Actually, seems like customDepthMaterial and customDistanceMaterial are not even properties of Object3D...

They are only referenced in WebGLShadowMap even if they are documented.

The docs say:

if you are (a) modifying vertex positions in the vertex shader, (b) using a displacement map, (c) using an alpha map with alphaTest, or (d) using a transparent texture with alphaTest

Seems like we've most cases covered.

@gkjohnson
Copy link
Collaborator

gkjohnson commented Aug 24, 2021

Can anyone think of use cases for customDepthMaterial or can we remove it? 😇

Seems like we've most cases covered.

They would only be needed if people want to cast shadows and are doing custom vertex manipulation / animation or custom fragment discard logic with a ShaderMaterial, I think. It seems like we could remove cases (b), (c), and (d) from the docs.

@WestLangley
Copy link
Collaborator

Other use cases:

  1. alphaTest with RGBA map
  2. transparent and/or double-sided
  3. with front-side or back-sided shadows

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.

Feature Request: Support Alpha Test in ShadowMapPlugin?
3 participants