PhysicalSkyMaterial
A material that defines a sky for a Sky
resource by a set of physical properties.
class PhysicalSkyMaterial
The PhysicalSkyMaterial
uses the Preetham analytic daylight model to draw a sky based on physical properties. This results in a substantially more realistic sky than the ProceduralSkyMaterial
, but it is slightly slower and less flexible.
The PhysicalSkyMaterial
only supports one sun. The color, energy, and direction of the sun are taken from the first DirectionalLight3D
in the scene tree.
As it is based on a daylight model, the sky fades to black as the sunset ends. If you want a full day/night cycle, you will have to add a night sky by converting this to a ShaderMaterial
and adding a night sky directly into the resulting shader.
Superclasses
class Material
Virtual base class for applying visual properties to an object, such as color and roughness.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var energyMultiplier: Double
The sky’s overall brightness multiplier. Higher values result in a brighter sky.
var groundColor: Color
Modulates the
Color
on the bottom half of the sky to represent the ground.var mieCoefficient: Double
Controls the strength of Mie scattering for the sky. Mie scattering results from light colliding with larger particles (like water). On earth, Mie scattering results in a whitish color around the sun and horizon.
var mieColor: Color
Controls the
Color
of the Mie scattering effect. While not physically accurate, this allows for the creation of alien-looking planets.var mieEccentricity: Double
Controls the direction of the Mie scattering. A value of
1
means that when light hits a particle it’s passing through straight forward. A value of-1
means that all light is scatter backwards.var nightSky: Texture2D?
Texture2D
for the night sky. This is added to the sky, so if it is bright enough, it may be visible during the day.var rayleighCoefficient: Double
Controls the strength of the Rayleigh scattering. Rayleigh scattering results from light colliding with small particles. It is responsible for the blue color of the sky.
var rayleighColor: Color
Controls the
Color
of the Rayleigh scattering. While not physically accurate, this allows for the creation of alien-looking planets. For example, setting this to a redColor
results in a Mars-looking atmosphere with a corresponding blue sunset.var sunDiskScale: Double
Sets the size of the sun disk. Default value is based on Sol’s perceived size from Earth.
var turbidity: Double
Sets the thickness of the atmosphere. High turbidity creates a foggy-looking atmosphere, while a low turbidity results in a clearer atmosphere.
var useDebanding: Bool
If
true
, enables debanding. Debanding adds a small amount of noise which helps reduce banding that appears from the smooth changes in color in the sky.