EnvironmentMap class base
A source of image-based lighting: diffuse irradiance plus prefiltered specular radiance, both derived from an equirectangular environment.
Diffuse is stored as 9 L2 spherical-harmonic RGB coefficients (cheap, no texture fetch, seam-free); specular is a GPU-prefiltered "PMREM" roughness-band atlas (see prefilterEquirectRadiance). Both are computed up front, so constructing an environment from images does GPU work and is best done once.
Construct one with EnvironmentMap.fromAssets / EnvironmentMap.fromUIImages (which compute the SH and prefilter the radiance for you), EnvironmentMap.studio (the built-in procedural default), EnvironmentMap.fromGpuTextures when you already hold a prefiltered atlas, or EnvironmentMap.empty for a no-op black environment.
Set one on a Scene via Scene.environment (it defaults to
EnvironmentMap.studio); an individual PhysicallyBasedMaterial can
override it via PhysicallyBasedMaterial.environment.
Constructors
- EnvironmentMap.empty()
-
A black environment that contributes no image-based lighting.
factory
-
EnvironmentMap.fromGpuTextures({required Texture prefilteredRadiance, List<
Vector3> ? diffuseSphericalHarmonics}) -
Wraps an already-built prefiltered-radiance atlas.
factory
Properties
-
diffuseSphericalHarmonics
→ List<
Vector3> -
The kDiffuseShCoefficientCount RGB L2 spherical-harmonic
coefficients describing the diffuse (Lambertian) irradiance.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- prefilteredRadianceTexture → Texture
-
The prefiltered-radiance atlas sampled for specular IBL.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
computeDiffuseSphericalHarmonics(
Image equirectangular) → Future< List< Vector3> > - Projects an equirectangular radiance image onto 9 L2 spherical- harmonic coefficients suitable for diffuse irradiance.
-
fromAssets(
{required String radianceImagePath, List< Vector3> ? diffuseSphericalHarmonics}) → Future<EnvironmentMap> - Loads an EnvironmentMap from an equirectangular sRGB radiance image in the asset bundle (see fromUIImages).
-
fromEquirectHdr(
{required Float32List linearPixels, required int width, required int height, List< Vector3> ? diffuseSphericalHarmonics}) → Future<EnvironmentMap> -
Builds an EnvironmentMap from a high-dynamic-range equirectangular
radiance map: linear (not sRGB) RGBA float pixels, row-major,
widthbyheight. -
fromUIImages(
{required Image radianceImage, List< Vector3> ? diffuseSphericalHarmonics}) → Future<EnvironmentMap> -
Builds an EnvironmentMap from an already-decoded equirectangular
dart:uiradiance image: uploads it, GPU-prefilters it for roughness-aware specular, and projects it onto diffuse SH. -
studio(
) → EnvironmentMap - Builds the package's built-in procedural "studio" environment.