What is the intended way to linearly sample from a depth texture? #5151
Unanswered
aaeberharter
asked this question in
Q&A
Replies: 1 comment 3 replies
-
|
Currently you can not linear filter a depth texture except for comparisons. This is because the various APIs list the results as undefined. I think, but could be wrong, that this is the data for vulkan devices As for your options, my guess would be
Off the top of my head, here's some code. I didn't double check it (sorry) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Deferred rendering is common place and an important task for methods like SSAO is sampling the depth buffer, e.g. to re-construct the world position. Reading the current spec of WebGPU and WGSL it is not clear how this can be achieved.
What is the intended way to linearly sample from the depth buffer in the current spec?
Some options for answers I have explored:
Find a combination of
BindGroupLayoutEntryof the depth texture ,Samplerand itsBindGroupLayoutEntryas well as the WGSL shader binding layout to maketextureSampleLevelwork. - I extensively tried this but did not succeed with the current ChromeImplement a custom WGSL function to compute filtering weights an call
textureLoad4 times to access the depth of a quad without sampler. - This is my current method but it seems to have poor precisionAttach additional regular filterable float textures to the geometry render pass and output the z coordinate there. - This seems cumbersome and a waste of memory
Copy the depth buffer to a regular texture - same as above
Beta Was this translation helpful? Give feedback.
All reactions