GradientSkySource class Lighting and environment

A stylized gradient sky: zenith, horizon, and ground colors with an HDR sun disk.

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; mutate them freely (the visible sky updates immediately, the lighting per the binding's refresh policy).

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

Inheritance

Constructors

GradientSkySource({Vector3? zenithColor, Vector3? horizonColor, Vector3? groundColor, Vector3? sunDirection, Vector3? sunColor, double sunSharpness = 400.0})

Properties

fragmentShader Shader
The full-screen sky fragment shader, typically loaded from a .shaderbundle.
getter/setter pairinherited
groundColor ↔ Vector3
The color below the horizon.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
horizonColor ↔ Vector3
The sky color at the horizon.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sunColor ↔ Vector3
The sun disk color, in linear HDR (values above 1.0 read as a bright sun through the tone mapper and light the scene strongly when baked).
getter/setter pair
sunDirection ↔ Vector3
Direction toward the sun (world space; normalized when used).
getter/setter pair
sunSharpness double
Sharpness exponent of the sun disk; higher is tighter.
getter/setter pair
textureNames Iterable<String>
All currently-bound sampler names, in insertion order.
no setterinherited
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
zenithColor ↔ Vector3
The sky color straight up.
getter/setter pair

Methods

bind(RenderPass pass, HostBuffer 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
toString() String
A string representation of this object.
inherited

Operators

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