Skip to main content

The block overlay effect is used to add a color blend whenever the camera is inside certain types of blocks.

This module is dependent on the postprocessing package.

Example

import { EffectComposer, RenderPass } from "postprocessing";

const composer = new EffectComposer(renderer);
composer.addPass(new RenderPass(world, camera));

const overlayEffect = new VOXELIZE.BlockOverlayEffect(world, camera);
overlayEffect.addOverlay("water", new THREE.Color("#5F9DF7"), 0.05);

composer.addPass(
new EffectPass(camera, overlayEffect)
);

Block overlay effect

Hierarchy

  • "postprocessing"

    BlockOverlayEffect

Constructors

constructor

new BlockOverlayEffect(world, camera): BlockOverlayEffect

Create a new block overlay effect.

Parameters

NameTypeDescription
worldWorld<any>The world that the effect is in.
cameraPerspectiveCameraThe camera that the effect is applied to.

Returns

BlockOverlayEffect

Overrides

Effect.constructor

Properties

camera

camera: PerspectiveCamera

The camera that the effect is applied to.


world

world: World<any>

The world that the effect is in.

Methods

addOverlay

addOverlay(idOrName, color, opacity): void

Add a new overlay to a certain voxel type.

Parameters

NameTypeDescription
idOrNamestring | numberThe block ID or name to add an overlay for.
colorColorThe color of the overlay.
opacitynumberThe opacity of the overlay.

Returns

void