You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
I think I see the cause of the problem. But I'm not sure what the best solution would be to solve it without potentially causing cross-effects. The codeline: this.fragmentShader = this._getWGSLFragmentCode( shadersData.fragment ); in the WGSLNodeBuilder build this code.
The line near the end in @FragmentnodeVar0 = textureSample( nodeUniform3, nodeUniform3_sampler, ( object.nodeUniform4 * vec3<f32>( nodeVarying3, 1.0 ) ).xy ); leads to the issue. I wonder why the line is generated automatically. There must be a reason for this, so removing the automatic generation of this line could probably lead to other problems. @sunag I assume you know why the line is generated automatically. If one use sampler_comparison, would an if statement be useful to prevent the automatic generation of the textureSample?
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 shadersAlternatives
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 myselfAdditional context
No response
The text was updated successfully, but these errors were encountered: