API

Class GIRSMManager

Class used to manage the global illumination contribution calculated from reflective shadow maps (RSM).

Index
  • Creates a new GIRSMManager

    Parameters

    • scene: Scene

      The scene

    • outputDimensions: { height: number; width: number }

      The dimensions of the output texture (width and height). Should normally be the same as the output dimensions of the screen.

    • giTextureDimensions: { height: number; width: number } = ...

      The dimensions of the GI texture (width and height). Try to use the smallest size possible for better performance.

    • maxSamples: number = 2048

      The maximum number of samples to generate in the sample texture. Default value is 2048. The numSamples property of the GIRSM should be less than or equal to this value!

    • giTextureType: any = Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV

      The texture type used by the GI texture. Default is Constants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV.

    Returns GIRSMManager

blurDepthThreshold: number = 0.05

Defines the depth threshold used by the bilateral blur post-processes (also used by the upsampling, if enabled). You may have to change this value, depending on your scene.

blurKernel: number = 12

Defines the kernel size used by the bilateral blur post-processes. Default is 12.

blurNormalThreshold: number = 0.25

Defines the normal threshold used by the bilateral blur post-processes (also used by the upsampling, if enabled). You may have to change this value, depending on your scene.

pause: boolean = false

Defines if the global illumination calculation is paused or not. Use this setting to pause the global illumination calculation when you know that the scene (camera/mesh/light positions) is not changing anymore to save some GPU power. The scene will still be rendered with the latest global illumination contribution.

upsamplerKernel: number = 6

Defines the kernel size used by the bilateral upsampling post-processes. Default is 6.

GeometryBufferTextureTypesAndFormats: {
    [key: number]: { textureFormat: number; textureType: number };
} = ...

Defines the default texture types and formats used by the geometry buffer renderer.

  • get countersGPU(): { name: string; value: number }[]

    Gets the list of GPU counters used by the manager. GPU timing measurements must be enabled for the counters to be filled (engine.enableGPUTimingMeasurements = true). Only available with WebGPU. You will still get the list of counters with other engines but the values will always be 0.

    Returns { name: string; value: number }[]

  • Add a material to the manager. This will enable the global illumination contribution for the material.

    Parameters

    • Optionalmaterial: any

      Material that will be affected by the global illumination contribution. If not provided, all materials of the scene will be affected.

    Returns void

  • Generates the sample texture used by the the global illumination calculation process.

    Parameters

    • maxSamples: number

      The maximum number of samples to generate in the texture. Default value is 2048. The numSamples property of the GIRSM should be less than or equal to this value!

    Returns void

  • Recreates the resources used by the manager. You should normally not have to call this method manually, except if you change the useFullTexture property of a GIRSM, because the manager won't track this change.

    Parameters

    • disposeGeometryBufferRenderer: boolean = false

      Defines if the geometry buffer renderer should be disposed and recreated. Default is false.

    Returns void

  • Sets the dimensions of the GI texture. Try to use the smallest size possible for better performance.

    Parameters

    • dimensions: { height: number; width: number }

      The dimensions of the GI texture (width and height)

    Returns void

  • Sets the output dimensions of the final process. It should normally be the same as the output dimensions of the screen.

    Parameters

    • dimensions: { height: number; width: number }

      The dimensions of the output texture (width and height)

    Returns void