Keyframes Layers trueSKY Actor

Select your engine:

class CloudRenderer

Include: Clouds/BaseWeatherRenderer.h

Functions

  CloudRenderer(simul::clouds::Environment e, simul::base::MemoryInterface mem)
  ~CloudRenderer()
void EnsureEffectsAreBuilt(simul::crossplatform::RenderPlatform renderPlatform)
simul::clouds::BaseGpuCloudGenerator * GetBaseGpuCloudGenerator()
simul::clouds::CloudGeometryHelper * GetCloudGeometryHelper(int view_id)
simul::clouds::CloudRenderingOptions & GetCloudRenderingOptions()
float const * GetCloudScales()
char const * GetDebugText()
LineQueryResult GetLineQuery(int id, vec3 pos1_km, vec3 pos2_km)
int GetMaxSlices(int viewport_id)
VolumeQueryResult GetPointQuery(int id, vec3 pos_km)
VolumeQueryResult GetPointQuery(int id)
int GetQueryIdForViewId(int view_id)
simul::crossplatform::Texture * GetRandomTexture3D()
float GetSunOcclusion(simul::crossplatform::DeviceContext deviceContext, simul::math::Vector3 cam_pos)
void InvalidateDeviceObjects()
bool IsCameraAboveCloudBase(simul::math::Vector3 cam_pos)
void MakeCloudShadowTexture()
void PreRenderUpdate(simul::crossplatform::DeviceContext deviceContext, float real_time)
void RecompileShaders()
bool Render(simul::crossplatform::DeviceContext deviceContext, float exposure, simul::clouds::TrueSkyRenderMode renderMode, simul::crossplatform::NearFarPass nearFarPass, simul::crossplatform::Texture depth_tex, simul::sky::ScatteringVolume scatteringVolume, bool write_alpha, vec4 viewportTextureRegionXYWH, simul::crossplatform::AmortizationStruct amortizationStruct, simul::clouds::TwoResFramebuffer fb, simul::sky::LocalFadeTextures localFadeTextures, simul::crossplatform::Texture ambientCubemap)
void RenderCloudGrid(simul::crossplatform::DeviceContext deviceContext, simul::clouds::CloudKeyframer ck)
void RenderCloudShadowTexture(simul::crossplatform::DeviceContext deviceContext)
void RenderCloudVolumes(simul::crossplatform::DeviceContext deviceContext, simul::clouds::CloudKeyframer ck)
void RenderCrossSections(simul::crossplatform::DeviceContext context)
void RenderQueries(simul::crossplatform::DeviceContext deviceContext)
void RestoreDeviceObjects(simul::crossplatform::RenderPlatform renderPlatform)
void SetEnableStorms(bool s)
void SetEnvironment(simul::clouds::Environment e)
void SetExternalCloudTexture(simul::crossplatform::Texture)
void SetLightingQueryResult(LightingQueryResult _lightingQueryResult)
void SetMaxFadeAltitudeKm(float ma_km)
void SetMaxFadeDistanceKm(float dist_km)
void SetMaxSlices(int viewport_id, int maxs)
void SetNoiseTextureProperties(int size, int freq, int octaves, float persistence)
void SetPointLight(int id, vec3 pos, float min_radius, float max_radius, vec3 irradiance)

Functions

CloudRenderer(simul::clouds::Environment e, simul::base::MemoryInterface mem)

Constructor: An external keyframer is provided, and an optional memory manager.

~CloudRenderer()

Destructor

void EnsureEffectsAreBuilt(simul::crossplatform::RenderPlatform renderPlatform)

If possible, build all shader effect variations.

simul::clouds::BaseGpuCloudGenerator * GetBaseGpuCloudGenerator()

Get a pointer to the Cloud Generator

simul::clouds::CloudGeometryHelper * GetCloudGeometryHelper(int view_id)

Returns a new geometry helper.

simul::clouds::CloudRenderingOptions & GetCloudRenderingOptions()

Get a pointer to the current cloud rendering options

float const * GetCloudScales()

Get the xyz scales of the clouds in metres.

char const * GetDebugText()

Get some per-frame text information for debugging - usually timing data.

LineQueryResult GetLineQuery(int id, vec3 pos1_km, vec3 pos2_km)

Set, or create a cloud query. This returns the previous results of the same query.

int GetMaxSlices(int viewport_id)

Cloud rendering detail is determined by the number of slices. See SetMaxSlices.

VolumeQueryResult GetPointQuery(int id, vec3 pos_km)

Set, or create a cloud query. This returns the previous results of the same query.

VolumeQueryResult GetPointQuery(int id)

Get results of a cloud query.

int GetQueryIdForViewId(int view_id)

Get the query id for the specified view. If Render() has been called for the view, the query should have a valid set of results for the last frame rendered.

simul::crossplatform::Texture * GetRandomTexture3D()

Get the random 3D texture.

float GetSunOcclusion(simul::crossplatform::DeviceContext deviceContext, simul::math::Vector3 cam_pos)

Get a value for how much the sun is blocked from the clouds.

void InvalidateDeviceObjects()

Call this Platform-dependent function when the 3D device has been lost.

bool IsCameraAboveCloudBase(simul::math::Vector3 cam_pos)

Return true if the camera is above the cloudbase altitude.

void MakeCloudShadowTexture()

Get an API-dependent identifier for the cloud’s 2D shadow.

void PreRenderUpdate(simul::crossplatform::DeviceContext deviceContext, float real_time)

Once per-frame update. Do this before any rendering each frame. Called by BaseWeatherRenderer.

void RecompileShaders()

Platform-dependent function to reload the shaders - only use this for debug purposes.

bool Render(simul::crossplatform::DeviceContext deviceContext, float exposure, simul::clouds::TrueSkyRenderMode renderMode, simul::crossplatform::NearFarPass nearFarPass, simul::crossplatform::Texture depth_tex, simul::sky::ScatteringVolume scatteringVolume, bool write_alpha, vec4 viewportTextureRegionXYWH, simul::crossplatform::AmortizationStruct amortizationStruct, simul::clouds::TwoResFramebuffer fb, simul::sky::LocalFadeTextures localFadeTextures, simul::crossplatform::Texture ambientCubemap)

Platform-dependent render function.

void RenderCloudGrid(simul::crossplatform::DeviceContext deviceContext, simul::clouds::CloudKeyframer ck)

Render the cloud grid for debugging purposes

void RenderCloudShadowTexture(simul::crossplatform::DeviceContext deviceContext)

The cloud shadow texture: Centred on the viewer Aligned to the sun. Output is km in front of or behind the view pos where shadow starts

void RenderCloudVolumes(simul::crossplatform::DeviceContext deviceContext, simul::clouds::CloudKeyframer ck)

Render the cloud volumes for debugging purposes

void RenderCrossSections(simul::crossplatform::DeviceContext context)

Show the cloud volumes onscreen by cross section.

void RenderQueries(simul::crossplatform::DeviceContext deviceContext)

Draw the queries in 3D

void RestoreDeviceObjects(simul::crossplatform::RenderPlatform renderPlatform)

Platform-dependent function to generate device objects for the renderer.

void SetEnableStorms(bool s)

Where supported, enable lightning generation.

void SetEnvironment(simul::clouds::Environment e)

Set the sky interface.

void SetExternalCloudTexture(simul::crossplatform::Texture)

Where we create the main volume texture for rendering elsewhere, we pass it in here. This permits ESRAM on XboxOne for example, in a game engine.

void SetLightingQueryResult(LightingQueryResult _lightingQueryResult)

Show the cloud volume window on the lat-long sphere.

void SetMaxFadeAltitudeKm(float ma_km)

Altitude for fade texture lookups:

void SetMaxFadeDistanceKm(float dist_km)

Distance for fade texture lookups:

void SetMaxSlices(int viewport_id, int maxs)

Cloud rendering detail is determined by the number of slices. If not set the value from the CloudKeyframer will be used (GetDefaultNumSlices), but each viewport id can have a separate setting.

void SetNoiseTextureProperties(int size, int freq, int octaves, float persistence)

Adjust the noise texture

void SetPointLight(int id, vec3 pos, float min_radius, float max_radius, vec3 irradiance)

Place a point light source.

Fields

ShouldRenderCloudShadowTexture 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::MoveCloudWindow(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.

last_interpolation_checksum A checksum to see if the interpolated cloud volume is out of date. This may fail every frame if time is moving continuously - that’s ok.