Skip to content

Class: GPULayerCompositor ​

Defined in: GPULayerCompositor.ts:55

GPU-accelerated layer compositor using custom shaders Performs layer blending on the GPU for massive performance improvements

Constructors ​

Constructor ​

ts
new GPULayerCompositor(vertexCount, maxLayers?): GPULayerCompositor;

Defined in: GPULayerCompositor.ts:113

Parameters ​

vertexCount ​

number

maxLayers? ​

number = 8

Returns ​

GPULayerCompositor

Properties ​

SHADER_LAYER_CAPACITY ​

ts
readonly static SHADER_LAYER_CAPACITY: 8 = 8;

Defined in: GPULayerCompositor.ts:56

Methods ​

assessCapacity() ​

ts
static assessCapacity(
   renderer, 
   vertexCount, 
   maxLayers?
): GPUCompositorCapacity;

Defined in: GPULayerCompositor.ts:77

Parameters ​

renderer ​

Pick<THREE.WebGLRenderer, "capabilities">

vertexCount ​

number

maxLayers? ​

number = 8

Returns ​

GPUCompositorCapacity


setMaterialResponse() ​

ts
setMaterialResponse(response): void;

Defined in: GPULayerCompositor.ts:414

Set how the composited surface responds to light, mirroring the MeshPhongMaterial properties of the CPU compositing path. Omitted fields are left unchanged. The diffuse color multiplies the composited layer colour, as a Phong material's colour multiplies vertex colours.

Parameters ​

response ​

GPUMaterialResponse

Returns ​

void


copyMaterialResponse() ​

ts
copyMaterialResponse(source): void;

Defined in: GPULayerCompositor.ts:450

Copy the light response of an existing surface material (typically the CPU path's MeshPhongMaterial) so switching paths does not change the look.

Parameters ​

source ​

Material

Returns ​

void


updateLayers() ​

ts
updateLayers(layers): void;

Defined in: GPULayerCompositor.ts:466

Update layer data in GPU textures

Parameters ​

layers ​

Layer[]

Returns ​

void


getLastUpdateStats() ​

ts
getLastUpdateStats(): GPUCompositorUpdateStats;

Defined in: GPULayerCompositor.ts:664

Returns ​

GPUCompositorUpdateStats


getTextureMemoryUsage() ​

ts
getTextureMemoryUsage(): object;

Defined in: GPULayerCompositor.ts:668

Returns ​

object

layerTextureBytes ​
ts
readonly layerTextureBytes: number;
volumeColormapBytes ​
ts
readonly volumeColormapBytes: number;
totalBytes ​
ts
readonly totalBytes: number;

getMaterial() ​

ts
getMaterial(): ShaderMaterial | null;

Defined in: GPULayerCompositor.ts:697

Get the shader material for use with Three.js mesh

Returns ​

ShaderMaterial | null


setBaseColor() ​

ts
setBaseColor(color): void;

Defined in: GPULayerCompositor.ts:704

Update base color

Parameters ​

color ​

ColorRepresentation

Returns ​

void


clearBaseColor() ​

ts
clearBaseColor(): void;

Defined in: GPULayerCompositor.ts:716

Remove the optional implicit base so an empty GPU stack is transparent.

Returns ​

void


setClipPlanes() ​

ts
setClipPlanes(clipPlanes): void;

Defined in: GPULayerCompositor.ts:728

Update clip planes from a ClipPlaneSet. Clipping uses three.js's own material.clippingPlanes, exactly as the CPU material does, so both paths keep the same side of each plane and clip the deformed (morphed) surface. The renderer needs localClippingEnabled (the viewer sets it).

Parameters ​

clipPlanes ​

ClipPlaneSet

Returns ​

void


setClipPlane() ​

ts
setClipPlane(axis, plane): void;

Defined in: GPULayerCompositor.ts:736

Update a single clip plane

Parameters ​

axis ​

"x" | "y" | "z"

plane ​

ClipPlane

Returns ​

void


clearClipPlanes() ​

ts
clearClipPlanes(): void;

Defined in: GPULayerCompositor.ts:744

Clear all clip planes (disable them)

Returns ​

void


dispose() ​

ts
dispose(): void;

Defined in: GPULayerCompositor.ts:762

Dispose of GPU resources

Returns ​

void

Released under the MIT License.