How to use custom masks in MaterialExtension #20022
-
I'm looking for how to use The setup involves comparing MeshTags to a Expected: I expect discarded pixels to not render I setup my extension as follows:
The
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Figured it out. You'll have to discard in both the fragment shader, and a preprocess fragment shader. Unfortunately, this seems to break shadows. Working on how to fix this. So your MaterialExtension gets:
Here's
|
Beta Was this translation helpful? Give feedback.
-
Shadow mapping uses the prepass vertex/fragment shaders. Specifically the depth prepass is basically what's used for shadow mapping. So make sure the depth prepass #ifdefs and such are correct. |
Beta Was this translation helpful? Give feedback.
-
Thanks @JMS55 - that's super helpful. What I ended up doing to get it working was to copy the pbr_prepass.wgsl material, and then applying modifications to it. This now allows me to mask out using Now
|
Beta Was this translation helpful? Give feedback.
Thanks @JMS55 - that's super helpful. What I ended up doing to get it working was to copy the pbr_prepass.wgsl material, and then applying modifications to it.
This now allows me to mask out using
AlphaMode::Mask(_)
. Right now when pixels are masked out, their shadows are removed. Eventually I'd like to have their shadows continue appearing, but this is suitable for now.Now
masked_prepass.wgsl
looks like