sceneDistance.shaderModule
- README.md723 B
- module.wgsl5.3 KB
This package holds more than this page lists. See all of its files in its world.
README.md
sceneDistance
zero_scene_metres(uv, depth) -> f32 — a scene-depth sample as distance in
metres from the camera drawing the current render.
A material is shared by every view at once: the live viewport, offscreen captures, render-to-texture cameras. Each renders with its own camera, and each binds the engine uniform block carrying THAT camera's inverse view-projection and position. This helper decodes a depth sample against those, so a depth-measuring material reads correctly in every view — where a decode parameterised on one camera's near/far planes reads correctly in one view and lies in the rest.
Material shaders only; a post-process or compute pass does not bind the engine uniform block this reads.