Inheritance: EventDispatcher → Node → TempNode →
Post-Processing node for apply Screen-space raymarched godrays to a scene.
After the godrays have been computed, it's recommened to apply a Bilateral Blur to the result to mitigate raymarching and noise artifacts.
The composite with the scene pass is ideally done with depthAwareBlend(), which mitigates aliasing and light leaking.
Limitations:
Reference: This Node is a part of three-good-godrays.
const godraysPass = godrays( scenePassDepth, camera, light );
const blurPass = bilateralBlur( godraysPassColor ); // optional blur
const outputBlurred = depthAwareBlend( scenePassColor, blurPassColor, scenePassDepth, camera, { blendColor, edgeRadius, edgeStrength } ); // composite
GodraysNode is an addon, and must be imported explicitly, see Installation#Addons.
import { godrays } from 'three/addons/tsl/display/GodraysNode.js';
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.
The rate of accumulation for the godrays. Higher values roughly equate to more humid air/denser fog.
Default is 0.7.
A node that represents the beauty pass's depth.
Higher values decrease the accumulation of godrays the further away they are from the light source.
Default is 2.
The maximum density of the godrays. Limits the maximum brightness of the godrays.
Default is 0.5.
The number of raymarching steps
Default is 60.
The resolution scale.
The updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore().
Default is 'frame'.
Overrides: TempNode#updateBeforeType
Frees internal resources. This method should be called when the effect is no longer required.
Overrides: TempNode#dispose
Returns the result of the effect as a texture node.
Returns: A texture node that represents the result of the effect.
Sets the size of the effect.
width
The width of the effect.
height
The height of the effect.
This method is used to setup the effect's TSL code.
builder
The current node builder.
Overrides: TempNode#setup
This method is used to render the effect once per frame.
frame
The current node frame.
Overrides: TempNode#updateBefore