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

ShadowMaps for custom wgslFn shaders #30685

Open
Spiri0 opened this issue Mar 8, 2025 · 0 comments
Open

ShadowMaps for custom wgslFn shaders #30685

Spiri0 opened this issue Mar 8, 2025 · 0 comments

Comments

@Spiri0
Copy link
Contributor

Spiri0 commented Mar 8, 2025

Description

I looked through the examples for shadows and didn't find one where a shadow map with a custom shader is used. Since WebGPU allows you to create multiple geometries with compute shaders in the GPU and also their worldMatrices and store these directly in structArrays in storageBuffers, there is a need to be able to use shadow maps in your own shaders.

I tried to use sampler_comparison but I get an error message. I have a modified example from the examples in which you can see what the shadow texture looks like. If I integrate the sampler into the shader, the shader no longer works.

https://codepen.io/Spiri0/pen/xbxreyr

Insert line 129 under line 137

Solution

Make sampler_comparison available for wgslFn so that you can use textureSampleCompare for shadowMaps in own shaders

Alternatives

I haven't an idea of a good alternative, if there is one.
sampler_comparison only appears in one place in the WGSLNodeBuilder. So I hope that it won't be too much work. I'm not very familiar with this part of the code, otherwise I would try to solve it by myself

Additional context

No response

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

No branches or pull requests

1 participant