Skip to main content

Class: OcclusionUtils

Defined in: src/depth/occlusion/OcclusionUtils.ts:4

Constructors​

Constructor​

new OcclusionUtils(): OcclusionUtils

Returns​

OcclusionUtils

Methods​

addOcclusionToMaterial()​

static addOcclusionToMaterial(material, onShaderReady?): void

Defined in: src/depth/occlusion/OcclusionUtils.ts:35

Configures a material for depth occlusion across both WebGLRenderer and WebGPURenderer, invoking onShaderReady with the uniform handle to register in Depth.occludableShaders.

Parameters​

material​

Material

onShaderReady?​

(shader) => void

Returns​

void


addOcclusionToShader()​

static addOcclusionToShader(shader): void

Defined in: src/depth/occlusion/OcclusionUtils.ts:71

Modifies a material's shader in-place to incorporate distance-based alpha occlusion. This is designed to be used with a material's onBeforeCompile property. This only works with built-in three.js materials.

Parameters​

shader​

Shader

The shader object provided by onBeforeCompile.

Returns​

void


createOcclusionMapOverrideMaterial()​

static createOcclusionMapOverrideMaterial(): MeshBasicMaterial

Defined in: src/depth/occlusion/OcclusionUtils.ts:60

Creates a simple material used for rendering objects into the occlusion map. This material is intended to be used with renderer.overrideMaterial.

Returns​

MeshBasicMaterial

A new instance of THREE.MeshBasicMaterial.


setWebGPUMaterialHandler()​

static setWebGPUMaterialHandler(handler): void

Defined in: src/depth/occlusion/OcclusionUtils.ts:15

Registers or clears the WebGPU TSL material occlusion handler. Called internally by Depth.init() when WebGPURenderer is active.

Parameters​

handler​

(material) => Shader | undefined

Returns​

void