PostProcessStageComposite

A collection of PostProcessStages or other post-process composite stages that execute together logically.

All stages are executed in the order of the array. The input texture changes based on the value of inputPreviousStageTexture. If inputPreviousStageTexture is true, the input to each stage is the output texture rendered to by the scene or of the stage that executed before it. If inputPreviousStageTexture is false, the input texture is the same for each stage in the composite. The input texture is the texture rendered to by the scene or the output texture of the previous stage.

// Example 1: separable blur filter
// The input to blurXDirection is the texture rendered to by the scene or the output of the previous stage.
// The input to blurYDirection is the texture rendered to by blurXDirection.
scene.postProcessStages.add(new PostProcessStageComposite({
stages : [blurXDirection, blurYDirection]
}));
// Example 2: referencing the output of another post-process stage
scene.postProcessStages.add(new PostProcessStageComposite({
inputPreviousStageTexture : false,
stages : [
// The same as Example 1.
new PostProcessStageComposite({
inputPreviousStageTexture : true
stages : [blurXDirection, blurYDirection],
name : 'blur'
}),
// The input texture for this stage is the same input texture to blurXDirection since inputPreviousStageTexture is false
new PostProcessStage({
fragmentShader : compositeShader,
uniforms : {
blurTexture : 'blur' // The output of the composite with name 'blur' (the texture that blurYDirection rendered to).
}
})
]
});
// Example 3: create a uniform alias
const uniforms = {};
defineProperties(uniforms, {
filterSize : {
get : function() {
return blurXDirection.uniforms.filterSize;
},
set : function(value) {
blurXDirection.uniforms.filterSize = blurYDirection.uniforms.filterSize = value;
}
}
});
scene.postProcessStages.add(new PostProcessStageComposite({
stages : [blurXDirection, blurYDirection],
uniforms : uniforms
}));

See also

Constructors

Link copied to clipboard

Types

Link copied to clipboard

Properties

Link copied to clipboard

Whether or not to execute this post-process stage when ready.

Link copied to clipboard

All post-process stages are executed in the order of the array. The input texture changes based on the value of inputPreviousStageTexture. If inputPreviousStageTexture is true, the input to each stage is the output texture rendered to by the scene or of the stage that executed before it. If inputPreviousStageTexture is false, the input texture is the same for each stage in the composite. The input texture is the texture rendered to by the scene or the output texture of the previous stage.

Link copied to clipboard
val length: Int

The number of post-process stages in this composite.

Link copied to clipboard

The unique name of this post-process stage for reference by other stages in a PostProcessStageComposite.

Link copied to clipboard

Determines if this post-process stage is ready to be executed.

Link copied to clipboard

The features selected for applying the post-process.

Link copied to clipboard

An alias to the uniform values of the post-process stages. May be undefined; in which case, get each stage to set uniform values.

Functions

Link copied to clipboard
fun destroy()

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Link copied to clipboard
operator fun get(index: Int): Any

Gets the post-process stage at index

Link copied to clipboard

Returns true if this object was destroyed; otherwise, false.