Class SkyAtmosphereRasterRenderer

A sky / atmosphere renderer that uses GPURenderPipelines to render the sky / atmosphere.

Implements

Constructors

Properties

defaultToFullResolutionRayMarch: boolean
rayMarchRenderer: SkyRayMarchRasterRenderer
withLutsRenderer: SkyWithLutsRasterRenderer

Accessors

Methods

  • Replaces potentially screen-size dependent external resources (depth buffer) in the internal bind groups.

    Parameters

    • depthBuffer: GPUTexture | GPUTextureView

      The depth buffer to limit the ray marching distance when rendering the sky / atmosphere. If this is a textue, a texture view will be created. If this is a texture view, it must be allowed to be bound as a texture<f32>. I.e., if the texture has a depth-stencil format, the texture view must be a "depth-only" view.

    Returns void

  • Renders the aerial perspective lookup table.

    To produce meaningful results, this requires the transmittance and multiple scattering lookup tables, as well as the uniform buffers containing the Atmosphere and Uniforms parameters to hold valid data. Call renderConstantLuts and updateUniforms to ensure this is the case.

    If (a) user-defined shadow map(s) is used (see SkyAtmosphereRendererConfig.shadow), make sure to encode any updates of the shadow map(s) before encoding this pass.

    Parameters

    • passEncoder: GPUComputePassEncoder

      Used to encode rendering of the lookup table. The encoder is not end()ed by this function.

    Returns void

    See

    • renderConstantLuts: To initialize the transmittance and multiple scattering lookup tables, as well as the internal uniform buffer storing the Atmosphere parameters, call this function.
    • updateUniforms: To write Uniforms to the internal uniform buffer, call this function.
  • Renders the transmittance and multiple scattering lookup tables.

    To produce meaningful results, this requires the internal uniform buffer containing the Atmosphere parameters to hold valid data. Use the atmosphere parameter to implicitly update the Atmosphere parameters or call updateAtmosphere to ensure this is the case.

    Since the transmittance and multiple scattering lookup tables are not view or light souce dependent, this only needs to be called if the Atmosphere parameters change.

    Parameters

    • passEncoder: GPUComputePassEncoder

      Used to encode rendering of the lookup tables. The encoder is not end()ed by this function.

    • Optional atmosphere: Atmosphere

      If this is defined, updateAtmosphere is called before rendering the lookup tables.

    Returns void

    See

  • Renders the lookup tables required for rendering the sky / atmosphere.

    To initialize or update the transmittance and multiple scattering lookup tables, pass new Atmosphere paramters to this function or use the forceConstantLutRendering parameter.

    Parameters

    • passEncoder: GPUComputePassEncoder

      A GPUComputePassEncoder to encode passes with. The encoder is not end()ed by this function.

    • Optional uniforms: Uniforms

      Uniforms to use for this frame. If this is given, the internal uniform buffer will be updated using updateUniforms.

    • Optional atmosphere: Atmosphere

      Atmosphere parameters to use for this frame. If this is given, the internal uniform buffer storing the Atmosphere parameters will be updated and the transmittance and multiple scattering lookup tables will be rendered.

    • Optional useFullResolutionRayMarch: boolean

      If this is true, the sky view and aerial perspective lookup tables will not be rendered.

    • Optional forceConstantLutRendering: boolean

      If this is true, the transmittance and multiple scattering lookup tables will be rendered regardless of whether the atmosphere parameter is undefined or not.

    • Optional forceSkyViewLutRendering: boolean

      If this is true, the sky view lookup table will be rendered, even if skipDynamicLutRendering is true. Defaults to false.

    Returns void

    See

  • Renders the multiple scattering lookup table.

    To produce meaningful results, this requires the internal uniform buffer containing the Atmosphere parameters to hold valid data. Call updateAtmosphere to ensure this is the case.

    Since the multiple scattering lookup table is not view or light souce dependent, this only needs to be called if the Atmosphere parameters change.

    Parameters

    • passEncoder: GPUComputePassEncoder

      Used to encode rendering of the lookup table. The encoder is not end()ed by this function.

    Returns void

    See

    updateAtmosphere: To write Atmosphere parameters to the internal uniform buffer, call this function.

  • Renders the sky / atmosphere using either lookup tables or full-resolution ray marching, as well as all look up tables required by the respective approach.

    Parameters

    • passEncoder: GPURenderPassEncoder | GPURenderBundleEncoder

      A GPURenderPassEncoder or GPURenderBundleEncoder to encode the sky / atmosphere rendering pass with. The encoder is not end()ed by this function.

    • Optional useFullResolutionRayMarch: boolean

      If this is true, full-resolution ray marching will be used to render the sky / atmosphere. Defaults to defaultToFullResolutionRayMarch.

    Returns void

    See

  • Renders the sky / atmosphere using full-resolution ray marching.

    Requires the transmittance and multiple scattering lookup tables to be initialized. Either initialize these lookup tables in the constructor using SkyAtmosphereRendererConfig.initializeConstantLuts, or call renderConstantLuts.

    Parameters

    • passEncoder: GPURenderPassEncoder | GPURenderBundleEncoder

      A GPURenderPassEncoder or GPURenderBundleEncoder to encode the pass with. The encoder is not end()ed by this function.

    Returns void

    See

    renderConstantLuts: To initialize the lookup tables required, call this function.

  • Renders the sky view table.

    To produce meaningful results, this requires the transmittance and multiple scattering lookup tables, as well as the uniform buffers containing the Atmosphere and Uniforms parameters to hold valid data. Call renderConstantLuts and updateUniforms to ensure this is the case.

    Parameters

    • passEncoder: GPUComputePassEncoder

      Used to encode rendering of the lookup table. The encoder is not end()ed by this function.

    Returns void

    See

    • renderConstantLuts: To initialize the transmittance and multiple scattering lookup tables, as well as the internal uniform buffer storing the Atmosphere parameters, call this function.
    • updateUniforms: To write Uniforms to the internal uniform buffer, call this function.
  • Renders the sky / atmosphere using precomputed lookup tables.

    Requires the sky view and aerial perspective lookup tables to be initialized. To initialize these lookup tables, call renderDynamicLuts.

    Parameters

    • passEncoder: GPURenderPassEncoder | GPURenderBundleEncoder

      A GPURenderPassEncoder or GPURenderBundleEncoder to encode the pass with. The encoder is not end()ed by this function.

    Returns void

    See

    renderDynamicLuts: To initialize the lookup tables required, call this function.

  • Renders the transmittance lookup table.

    To produce meaningful results, this requires the internal uniform buffer containing the Atmosphere parameters to hold valid data. Call updateAtmosphere to ensure this is the case.

    Since the transmittance lookup table is not view or light souce dependent, this only needs to be called if the Atmosphere parameters change.

    Parameters

    • passEncoder: GPUComputePassEncoder

      Used to encode rendering of the lookup table. The encoder is not end()ed by this function.

    Returns void

    See

    updateAtmosphere: To write Atmosphere parameters to the internal uniform buffer, call this function.