GodRays

The GodRays effect requires a mesh that will be used as an origin point for the rays. Refer to this example for more details.

import { GodRays } from '@react-three/postprocessing'

return (
  <GodRays
    sun={sunRef}
    blendFunction={BlendFunction.Screen} // The blend function of this effect.
    samples={60} // The number of samples per pixel.
    density={0.96} // The density of the light rays.
    decay={0.9} // An illumination decay factor.
    weight={0.4} // A light ray weight factor.
    exposure={0.6} // A constant attenuation coefficient.
    clampMax={1} // An upper bound for the saturation of the overall effect.
    width={Resizer.AUTO_SIZE} // Render width.
    height={Resizer.AUTO_SIZE} // Render height.
    kernelSize={KernelSize.SMALL} // The blur kernel size. Has no effect if blur is disabled.
    blur={true} // Whether the god rays should be blurred to reduce artifacts.
  />
)

Props

NameTypeDefaultDescription
sunRefThe light source. Must not write depth and has to be flagged as transparent.
blendFunctionBlendFunctionBlendFunction.ScreenThe blend function of this effect.
samplesNumber60The number of samples per pixel.
densityNumber0.96The density of the light rays.
decayNumber0.9An illumination decay factor.
weightNumber0.4A light ray weight factor.
exposureNumber0.6A constant attenuation coefficient.
clampMaxNumber1An upper bound for the saturation of the overall effect.
widthNumberResizer.AUTO_SIZEThe render width.
heightNumberResizer.AUTO_SIZEThe render height.
kernelSizeKernelSizeKernelSize.SMALLThe blur kernel size. Has no effect if blur is disabled.
blurBooleantrueWhether the god rays should be blurred to reduce artifacts