Module bevy_pbr::environment_map
source · Expand description
Environment maps and reflection probes.
An environment map consists of a pair of diffuse and specular cubemaps that together reflect the static surrounding area of a region in space. When available, the PBR shader uses these to apply diffuse light and calculate specular reflections.
Environment maps come in two flavors, depending on what other components the entities they’re attached to have:
-
If attached to a view, they represent the objects located a very far distance from the view, in a similar manner to a skybox. Essentially, these view environment maps represent a higher-quality replacement for
crate::AmbientLight
for outdoor scenes. The indirect light from such environment maps are added to every point of the scene, including interior enclosed areas. -
If attached to a
LightProbe
, environment maps represent the immediate surroundings of a specific location in the scene. These types of environment maps are known as reflection probes.ReflectionProbeBundle
is available as a mechanism to conveniently add these to a scene.
Typically, environment maps are static (i.e. “baked”, calculated ahead of time) and so only reflect fixed static geometry. The environment maps must be pre-filtered into a pair of cubemaps, one for the diffuse component and one for the specular component, according to the split-sum approximation. To pre-filter your environment map, you can use the glTF IBL Sampler or its artist-friendly UI. The diffuse map uses the Lambertian distribution, while the specular map uses the GGX distribution.
The Khronos Group has several pre-filtered environment maps available for you to use.
Currently, reflection probes (i.e. environment maps attached to light
probes) use binding arrays (also known as bindless textures) and
consequently aren’t supported on WebGL2 or WebGPU. Reflection probes are
also unsupported if GLSL is in use, due to naga
limitations. Environment
maps attached to views are, however, supported on all platforms.
Structs
- Like
EnvironmentMapLight
, but contains asset IDs instead of handles. - A pair of cubemap textures that represent the surroundings of a specific area in space.
- Information about the environment map attached to the view, if any. This is a global environment map that lights everything visible in the view, as opposed to a light probe which affects only a specific area.
- A bundle that contains everything needed to make an entity a reflection probe.
Constants
- A handle to the environment map helper shader.