Capítulo 420 de 859
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.
updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore().const godraysPass = godrays( scenePassDepth, camera, light );
const blurPass = bilateralBlur( godraysPassColor ); // optional blur
const outputBlurred = depthAwareBlend( scenePassColor, blurPassColor, scenePassDepth, camera, { blendColor, edgeRadius, edgeStrength } ); // composite
Constructor
| Signature |
|---|
| `new GodraysNode( depthNode : TextureNode, camera : Camera, light : DirectionalLight |
Properties
| Property | Description |
|---|---|
.density : UniformNode.<float> | The rate of accumulation for the godrays. Higher values roughly equate to more humid air/denser fog. |
.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. |
.maxDensity : UniformNode.<float> | The maximum density of the godrays. Limits the maximum brightness of the godrays. |
.raymarchSteps : UniformNode.<uint> | The number of raymarching steps |
.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(). |
Methods
| Method | Description |
|---|---|
.dispose() | Frees internal resources. This method should be called when the effect is no longer required. |
.getTextureNode() : PassTextureNode | Returns the result of the effect as a texture node. |
.setSize( width : number, height : number ) | Sets the size of the effect. |
.setup( builder : NodeBuilder ) : PassTextureNode | This method is used to setup the effect's TSL code. |
.updateBefore( frame : NodeFrame ) | This method is used to render the effect once per frame. |