How to set comparision sampler mode in webgpu?


In old version (version alpha) I used this way to create webgpuEngine:


webgpu is running in comparision sampler mode, I can sampler depth texture in postprocess.

In new version(5.2.0), this way seems that doesn’t work now, how I init webgpu engine with comparision mode?

Postprocess to show screen space convert world position:

Postprocess volume fog:

This fog need depth to check whether it should be draw.

Another question:

I use a rawTexture2D to sampler fog, it shows not continues. sampler mode in webgpu is not same same with webgl, do I have any way to fix it?

I don’t understand your first question, the initialization of the WebGPU engine does not affect how the texture sampling will be done. Does your project work in WebGL? I think we would need a repro in the Playground or a link to your project to be able to help more. Also, try to use a newer version (we are currently at 5.10.0), maybe something has been corrected on the WebGPU side since 5.2.0.

Regarding your 2nd question, WebGPU does not support bilinear filtering of 32 bits float textures yet (an extension should add this support in the future). You should try with a 16 bits float texture instead (TEXTURETYPE_HALF_FLOAT) where bilinear filtering is supported out of the box.


Hi``` good morning (maybe
In this scene, mountain, lighting scan(base on depth), volumetricFog(base on depth) work well all.

Once I add Ocean into this scene…
ohhhh I think I have known what is wrong…

I create nonLinear depthRender for my pipeline,Ocean create linear depth render, so depthRender is linear after I create ocean :rofl: :joy: