CubeReflectionProbe - Verge3D User Manual - Soft8Soft
Description: Learn how to use CubeReflectionProbe in your interactive 3D apps made with Verge3D

Object3D →

# CubeReflectionProbe

A light probe that applies environment IBL to objects located inside its volume of influence. Used for adding local IBL to a scene.

## Code Example

`const probe = new v3d.CubeReflectionProbe(); probe.update(scene, renderer); app.scene.add(probe);`

## Constructor

### CubeReflectionProbe(size : Integer)

size — (optional) texture size. Default is `256`.

Creates a new CubeReflectionProbe.

## Properties

See the base Object3D class for inherited properties.

### # .influenceDistance : Float

Controls how big the sphere/box of influence is. This parameter defines a sphere radius if influenceType equals v3d.ReflectionProbeTypeSphere and half the cube edge size if influenceType equals v3d.ReflectionProbeTypeBox. The influence volume is used for testing which objects are affected by the probe (simply those contained inside the volume). Default is `1`.

It's recommended to keep this value and .parallaxDistance the same for more consistent results.

### # .influenceGroup : String

Limits scene objects affected by the probe to this group. If not `null` it is used instead of .influenceType and .influenceDistance to determine which objects should be affected. Default is `null`, which means that the .influenceType and .influenceDistance settings are used as usual.

### # .influenceGroupInv : Boolean

If .influenceGroup is not `null` this option (if `true`) makes it so only objects that don't belong to .influenceGroup are affected by the probe. Default is `false`.

### # .influenceType : Constant

Defines the type of the influence volume. Can be v3d.ReflectionProbeTypeInfinite (used for the Scene.worldEnvMapProbe probe object), v3d.ReflectionProbeTypeSphere or v3d.ReflectionProbeTypeBox. The influence volume is used for testing which objects are affected by the probe (simply those contained inside the volume). Default is v3d.ReflectionProbeTypeSphere.

It's recommended to keep this value and .parallaxType the same for more consistent results.

### # .matrixWorldInverse : Matrix4

The inverse of matrixWorld.

### # .parallaxDistance : Float

Controls how big the sphere/box for the parallax effect is. This parameter defines a sphere radius if parallaxType equals v3d.ReflectionProbeTypeSphere and half the cube edge size if parallaxType equals v3d.ReflectionProbeTypeBox. The parallax volume is used for calculating the parallax effect. Default is `1`.

It's recommended to keep this value and .influenceDistance the same for more consistent results.

### # .parallaxType : Constant

Defines the type of the parallax volume. Can be v3d.ReflectionProbeTypeInfinite (used for the Scene.worldEnvMapProbe probe object), v3d.ReflectionProbeTypeSphere or v3d.ReflectionProbeTypeBox. The parallax volume is used for calculating the parallax effect. Default is v3d.ReflectionProbeTypeSphere.

It's recommended to keep this value and .influenceType the same for more consistent results.

### # .probeClipEnd : Float

Objects located further than this value won't appear on the probe's environment map. Default is `100`.

### # .probeClipStart : Float

Objects located closer than this value won't appear on the probe's environment map. Default is `0.1`.

### # .probeIntensity : Float

Controls the intensity (exposure) of the probe's environment map. Default is `1`.

### # .renderTarget : WebGLRenderTarget

A WebGLRenderTarget instance containing the rendered environment map. Default is `null`. Updated automatically after calling the .update method.

### # .type : String

A string `"CubeReflectionProbe"`. This can be used to find all CubeReflectionProbe objects. Shouldn't be changed.

### # .visibilityGroup : String

If not `null`, only objects from this group are rendered into the environment map (see also Object3D.groupNames). Default is `null`, which means no visibility group is used and the probe renders all scene objects.

### # .visibilityGroupInv : Boolean

If .visibilityGroup is not `null` this option (if true) makes it so only objects that don't belong to the specified .visibilityGroup are rendered into the environment map. Default is `false`.

## Methods

See the base Object3D class for inherited methods.

### # .dispose()

Remove resources related to the render targets used by this object from memory.

### # .intersectsMesh(mesh : Mesh) → Boolean

mesh — a Mesh object to test intersections with.

Check if there's any intersection between the probe's influence volume (see .influenceDistance and .influenceType) and the given mesh object. Returns the checking result. Exact calculations depend on .influenceType, for example for v3d.ReflectionProbeTypeInfinite the method always returns `true`.

### # .onUpdate(cubeRT : WebGLCubeRenderTarget) → WebGLRenderTarget

cubeRT — a cube render target containing the environment map.

A callback executed after the environment map is rendered in the .update method. Receives a WebGLCubeRenderTarget instance in the `cubeRT` parameter which contains the rendering results. The value returned from this function must be an instance of WebGLRenderTarget and will be used as a final .renderTarget. Returns the same `cubeRT` render target by default.

This callback can be overridden to apply custom changes to the environment map each time .update is called. It is already used for all cube reflection probes in the scene if it has its IBL environment mode set to `PMREM`.

### # .setSize(size : Integer)

size — new environment map size.

Set the environment map size.

### # .update(scene : Scene, renderer : WebGLRenderer)

- scene — a scene to render.
- renderer — a WebGLRenderer instance.

Render the given scene into the probe's environment map. The rendering result will be in the .renderTarget property.

## Source

For more info on how to obtain the source code of this module see this page.