Class SkyMaterial
Hierarchy (View Summary)
- WebXRSpatialLayerType
- SkyMaterial
Constructors
constructor
-
Instantiates a new sky material. This material allows to create dynamic and texture free effects for skyboxes by taking care of the atmosphere state.
Parameters
- name: string
Define the name of the material in the scene
Optionalscene: anyDefine the scene the material belong to
- forceGLSL: boolean = false
Use the GLSL code generation for the shader (even on WebGPU). Default is false
Returns SkyMaterial
- name: string
Properties
azimuth
Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between an object direction and a reference direction.
camera Offset
Defines an offset vector used to get a horizon offset.
cloudiness
Cloud cover over the sun in [0, 1] (0 = clear direct sun, default; 1 = sun fully hidden). This softens only the sun disc — the sky dome color itself is unchanged (there is no overcast graying or whitening of the sky). At 0 the sun is a sharp solar disc; above 0 a physically- based single-scattering cloud model attenuates the direct beam (Beer–Lambert) and redistributes the removed energy into a dual-lobe Henyey–Greenstein aureole, energy-conserving as it broadens (thin cloud → tight silver lining; heavy cloud → broad, directionless glow). See the sun-disc branch in sky.fragment for the model + references.
distance
Defines the distance of the sun according to the active scene camera.
dithering
Defines if sky should be dithered.
inclination
Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said "inclined".
luminance
Defines the overall luminance of sky in interval ]0, 1[.
mie Coefficient
Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.
mie Directional G
Defines the amount of haze particles following the Mie scattering theory.
raw Hdr Output
When enabled, the material emits scene-referred linear HDR: luminance acts as a plain linear
gain (no filmic tonemap), the output is clamped to the bound render target's max representable
value rather than [0, 1] (so a bright sun cannot overflow to +Inf), and no sRGB encode is
applied. Enable this to bake the sky into an HDR (float / half-float) render target — e.g. an
IBL environment cube — where the full dynamic range of the sun disc must be preserved. The
clamp ceiling follows whatever target is bound at draw time (65504 for half-float, effectively
unbounded for float); if the sky is drawn to an LDR target or the default framebuffer it falls
back to [0, 1], so this flag is only meaningful when rendering into a float/half-float target.
When disabled, the material produces tonemapped, display-referred output for direct viewing.
rayleigh
Defines the sky appearance (light intensity).
sun Position
Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then the property is overridden by the inclination and the azimuth and can be read at any moment.
turbidity
Defines the amount (scattering) of haze as opposed to molecules in atmosphere.
up
Defines the vector the skyMaterial should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())
use Sun Position
Defines if the sun position should be computed (inclination and azimuth) according to the given .sunPosition property.
Methods
bind For Sub Mesh
-
Binds the submesh to this material by preparing the effect and shader to draw
Parameters
- world: Matrix
defines the world transformation matrix
- mesh: Mesh
defines the mesh containing the submesh
- subMesh: SubMesh
defines the submesh to bind the material to
Returns void
- world: Matrix
clone
-
Makes a duplicate of the material, and gives it a new name
Parameters
- name: string
defines the new name for the duplicated material
Returns SkyMaterial
the cloned material
- name: string
dispose
-
Disposes the material
Parameters
OptionalforceDisposeEffect: booleanspecifies if effects should be forcefully disposed
Returns void
get Alpha Test Texture
-
Get the texture used for alpha test purpose.
Returns Nullable<BaseTexture>
null as the sky material has no texture.
get Animatables
-
Get the list of animatables in the material.
Returns IAnimatable[]
the list of animatables object used in the material
get Class Name
-
Gets the current class name of the material e.g. "SkyMaterial" Mainly use in serialization.
Returns string
the class name
is Ready For Sub Mesh
-
Get if the submesh is ready to be used and all its information available. Child classes can use it to update shaders
Parameters
- mesh: AbstractMesh
defines the mesh to check
- subMesh: SubMesh
defines which submesh to check
Returns boolean
a boolean indicating that the submesh is ready or not
- mesh: AbstractMesh
need Alpha Blending
-
Specifies if the material will require alpha blending
Returns boolean
a boolean specifying if alpha blending is needed
need Alpha Testing
-
Specifies if this material should be rendered in alpha test mode
Returns boolean
false as the sky material doesn't need alpha testing.
serialize
-
Serializes this material in a JSON representation
Returns any
the serialized material object
StaticParse
-
Creates a sky material from parsed material data
Parameters
- source: any
defines the JSON representation of the material
- scene: Scene
defines the hosting scene
- rootUrl: string
defines the root URL to use to load textures and relative dependencies
Returns SkyMaterial
a new sky material
- source: any
This is the sky material which allows to create dynamic and texture free effects for skyboxes.
See
https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat