PhysicalSkySource class Lighting and environment

A physically based daylight sky: an analytic single-scattering atmosphere (Rayleigh and Mie terms) with an HDR sun disk, producing plausible day, sunset, and twilight skies from a sun direction.

A built-in ShaderSkySource, so it works everywhere a custom sky does: assign it to Scene.skybox for the visible background and to Scene.skyEnvironment (or bake with EnvironmentMap.fromSky) to light the scene from it. Fields are plain properties read every frame; animate sunDirection for a day-night cycle (the visible sky updates immediately, the lighting per the binding's refresh policy). The model is closed-form (no ray march), so the per-frame background draw stays cheap.

Like every Geometry and Material constructor, construct only after Scene.initializeStaticResources completes.

Inheritance
Implemented types

Constructors

PhysicalSkySource({Vector3? sunDirection, double sunAngularRadius = 0.0175, double rayleighCoefficient = 2.0, Vector3? rayleighColor, double mieCoefficient = 0.005, double mieEccentricity = 0.8, Vector3? mieColor, double turbidity = 10.0, Vector3? groundColor, double energy = 1.0})

Properties

energy double
Overall intensity multiplier.
getter/setter pair
fragmentShader Shader
The full-screen sky fragment shader, typically loaded from a .shaderbundle. When the source was constructed by name, the shader is resolved from the base library on first access and then cached.
getter/setter pairinherited
groundColor ↔ Vector3
The color below the horizon.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
mieCoefficient double
Strength of aerosol (Mie) scattering, the haze around the sun.
getter/setter pair
mieColor ↔ Vector3
Wavelength tint of the Mie term.
getter/setter pair
mieEccentricity double
Forward-scattering eccentricity of the Mie term (0 = uniform, approaching 1 = tightly forward around the sun).
getter/setter pair
radianceCubeFragmentShader Shader?
The variant of fragmentShader built with FLUTTER_SCENE_RADIANCE_CUBE, used when the active environment's radiance is a cubemap.
getter/setter pairinherited
rayleighCoefficient double
Strength of molecular (Rayleigh) scattering, the blue of the sky.
getter/setter pair
rayleighColor ↔ Vector3
Wavelength tint of the Rayleigh term.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampledEnvironment EnvironmentMap?
The environment a useEnvironment shader samples, overriding the scene's.
getter/setter pairinherited
sunAngularRadius double
Angular radius of the sun disk, in radians. The physical sun is about 0.0047; the larger default reads better at typical field of views.
getter/setter pair
sunDirection ↔ Vector3
Direction toward the sun (world space; normalized when used).
getter/setter pairoverride-getter
sunLightColor → Vector3
Linear-RGB color the sun contributes as a directional light. Combined with sunLightIntensity.
no setteroverride
sunLightIntensity double
Scalar intensity for the derived directional light.
no setteroverride
textureNames Iterable<String>
All currently-bound sampler names, in insertion order.
no setterinherited
turbidity double
Aerosol density. Higher values read hazier.
getter/setter pair
uniformBlockNames Iterable<String>
All currently-bound uniform block names, in insertion order.
no setterinherited
useEnvironment bool
Whether the engine binds the active environment's IBL textures (prefiltered_radiance, brdf_lut) when the shader declares them.
getter/setter pairinherited

Methods

bind(RenderPass pass, TransientWriter transientsBuffer, EnvironmentMap environment) → void
Binds the fragment's uniform blocks, textures, and (when useEnvironment) the environment IBL samplers. Called by the engine during the background draw; not part of the app-facing API.
override
getTexture(String name) Texture?
Reads back a previously-set texture binding, or null when none is set.
inherited
getUniformBlock(String name) ByteData?
Reads back a previously-set uniform block, or null when none is set.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setTexture(String name, Texture? texture, {SamplerOptions? sampler}) → void
Assigns a texture to a sampler uniform by name. Pass null to clear it.
inherited
setUniformBlock(String name, ByteData? bytes) → void
Assigns the byte contents of a uniform block by name. bytes must match the block's std140 layout; pass null to clear the binding.
inherited
setUniformBlockFromFloats(String name, List<double> floats) → void
Convenience wrapper around setUniformBlock that packs a list of floats. The caller is still responsible for std140 padding.
inherited
shaderForEnvironment(EnvironmentMap environment) Shader
The shader to draw with against environment, picking the variant whose radiance sampler matches the layout of the environment actually sampled (sampledEnvironment when set). The encoder builds the pipeline from this, and bind fills that pipeline's slots, so both must agree.
inherited
toString() String
A string representation of this object.
inherited
usesRadianceCubeVariant(EnvironmentMap environment) bool
Whether shaderForEnvironment picks the cube variant, which is also what decides the radiance texture bound to it. False without a cube variant, so a sky built with only the 2D entry is never handed a cubemap.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited