Home Reference Source
import {GodRaysEffect} from 'postprocessing/src/effects/GodRaysEffect.js'
public class | source

GodRaysEffect

Extends:

Effect → GodRaysEffect

Indirect Implements:

A god rays effect.

Constructor Summary

Public Constructor
public

constructor(camera: Camera, lightSource: Mesh | Points, options: Object)

Constructs a new god rays effect.

Member Summary

Public Members
public get

Indicates whether the god rays should be blurred to reduce artifacts.

public set
public get

Indicates whether dithering is enabled.

public set

Enables or disables dithering.

public get

The internal god rays material.

public get

The blur kernel size.

public set

Sets the blur kernel size.

public get

The number of samples per pixel.

public set

A higher sample count improves quality at the cost of performance.

public get

texture: Texture

A texture that contains the intermediate result of this effect.

Method Summary

Public Methods
public

Returns the current resolution scale.

public

initialize(renderer: WebGLRenderer, alpha: Boolean)

Performs initialization tasks.

public

setDepthTexture(depthTexture: Texture, depthPacking: Number)

Sets the depth texture.

public

Sets the resolution scale.

public

setSize(width: Number, height: Number)

Updates the size of internal render targets.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number)

Updates this effect.

Inherited Summary

From class Effect
public

The effect attributes.

public

The blend mode of this effect.

public

Preprocessor macro definitions.

public

WebGL extensions that are required by this effect.

public

The fragment shader.

public

The name of this effect.

public

uniforms: Map<String, Uniform>

Shader uniforms.

public

The vertex shader.

public

Performs a shallow search for properties that define a dispose method and deletes them.

public

initialize(renderer: WebGLRenderer, alpha: Boolean)

Performs initialization tasks.

public

setDepthTexture(depthTexture: Texture, depthPacking: Number)

Sets the depth texture.

public

setSize(width: Number, height: Number)

Updates the size of this effect.

public

update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number)

Updates the effect by performing supporting operations.

Public Constructors

public constructor(camera: Camera, lightSource: Mesh | Points, options: Object) source

Constructs a new god rays effect.

Override:

Effect#constructor

Params:

NameTypeAttributeDescription
camera Camera

The main camera.

lightSource Mesh | Points

The light source. Must not write depth and has to be flagged as transparent.

options Object
  • optional

The options.

options.blendFunction BlendFunction
  • optional
  • default: BlendFunction.SCREEN

The blend function of this effect.

options.samples Number
  • optional
  • default: 60.0

The number of samples per pixel.

options.density Number
  • optional
  • default: 0.96

The density of the light rays.

options.decay Number
  • optional
  • default: 0.9

An illumination decay factor.

options.weight Number
  • optional
  • default: 0.4

A light ray weight factor.

options.exposure Number
  • optional
  • default: 0.6

A constant attenuation coefficient.

options.clampMax Number
  • optional
  • default: 1.0

An upper bound for the saturation of the overall effect.

options.resolutionScale Number
  • optional
  • default: 0.5

The render texture resolution scale, relative to the screen render size.

options.kernelSize KernelSize
  • optional
  • default: KernelSize.SMALL

The blur kernel size. Has no effect if blur is disabled.

options.blur Number
  • optional
  • default: true

Whether the god rays should be blurred to reduce artifacts.

Public Members

public get blur: Boolean source

Indicates whether the god rays should be blurred to reduce artifacts.

public set blur: Boolean source

public get dithering: Boolean source

Indicates whether dithering is enabled.

public set dithering: Boolean source

Enables or disables dithering.

public get godRaysMaterial: GodRaysMaterial source

The internal god rays material.

public get kernelSize: KernelSize source

The blur kernel size.

public set kernelSize: KernelSize source

Sets the blur kernel size.

public get samples: Number source

The number of samples per pixel.

public set samples: Number source

A higher sample count improves quality at the cost of performance.

public get texture: Texture source

A texture that contains the intermediate result of this effect.

This texture will be applied to the scene colors unless the blend function is set to SKIP.

Public Methods

public getResolutionScale(): Number source

Returns the current resolution scale.

Return:

Number

The resolution scale.

public initialize(renderer: WebGLRenderer, alpha: Boolean) source

Performs initialization tasks.

Override:

Effect#initialize

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

alpha Boolean

Whether the renderer uses the alpha channel or not.

public setDepthTexture(depthTexture: Texture, depthPacking: Number) source

Sets the depth texture.

Override:

Effect#setDepthTexture

Params:

NameTypeAttributeDescription
depthTexture Texture

A depth texture.

depthPacking Number
  • optional
  • default: 0

The depth packing.

public setResolutionScale(scale: Number) source

Sets the resolution scale.

Params:

NameTypeAttributeDescription
scale Number

The new resolution scale.

public setSize(width: Number, height: Number) source

Updates the size of internal render targets.

Override:

Effect#setSize

Params:

NameTypeAttributeDescription
width Number

The width.

height Number

The height.

public update(renderer: WebGLRenderer, inputBuffer: WebGLRenderTarget, deltaTime: Number) source

Updates this effect.

Override:

Effect#update

Params:

NameTypeAttributeDescription
renderer WebGLRenderer

The renderer.

inputBuffer WebGLRenderTarget

A frame buffer that contains the result of the previous pass.

deltaTime Number
  • optional

The time between the last frame and the current one in seconds.