Lighting class Lighting and environment
The lighting state handed to a Material when it binds for a draw.
Bundles the image-based-lighting EnvironmentMap (and the scene's
environmentIntensity multiplier) with the analytic lights and shadow
resources, so material code has everything it needs in one place.
Constructors
-
Lighting({required EnvironmentMap environmentMap, EnvironmentMap? environmentMapB, double environmentBlend = 0.0, double environmentIntensity = 1.0, Matrix3? environmentTransform, Texture? diffuseShTexture, DirectionalLight? directionalLight, Vector3? directionalLightDirection, Texture? punctualParamsTexture, Texture? punctualIndexTexture, int punctualParamsCount = 0, int punctualIndexWidth = 0, int punctualIndexHeight = 0, int spotShadowCount = 0, double spotShadowDepthBias = 0.0, double spotShadowNormalBias = 0.0, double spotShadowSoftness = 0.0, Texture? shadowMap, List<
ShadowCascade> cascades = const [], Texture? ssaoMap, double specularOcclusionMode = 0.0, double ssaoDirectLightAffect = 0.0, double ssaoMultiBounce = 0.0, bool ssaoBentNormals = false, bool ssaoContactShadows = false, bool ssaoIndirectLight = false, Size viewportSize = ui.Size.zero, Fog? fog, Texture? sceneDepthLinear, Texture? filteredSceneColor, int transmissionFilterBandCount = 0, Vector3? cameraPosition, Vector3? cameraForward, Vector3? cameraRight, Vector3? cameraUp, double tanHalfFovX = 0.0, double tanHalfFovY = 0.0, double time = 0.0})
Properties
- cameraForward → Vector3?
-
final
- cameraPosition → Vector3?
-
Camera world position and normalized basis directions for this view,
letting a material compute its fragment's planar view depth
(
dot(worldPos - cameraPosition, cameraForward)) to compare against sceneDepthLinear. Null when no material requests scene inputs.final - cameraRight → Vector3?
-
Normalized world-space right/up axes used to project refracted volume
exits back into the scene-color image.
final
- cameraUp → Vector3?
-
final
-
cascades
→ List<
ShadowCascade> -
The shadow cascades matching shadowMap, near-to-far, or empty
when there is no shadow map this frame.
final
- diffuseShTexture → Texture?
-
The diffuse-SH coefficient texture to bind for this draw. During an
environment cross-fade this is a 9x2 composite (row 0 primary, row 1
environmentMapB); otherwise null, and environmentMap's own 9x1
texture is bound.
final
- directionalLight → DirectionalLight?
-
The scene's directional light, or null when there isn't one.
final
- directionalLightDirection → Vector3?
-
The world-space travel direction of directionalLight, derived from
the light node's transform. Null when there is no directional light;
consumers fall back to DirectionalLight.direction in that case.
final
- environmentBlend → double
-
The factor blending environmentMap toward environmentMapB (
0uses only environmentMap,1only environmentMapB). Ignored when environmentMapB is null.final - environmentIntensity → double
-
Scalar multiplier applied to environmentMap's contribution
(the scene's
environmentIntensity).final - environmentMap → EnvironmentMap
-
The image-based-lighting environment in effect for this draw.
final
- environmentMapB → EnvironmentMap?
-
A secondary environment cross-faded with environmentMap by
environmentBlend, or null when a single environment is in effect.
final
- environmentTransform → Matrix3
-
Rotation applied to the image-based-lighting environment (the
scene's
environmentTransform). Identity leaves it unrotated.final - filteredSceneColor ↔ Texture?
-
Compact roughness-filtered atlas of opaqueSceneColor. Null unless the
current material requests RenderInput.filteredSceneColor.
getter/setter pair
- fog → Fog?
-
The scene's distance fog, or null when fog is off for this frame. Applied
per-fragment by every material in linear HDR before tone mapping.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- opaqueSceneColor ↔ Texture?
-
Accumulated scene color behind materials that declare
RenderInput.opaqueSceneColor(refraction). Null when unrequested.getter/setter pair - punctualIndexHeight → int
-
final
- punctualIndexTexture → Texture?
-
The per-frame light-index texture: each item's
[lightListOffset, +lightListCount)slice indexes into punctualParamsTexture. Null when no item is reached by any light.final - punctualIndexWidth → int
-
Dimensions of punctualIndexTexture, for the shader's fetch-coordinate
normalization.
final
- punctualParamsCount → int
-
Number of light rows in punctualParamsTexture. Zero leaves punctual
lighting off (only directionalLight and the ambient term contribute).
final
- punctualParamsTexture → Texture?
-
The per-frame parameters texture holding every additional analytic light
(point and spot lights, plus any directional lights past the first
shadowed one), one per RGBA32F row, or null when there are none. Built by
PunctualLightBufferand shared across every lit draw this frame; a draw reads only the rows its per-object index slice selects.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sceneDepthLinear → Texture?
-
The opaque geometry's linear (planar view-space) depth texture for
materials that declare
RenderInput.depthinMaterial.sceneInputs(depth-fade, absorption, shoreline foam), or null when no visible material asked for it. Same texture the SSAO/SSR passes consume.final - shadowMap → Texture?
-
The cascaded shadow map atlas (a depth-in-
.rtexture holding the cascade tiles as a horizontal strip) for directionalLight, or null when shadows are off for this frame. Sampled with cascades.final - specularOcclusionMode → double
-
How indirect specular is occluded:
0leaves it on the diffuse occlusion factor,1derives a dedicated specular occlusion. MirrorsSpecularAmbientOcclusionMode.index.final - spotShadowCount → int
-
Number of shadow-casting spots this frame; their tiles follow the
directional cascades in shadowMap and their matrices ride in
punctualParamsTexture. Zero disables spot shadow sampling.
final
- spotShadowDepthBias → double
-
Shared spot-shadow sampling parameters.
final
- spotShadowNormalBias → double
-
final
- spotShadowSoftness → double
-
final
- ssaoBentNormals → bool
-
Whether ssaoMap's gba channels carry a packed view-space bent normal.
final
- ssaoContactShadows → bool
-
Whether ssaoMap's g channel carries the sun contact-shadow term.
final
- ssaoDirectLightAffect → double
-
Fraction of screen-space occlusion applied to analytic direct lights.
final
- ssaoIndirectLight → bool
-
Whether ssaoMap carries gathered indirect radiance in rgb with the
visibility in a (instead of visibility in r).
final
- ssaoMap → Texture?
-
The screen-space ambient-occlusion texture for this frame (occlusion
factor in
.r), or null when occlusion is off. When set, it modulates indirect lighting in the shader.final - ssaoMultiBounce → double
-
How much occluded indirect diffuse converges toward the surface albedo
instead of black (the multi-bounce approximation).
final
- tanHalfFovX → double
-
Tangents of the half field of view (x and y), letting a material
project world positions to screen UV (screen-space marches). Zero
for non-perspective cameras; materials treat that as unavailable.
final
- tanHalfFovY → double
-
final
- time → double
-
Seconds since the scene started rendering, for engine-driven material
animation (the same clock custom post passes receive).
final
- transmissionFilterBandCount ↔ int
-
Number of valid roughness bands in filteredSceneColor.
getter/setter pair
- viewportSize → Size
-
The color-pass render-target size, used to map
gl_FragCoordinto the occlusion texture's UV. Zero when occlusion is off.final
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