babylon.quarks - v1.0.0
    Preparing search index...

    Type Alias SoftDepthEncoding

    SoftDepthEncoding: "linear" | "nonLinear" | "viewZ"

    What a soft-particle depth texture stores per pixel, so the shaders can turn it back into the distance from the camera. These are the three outputs of Babylon's DepthRenderer:

    • 'linear': Babylon's default depth metric, scene.enableDepthRenderer(). Linear in view depth between the camera's near and far planes.
    • 'nonLinear': the depth buffer value, enableDepthRenderer(camera, true). This is what Unity's _CameraDepthTexture holds and what LinearEyeDepth undoes.
    • 'viewZ': the view-space Z itself, enableDepthRenderer(camera, false, true, sampling, true). Exact at any range and with an infinite far plane (camera.maxZ = 0), which the other two cannot represent; this is the closest match to Unreal's SceneDepth.

    Perspective and orthographic cameras, both NDC depth ranges (WebGL, WebGPU) and a reverse depth buffer are all handled, from the camera drawing the particles. With a reverse depth buffer and 'nonLinear', clear the depth renderer to 0 (depthRenderer.clearColor.r = 0): it clears to 1 by default, which a reverse buffer reads as the near plane, so empty sky would fade every particle in front of it. A packed 'viewZ' cannot be decoded.