Cloud Renderer¶
-
class CloudRenderer¶
Class for real-time volumetric cloud rendering.
There should exist a “trueSKY space”, where the origin(0,0,0 Cartesian) is at global mean sea level, and an arbitrary point on the Earth’s surface. The Z axis points up, the X and Y axes are arbitrary (for reasons described below). To avoid singularities, this point, and the orientation of its axes should be represented by a double-precision quaternion, which represents the rotation from (say) latitude and longitude zero with X pointing East and Y pointing North.
The Volume Window is a deformed cuboid, its upper and lower surfaces matching the Earth’s curvature. On the GPU, it is a 3D texture.
This trueSKY space moves in steps equivalent to one horizontal texel. The function CloudRenderer::MoveCloudWindowCentreTexel(x,y) does this. This should be done when the chosen viewpoint (this is up to you) moves more than a texel in any horizontal direction. This way, we need only update the edges as the window moves.
Public Functions
-
CloudRenderingOptions &GetCloudRenderingOptions()¶
Get a pointer to the current cloud rendering options.
-
void SetCloudRenderingOptions(const CloudRenderingOptions &c)¶
Set new cloud rendering options.
-
CloudRenderingOptions &GetCloudRenderingOptions()¶
-
struct CloudRenderingOptions¶
These values control the rendering of clouds.
The table below includes the variables which can have the greatest effect in regards to visual fidelity, which will usually cause an increase in performance.
Performance Impact of Cloud Rendering Variables
MaximumCubemapResolution
Very High
HighDetailMultiplier
Very High
HighDetailRangeKm
Very High
WindowScaleKm
Very High
RaytraceMode
Very High
MaxCloudDistanceKm
Very High
lightingMode
High
RenderGridX + Y
High
DefaultAmortization
High
EdgeNoiseTextureSize
High
WindowGrid
High
Public Functions
-
CloudRenderingOptions()¶
-
void WriteSettings(platform::core::Settings &settings)¶
-
void ReadSettings(platform::core::Settings &settings)¶
-
void SaveToFile(const std::string &fn)¶
-
void LoadFromFile(const std::string &fn)¶
-
void SaveToText(platform::crossplatform::TextOutput &ofs)¶
-
void LoadFromText(platform::crossplatform::TextInput &input)¶
Public Members
-
int MaximumCubemapResolution¶
Resolution to draw full-detail cloud buffer. Value should be a power of 2, typically 1/4 of screen width.
-
float CrepuscularRayStrength¶
Strength of crepuscular rays(godrays)
-
uint3 GodraysGrid¶
Grid size for the crepuscular(godrays) grid.
-
int MaxPrecipitationParticles¶
Maximum number of particles to render for precipitation.
-
float PrecipitationRadiusMetres¶
Radius over which to draw precipitation particles.
-
float RainFallSpeedMS¶
Speed of raindrops in m/s.
-
float RainDropSizeMm¶
Size of raindrops in mm.
-
float SnowFallSpeedMS¶
Speed of snowflakes in m/s.
-
float SnowFlakeSizeMm¶
Size of snowflakes in mm.
-
float PrecipitationWindEffect¶
Strength of wind effect on rain/snow.
-
float PrecipitationWaver¶
Strength of waver/sway of precipitation. Less noticeable for rain.
-
float PrecipitationWaverTimescaleS¶
Timescale in seconds of waver of precipitation.
-
float PrecipitationThresholdKm¶
Thickness of cloud required in to produce precipitation in Km.
-
bool AutomaticRainbowPosition¶
Whether the rainbow follows the antisolar/antilunar point, or is manually set.
-
float RainbowElevation¶
If the automatic positioning is disabled, this sets the elevation of the rainbow.
-
float RainbowAzimuth¶
If the automatic positioning is disabled, this sets the azimuth of the rainbow.
-
float RainbowIntensity¶
Controls the overall brightness of the rainbow.
-
float RainbowDepthPoint¶
The point at which the rainbow intersects the terrain.
-
bool AllowOccludedRainbow¶
Whether trueSKY should generate rainbows regardless of light occlusion.
-
bool AllowLunarRainbow¶
Whether trueSKY should generate rainbows using the moon’s light.
-
float EdgeNoisePersistence¶
Persistence of edge noise texture.
-
int EdgeNoiseFrequency¶
Frequency of edge noise texture.
-
int EdgeNoiseTextureSize¶
Size of edge noise texture.
-
float EdgeNoiseWavelengthKm¶
Wavelength of edge noise effect.
-
int WorleyTextureSize¶
Size of the 3D cell-noise texture used to generate clouds. Larger values use more GPU memory.
-
float CellNoiseWavelengthKm¶
Wavelength of cell noise effect.
-
float MaxFractalAmplitudeKm¶
Strength of edge noise effect.
-
float MaxCloudDistanceKm¶
Maximum distance to render clouds. Maximum value should be half of WindowScaleKm.
-
float RenderGridXKm¶
Minimum grid width for raytracing. Only in STANDARD_RENDERING RenderingMode.
-
float RenderGridZKm¶
Minimum grid height for raytracing. Only in STANDARD_RENDERING RenderingMode.
-
RenderingMode RaytraceMode¶
Method that the renderer will use to raytrace these clouds. Default option is DISTANCE_FIELD_STEP.
-
LightingMode lightingMode¶
Method that the renderer will use for clouds lighting. Default is STANDARD_LIGHTING
-
int DefaultNumSlices¶
Deprecated from 4.3 onwards. The number of raytracing steps to take when rendering clouds, larger values are slower to render.
-
int DefaultAmortization¶
If the cost of rendering is spread over frames. For 1, all pixels are drawn every frame, for amortization 2, it’s 2x2, etc.
-
int AtmosphericsAmortization¶
Same as DefaultAmortization but for atmospheric effects.
-
vec3 WindSpeedMS¶
Global wind speed in metres per second. Affects the movement and churn of the clouds.
-
bool RealTimeWind¶
Determines if Wind should use game time or real time for calculations.
-
float CloudThresholdDistanceKm¶
A heuristic distance to discard near depths from depth interpolation, improving accuracy of upscaling.
-
float CloudDepthTemporalAlpha¶
The alpha for temporal blending of the solid depth buffer into the buffer used for cloud rendering. If 1.0, update is instant.
-
float DirectLight¶
The amount of direct light to be used for rendering.
-
float IndirectLight¶
The amount of indirect or secondary light to be used for rendering.
-
float AmbientLight¶
The amount of ambient light to be used for rendering.
-
float Extinction¶
The amount of light scattered per metre - larger values produce darker clouds, default 0.05.
-
float MieAsymmetry¶
Mie scattering eccentricity.
-
float MinimumStarPixelSize¶
Smallest pixel width to use drawing stars.
-
float StarBrightness¶
Brightness multiplier for stars.
-
float CosmicBackgroundBrightness¶
Brightness multiplier for cosmic background.
-
int MaximumStarMagnitude¶
Largest magnitude of star to draw. Larger magnitudes are dimmer.
-
float VirgaNearThresholdKm¶
Minimum distance from the camera to draw virga (rain streaks)
-
vec3 CloudTint¶
Colour tint for all clouds. Only in VARIABLE_STEP_GRID.
-
vec2 WindowScaleKm¶
Scale of the cloud window in Km.
-
int2 WindowGrid¶
Size of the cloud window grid (number of steps) TODO: Does this need to be here? Or just have it in CloudWindow.
-
int2 PrecipitationGridDivisor¶
Divisor for the precipitation grid.
-
uint HighDetailMultiplier¶
Multiplier for grid density. Only in VARIABLE_STEP_GRID.
-
float HighDetailRangeKm¶
Range at which to apply increased grid steps. Only in VARIABLE_STEP_GRID.
-
float CloudShadowConstant¶
-
float CloudShadowMultiplier¶
-
float CloudShadowStrength¶
Strength of cloud shadow from 0-1.
-
VolumeUpdateMode volumeUpdateMode¶
-
bool IntegerPseudorandomNoise¶
-
bool DoCloudRaytraceLighting¶
-
int RaysPerVoxel¶
-
int MaxRayRecursionDepth¶
-
float NearCloudExtinctionPerKm = 4.0f¶
-
int2 SignedDistanceFieldDivisor¶
Divisor for the Signed Distance Field.
-
float SignedDistanceFieldIntersectLimitKm = 3.0f¶
The greatest distance in km from a cloud that is considered to be an intersect in the raytrace.
-
float BlendRate = 0.8f¶
-
uint64_t checksum = 0¶
Public Static Functions
-
static uint64_t GetEnum(const char *txt_utf8)¶
-
CloudRenderingOptions()¶
-
class GlobalView : public platform::core::BaseMouseHandler¶
An onscreen editor for the CloudWindow. This handles mouse behaviour, but is renderer-independent: it is passed as a pointer to the cloud window editor render funcion.