Back to Three Js

GodraysNode

docs/pages/GodraysNode.html

latest3.0 KB
Original Source

Import

GodraysNode is an addon, and must be imported explicitly, see Installation#Addons.

import { godrays } from 'three/addons/tsl/display/GodraysNode.js';

Constructor

new GodraysNode( depthNode : TextureNode, camera : Camera, light : DirectionalLight | PointLight )

Constructs a new Godrays node.

| depthNode |

A texture node that represents the scene's depth.

| | camera |

The camera the scene is rendered with.

| | light |

The light the godrays are rendered for.

|

Properties

.density : UniformNode.<float>

The rate of accumulation for the godrays. Higher values roughly equate to more humid air/denser fog.

Default is 0.7.

.depthNode : TextureNode

A node that represents the beauty pass's depth.

.distanceAttenuation : UniformNode.<float>

Higher values decrease the accumulation of godrays the further away they are from the light source.

Default is 2.

.maxDensity : UniformNode.<float>

The maximum density of the godrays. Limits the maximum brightness of the godrays.

Default is 0.5.

.raymarchSteps : UniformNode.<uint>

The number of raymarching steps

Default is 60.

.resolutionScale : number

The resolution scale.

.updateBeforeType : string

The updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore().

Default is 'frame'.

Overrides: TempNode#updateBeforeType

Methods

.dispose()

Frees internal resources. This method should be called when the effect is no longer required.

Overrides: TempNode#dispose

.getTextureNode() : PassTextureNode

Returns the result of the effect as a texture node.

Returns: A texture node that represents the result of the effect.

.setSize( width : number, height : number )

Sets the size of the effect.

| width |

The width of the effect.

| | height |

The height of the effect.

|

.setup( builder : NodeBuilder ) : PassTextureNode

This method is used to setup the effect's TSL code.

| builder |

The current node builder.

|

Overrides: TempNode#setup

.updateBefore( frame : NodeFrame )

This method is used to render the effect once per frame.

| frame |

The current node frame.

|

Overrides: TempNode#updateBefore

Source

examples/jsm/tsl/display/GodraysNode.js