|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
System for pre-baking global illumination. More...
#include <GREM/graphics_3d/LightBaker3D.hpp>
Public Member Functions | |
| LightBaker3D (Device &device, Renderer3D &renderer3D, const LightBaker3DOptions &options={}) | |
| Construct a light baker. | |
| void | bakeSkybox (Sky3D &sky, Texture newSkyTexture, const Sky3DOptions &newSkyOptions) |
| Render a sky map texture onto a sky. | |
| void | bakeSkybox (Sky3D &sky, const resource::ImageView &newSkyImage, const Sky3DOptions &newSkyOptions, const TextureImageUploadOptions &newSkyImageUploadOptions={.convertToPremultipliedAlpha=false,.generateMipmap=false}) |
| Render a sky map image onto a sky. | |
| void | bakeDiffuseLighting (LightProbeVolumes3D &lightProbeVolumes, FunctionView< void(RenderPass &, const Camera3D &)> drawRadiance, FunctionView< void(RenderPass &, const Camera3D &)> drawDistance) |
| Render the irradiance and distance maps of a set of light probe volumes. | |
| void | bakeLightProbeIrradianceMap (LightProbeVolumes3D &lightProbeVolumes, uint32_t lightProbeVolumeIndex, u32vec3 lightProbeGridIndices, FunctionView< void(RenderPass &, const Camera3D &)> drawRadiance) |
| Render the irradiance map of a single light probe of a specific volume in a set of light probe volumes. | |
| void | bakeAllLightProbeIrradianceMaps (LightProbeVolumes3D &lightProbeVolumes, FunctionView< void(RenderPass &, const Camera3D &)> drawRadiance) |
| Render the irradiance maps of all light probes of all volumes in a set of light probe volumes. | |
| void | bakeLightProbeDistanceMap (LightProbeVolumes3D &lightProbeVolumes, uint32_t lightProbeVolumeIndex, u32vec3 lightProbeGridIndices, FunctionView< void(RenderPass &, const Camera3D &)> drawDistance) |
| Render the distance map of a single light probe of a specific volume in a set of light probe volumes. | |
| void | bakeAllLightProbeDistanceMaps (LightProbeVolumes3D &lightProbeVolumes, FunctionView< void(RenderPass &, const Camera3D &)> drawDistance) |
| Render the distance maps of all light probes of all volumes in a set of light probe volumes. | |
| void | bakeSpecularReflections (ReflectionProbes3D &reflectionProbes, FunctionView< void(RenderPass &, const Camera3D &)> drawReflection) |
| Render the reflection maps of a set of reflection probes. | |
| void | bakeReflectionProbeReflectionMap (ReflectionProbes3D &reflectionProbes, uint32_t reflectionProbeIndex, FunctionView< void(RenderPass &, const Camera3D &)> drawReflection) |
| Render the reflection map of a single reflection probe in a set of reflection probes. | |
| void | bakeAllReflectionProbeReflectionMaps (ReflectionProbes3D &reflectionProbes, FunctionView< void(RenderPass &, const Camera3D &)> drawReflection) |
| Render all reflection maps in a set of reflection probes. | |
| Texture | generateCubemapFromEquirectangularMap (TextureFormat internalFormat, uint32_t resolution, const Texture &equirectangularMap, Optional< TextureSamplerOptions > samplerOptions=TextureSamplerOptions{ .minificationFilter=TextureFilter::LINEAR,.magnificationFilter=TextureFilter::LINEAR,.mipmapMode=TextureMipmapMode::NONE,.horizontalWrappingMode=TextureWrappingMode::CLAMP_TO_EDGE,.verticalWrappingMode=TextureWrappingMode::CLAMP_TO_EDGE,.maxAnisotropy=1.0f, }) |
| Generate a cubemap from a 2D equirectangular map texture. | |
System for pre-baking global illumination.
| grem::graphics::LightBaker3D::LightBaker3D | ( | Device & | device, |
| Renderer3D & | renderer3D, | ||
| const LightBaker3DOptions & | options = {} ) |
Construct a light baker.
| device | device to create the baker for. Must outlive the baker. |
| renderer3D | system providing 3D rendering capabilities. Must outlive the baker. |
| options | baking options, see LightBaker3DOptions. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeSkybox | ( | Sky3D & | sky, |
| Texture | newSkyTexture, | ||
| const Sky3DOptions & | newSkyOptions ) |
Render a sky map texture onto a sky.
| sky | sky to render onto. |
| newSkyTexture | new sky texture to set. Must be a cube texture, an equirectangular 2D texture or an empty texture without a value. |
| newSkyOptions | sky options, see SkyOptions. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeSkybox | ( | Sky3D & | sky, |
| const resource::ImageView & | newSkyImage, | ||
| const Sky3DOptions & | newSkyOptions, | ||
| const TextureImageUploadOptions & | newSkyImageUploadOptions = {.convertToPremultipliedAlpha=false,.generateMipmap=false} ) |
Render a sky map image onto a sky.
| sky | sky to render onto. |
| newSkyImage | new sky map image to set. Must be a cube image, an equirectangular 2D image or an empty image without a value. |
| newSkyOptions | sky options, see SkyOptions. |
| newSkyImageUploadOptions | options for the new sky map image to set, see TextureImageUploadOptions. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeDiffuseLighting | ( | LightProbeVolumes3D & | lightProbeVolumes, |
| FunctionView< void(RenderPass &, const Camera3D &)> | drawRadiance, | ||
| FunctionView< void(RenderPass &, const Camera3D &)> | drawDistance ) |
Render the irradiance and distance maps of a set of light probe volumes.
| lightProbeVolumes | set of light probe volumes to bake. |
| drawRadiance | function that records the draw commands for the radiance of the surroundings of the light probes. Should draw an image from the given camera's perspective in HDR color without tonemapping onto the given render pass. The alpha channel of the drawn image is ignored. |
| drawDistance | function that records the draw commands for the distance of the surroundings of the light probe. Should draw an image from the given camera's perspective with distance in the red channel onto the given render pass, with backface culling disabled. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeLightProbeIrradianceMap | ( | LightProbeVolumes3D & | lightProbeVolumes, |
| uint32_t | lightProbeVolumeIndex, | ||
| u32vec3 | lightProbeGridIndices, | ||
| FunctionView< void(RenderPass &, const Camera3D &)> | drawRadiance ) |
Render the irradiance map of a single light probe of a specific volume in a set of light probe volumes.
| lightProbeVolumes | set of light probe volumes containing the light probe to bake. |
| lightProbeVolumeIndex | index of the light probe volume in the set of light probe volumes. Must be less than lightProbeVolumes.getVolumeOptions().size(). |
| lightProbeGridIndices | local grid coordinates of the light probe in the specified light probe volume. Must be in range of the specified volume's LightProbeVolumeOptions3D::probeCounts. |
| drawRadiance | function that records the draw commands for the radiance of the surroundings of the light probe. Should draw an image from the given camera's perspective in HDR color without tonemapping onto the given render pass. The alpha channel of the drawn image is ignored. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeAllLightProbeIrradianceMaps | ( | LightProbeVolumes3D & | lightProbeVolumes, |
| FunctionView< void(RenderPass &, const Camera3D &)> | drawRadiance ) |
Render the irradiance maps of all light probes of all volumes in a set of light probe volumes.
| lightProbeVolumes | set of light probe volumes to bake the irradiance maps for. |
| drawRadiance | function that records the draw commands for the radiance of the surroundings of the light probes. Should draw an image from the given camera's perspective in HDR color without tonemapping onto the given render pass. The alpha channel of the drawn image is ignored. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeLightProbeDistanceMap | ( | LightProbeVolumes3D & | lightProbeVolumes, |
| uint32_t | lightProbeVolumeIndex, | ||
| u32vec3 | lightProbeGridIndices, | ||
| FunctionView< void(RenderPass &, const Camera3D &)> | drawDistance ) |
Render the distance map of a single light probe of a specific volume in a set of light probe volumes.
| lightProbeVolumes | set of light probe volumes containing the light probe to bake. |
| lightProbeVolumeIndex | index of the light probe volume in the set of light probe volumes. Must be less than lightProbeVolumes.getVolumeOptions().size(). |
| lightProbeGridIndices | local grid coordinates of the light probe in the specified light probe volume. Must be in range of the specified volume's LightProbeVolumeOptions3D::probeCounts. |
| drawDistance | function that records the draw commands for the distance of the surroundings of the light probe. Should draw an image from the given camera's perspective with distance in the red channel onto the given render pass, with backface culling disabled. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeAllLightProbeDistanceMaps | ( | LightProbeVolumes3D & | lightProbeVolumes, |
| FunctionView< void(RenderPass &, const Camera3D &)> | drawDistance ) |
Render the distance maps of all light probes of all volumes in a set of light probe volumes.
| lightProbeVolumes | set of light probe volumes to bake the distance maps for. |
| drawDistance | function that records the draw commands for the distance of the surroundings of the light probe. Should draw an image from the given camera's perspective with distance in the red channel onto the given render pass, with backface culling disabled. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeSpecularReflections | ( | ReflectionProbes3D & | reflectionProbes, |
| FunctionView< void(RenderPass &, const Camera3D &)> | drawReflection ) |
Render the reflection maps of a set of reflection probes.
| reflectionProbes | set of reflection probes to bake. |
| drawReflection | function that records the draw commands for the surroundings of the reflection probes. Should draw an image from the given camera's perspective in HDR color without tonemapping onto the given render pass. The depth buffer of the drawn image is used to determine which pixels are part of the reflection probe's purview by comparing them to the maximum depth value. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeReflectionProbeReflectionMap | ( | ReflectionProbes3D & | reflectionProbes, |
| uint32_t | reflectionProbeIndex, | ||
| FunctionView< void(RenderPass &, const Camera3D &)> | drawReflection ) |
Render the reflection map of a single reflection probe in a set of reflection probes.
| reflectionProbes | set of reflection probes containing the reflection probe to bake. |
| reflectionProbeIndex | index of the reflection probe in the set of reflection probes. Must be less than reflectionProbes.getProbeOptions().size(). |
| drawReflection | function that records the draw commands for the surroundings of the reflection probe. Should draw an image from the given camera's perspective in HDR color without tonemapping onto the given render pass. The depth buffer of the drawn image is used to determine which pixels are part of the reflection probe's purview by comparing them to the maximum depth value. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::graphics::LightBaker3D::bakeAllReflectionProbeReflectionMaps | ( | ReflectionProbes3D & | reflectionProbes, |
| FunctionView< void(RenderPass &, const Camera3D &)> | drawReflection ) |
Render all reflection maps in a set of reflection probes.
| reflectionProbes | set of reflection probes to bake the reflection probes of. |
| drawReflection | function that records the draw commands for the surroundings of the reflection probes. Should draw an image from the given camera's perspective in HDR color without tonemapping onto the given render pass. The depth buffer of the drawn image is used to determine which pixels are part of the reflection probe's purview by comparing them to the maximum depth value. |
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Generate a cubemap from a 2D equirectangular map texture.
| internalFormat | internal format of the generated cubemap texture. Must be a color format. |
| resolution | width of each side of the generated cubemap texture. |
| equirectangularMap | 2D equirectangular map to generate the cubemap from. |
| samplerOptions | sampler options of the generated cubemap. |
| graphics::Error | if resource creation failed, or on failure to render the cubemap. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |