playcanvas-opti-pixel - v1.3.1
    Preparing search index...

    Interface IHierarchicalZBuffer

    Device-Z pyramid built from the camera depth. Testers compare an AABB's closest device Z with the mip that covers its screen rectangle.

    interface IHierarchicalZBuffer {
        buffers?: Texture[];
        enabled: boolean;
        height: number;
        mipLevels: number;
        screenHeight: number;
        screenWidth: number;
        texture: Texture | null;
        uvFactor: readonly [number, number];
        width: number;
        isColor(): boolean;
        isFloat16(): boolean;
        isFloat32(): boolean;
        update(camera: Camera): void;
        updateSceneDepth(camera: Camera): void;
    }

    Implemented by

    Index
    buffers?: Texture[]

    One texture per stored mip. WebGL keeps the finest levels outside a single mip chain. WebGPU stores every level on texture and leaves this unset.

    enabled: boolean

    When false, update and updateSceneDepth do nothing and testers skip the pyramid.

    height: number

    Height of the first stored mip.

    mipLevels: number

    Number of stored mips, including the first.

    screenHeight: number

    Height of the depth source the pyramid was built from.

    screenWidth: number

    Width of the depth source the pyramid was built from.

    texture: Texture | null

    Pyramid texture: WebGL's first ping-pong target, or the WebGPU mip chain. Null before the first resize.

    uvFactor: readonly [number, number]

    Scale from screen UV to the first stored mip. Testers multiply the screen rectangle by this before sampling.

    width: number

    Width of the first stored mip.

    • Max-downsample the hardware depth grab (requestSceneDepthMap / renderPassDepthGrab) into the pyramid. Device Z is stored as-is. No-op without a grab texture, or when disabled. Call after opaque depth.

      Parameters

      • camera: Camera

      Returns void

    • Same pyramid as update, from camera.sceneDepthMap. The encoding comes from camera.shaderParams (sceneDepthMapLinear, sceneDepthMapPacked, sceneDepthMapReciprocal): view-space metres, packed RGBA8, or 1 / viewZ. The first pass point-samples that texture and stores device Z. Later mips and the occlusion test stay in device Z. No-op until the map is published, or when disabled. Call from postrender or frameend.

      Parameters

      • camera: Camera

      Returns void