ProceduralSky

Inherits: Sky < Resource < Reference < Object

Type of Sky that is generated procedurally based on user input parameters.

Description

ProceduralSky provides a way to create an effective background quickly by defining procedural parameters for the sun, the sky and the ground. The sky and ground are very similar, they are defined by a color at the horizon, another color, and finally an easing curve to interpolate between these two colors. Similarly, the sun is described by a position in the sky, a color, and an easing curve. However, the sun also defines a minimum and maximum angle, these two values define at what distance the easing curve begins and ends from the sun, and thus end up defining the size of the sun in the sky.

The ProceduralSky is updated on the CPU after the parameters change. It is stored in a texture and then displayed as a background in the scene. This makes it relatively unsuitable for real-time updates during gameplay. However, with a small enough texture size, it can still be updated relatively frequently, as it is updated on a background thread when multi-threading is available.

Properties

Colorground_bottom_colorColor( 0.156863, 0.184314, 0.211765, 1 )
floatground_curve0.02
floatground_energy1.0
Colorground_horizon_colorColor( 0.423529, 0.396078, 0.372549, 1 )
floatsky_curve0.09
floatsky_energy1.0
Colorsky_horizon_colorColor( 0.839216, 0.917647, 0.980392, 1 )
Colorsky_top_colorColor( 0.647059, 0.839216, 0.945098, 1 )
floatsun_angle_max100.0
floatsun_angle_min1.0
Colorsun_colorColor( 1, 1, 1, 1 )
floatsun_curve0.05
floatsun_energy1.0
floatsun_latitude35.0
floatsun_longitude0.0
TextureSizetexture_size2

Enumerations

enum TextureSize:

  • TEXTURE_SIZE_256 = 0 —- Sky texture will be 256x128.
  • TEXTURE_SIZE_512 = 1 —- Sky texture will be 512x256.
  • TEXTURE_SIZE_1024 = 2 —- Sky texture will be 1024x512. This is the default size.
  • TEXTURE_SIZE_2048 = 3 —- Sky texture will be 2048x1024.
  • TEXTURE_SIZE_4096 = 4 —- Sky texture will be 4096x2048.
  • TEXTURE_SIZE_MAX = 5 —- Represents the size of the TextureSize enum.

Property Descriptions

  • Color ground_bottom_color
DefaultColor( 0.156863, 0.184314, 0.211765, 1 )
Setterset_ground_bottom_color(value)
Getterget_ground_bottom_color()

Color of the ground at the bottom.


Default0.02
Setterset_ground_curve(value)
Getterget_ground_curve()

How quickly the ground_horizon_color fades into the ground_bottom_color.


Default1.0
Setterset_ground_energy(value)
Getterget_ground_energy()

Amount of energy contribution from the ground.


  • Color ground_horizon_color
DefaultColor( 0.423529, 0.396078, 0.372549, 1 )
Setterset_ground_horizon_color(value)
Getterget_ground_horizon_color()

Color of the ground at the horizon.


Default0.09
Setterset_sky_curve(value)
Getterget_sky_curve()

How quickly the sky_horizon_color fades into the sky_top_color.


Default1.0
Setterset_sky_energy(value)
Getterget_sky_energy()

Amount of energy contribution from the sky.


DefaultColor( 0.839216, 0.917647, 0.980392, 1 )
Setterset_sky_horizon_color(value)
Getterget_sky_horizon_color()

Color of the sky at the horizon.


DefaultColor( 0.647059, 0.839216, 0.945098, 1 )
Setterset_sky_top_color(value)
Getterget_sky_top_color()

Color of the sky at the top.


Default100.0
Setterset_sun_angle_max(value)
Getterget_sun_angle_max()

Distance from center of sun where it fades out completely.


Default1.0
Setterset_sun_angle_min(value)
Getterget_sun_angle_min()

Distance from sun where it goes from solid to starting to fade.


DefaultColor( 1, 1, 1, 1 )
Setterset_sun_color(value)
Getterget_sun_color()

The sun’s color.


Default0.05
Setterset_sun_curve(value)
Getterget_sun_curve()

How quickly the sun fades away between sun_angle_min and sun_angle_max.


Default1.0
Setterset_sun_energy(value)
Getterget_sun_energy()

Amount of energy contribution from the sun.


Default35.0
Setterset_sun_latitude(value)
Getterget_sun_latitude()

The sun’s height using polar coordinates.


Default0.0
Setterset_sun_longitude(value)
Getterget_sun_longitude()

The direction of the sun using polar coordinates.


Default2
Setterset_texture_size(value)
Getterget_texture_size()

Size of Texture that the ProceduralSky will generate. The size is set using TextureSize.