shown in other instead.
Whatever fantastic and phantasmagorical landscapes are visualised, or whatever sublunary panoramas are scrupulously recreated, the vast expanse of the sky is always spread above. As the outdoor environment expands with performance increase, the sky contribution to the visual aesthetics deepens, because, on average, it occupies half of the rendered image. In indoor scenes the sky also redounds to the more immersive feeling, by peeping out from the windows or openings and restoring the frame of the virtual world. To put it short, the sky creates the atmosphere in the very literal sense.
Of course, sky can be represented as a blank blue background, but this is definitely not the best solution to create convincing sky and atmospheric phenomena of clouds. Unigine presents the dynamic sky with the following three components for accurate simulation:
Sky Sphere with Clouds Texture
The sky itself is represented by the sky dome, which means, it is modeled as an upper hemisphere, tiled with a texture to produce plausible and inexpensive dynamic clouds. To avoid the visual artifact of apparent curvature cased by applying the texture, sphere is recommended to be flattened a bit. With flexible clouds patterns transformations, it is possible to tailor the clouds shape and shift speed to the artist's needs: the cloud cover is easily varied from the extensively overcast to the almost clear sky with only a few isolated clouds. This adjustment can be done on the Materials tab (for more detailed information see sky_base material).
However, there is more to the clouds than the flat-face texture, that is insufficient if the camera is free to roam in the sky. With volumetric rendering technology clouds acquire the proper degree of realism and deliver the experience of three-dimensional interaction. The generated volumes reconstruct cumulonimbus clouds with a high physical fidelity.
Cumulonimbus clouds are usually heavy, puffy, heaped and dark, reaching high into the atmosphere. They represent a combination of all the cloud types and are frequently accompanied by thunderstorms. The cumulonimbus, boiling low above horizon and crowned with thick veils, is one of the most visually stunning cloud phenomena.
To visualize the clouds the slice-based volume rendering technique is used. The idea consists in the following:
- The volume data is stored in the memory as a 3D texture in the RG8 format, so it can be easily loaded to the texture memory of the GPU.
- At rendering time, 3D texture of the volume data is mapped inside the volume bounding box, and then the slices of planes called proxy geometry are computed, which are clipped against the bounding box and oriented perpendicular to the viewing direction.
- Since the view-aligned proxy geometry slices are not typically aligned to the texture's slices, GPU samples the texture using bilinear interpolation to gain the pixel color values, and renders each slice as a textured polygon. The planes are drawn in back-to-front order and the result is blended into the frame buffer.
Rendering view-aligned proxy geometry by sampling 3D texture
- To reduce the number of redrawing operations, transparent surfaces can be rendered into a smaller buffer ("Up sample" checkbox on the Common tab of Materials settings). Please note, that with this option chosen, proper geometry interaction should be ensured by checking the "Volumetric interaction" box on the States tab of Materials settings.
The clouds self-shadowing is computed by means of ray tracing that samples the cloud volume density (stored in voxels). When the tracing is performed, the brightness of the ray traversing through the volume diminishes with each voxel, until finally all the voxels, further positioned on the path of that ray, are rendered shadowed.
Rendering volumetric clouds is quite a computationally expensive task: to alleviate the load, clouds are completely computed within six frames, at the time using the image from the previous update. While the six-frame iteration allows to effectively avoid lagging. it does not have any detrimental visual effect.
Clouds Formation Parameters
In Unigine the volumetric clouds are procedurally generated on the base of physically-correct algorithm that considers atmospheric fluid dynamics. It characterizes the clouds' silhouettes and assures the natural and visually convincing clouds with minimal effort of the designer.
In the general outline, the physical processes of cloud formation is as follows. During the cycle of convection, the air at the ground level that contain water vapour is heated and begins to rise into regions of both lower pressure and temperature. Clouds are formed when the humid air is cooled below a critical temperature increasing the relative humidity: the water then condenses on small suspended particles and forms droplets in the atmosphere. This phenomenon is known as phase transition.
For realistic modeling this formation mechanisms, the cloud volume space is subdivided into lattice of cells, that correspond to the voxels. Basing on the specified density mask data, each of the cells is assigned three modulation parameters:
- Cloud defines if this cell is a cloud.
- Humidity level defines whether there is enough vapour in the cell to form a cloud.
- Phase transition defines whether a phase transition from vapour to water (cloud) is ready to occur.
The parameters are stored as logical variables determining if the condition is true or false (1 or 0 state). At each time step this factors introduce simple transition rules applied to the lattice and defining the cloud formation:
- The cell should have positive humidity level (1).
- If its neighboring cells are ready for phase transition, the cell in question also changes phase transition value for 1.
- After that, the cell becomes a cloud (while both humidity level and the phase transition become 0).
As described above, the result obtained by the binary distribution is a harsh one, because at each voxel it strictly defines presence or absence of the cloud. Therefore, before the going to the next step of rendering, the density at each point is calculated by smoothing the value.
|Extinction Probability Factor||To influence the formation processes, probability factors are brought into play. The artist can freely tweak them, not interfering with physical accuracy and attaining exactly the desired cloud cover.
Extinction of the clouds is an important issue for modelling a logically complete cloud life cycle. It is done the following way:
|Humidity Probability Factor||Similar to the extinction factor, humidity probability factor changes the cell humidity level to 1 if the generated random number is less than the specified humidity probability. It results in the following:
|Phase Transition Probability Factor||Phase transition probability acts the same way as extinction and humidity probability factors: phase transition state of the cell changes to 1 if the generated random number is less than the specified phase transition probability. Tweaking will produce the following:
As a base for procedural generation of the natural-looking clouds the density mask is used. It represents a layered texture, each layer of which reproduces a decreasing amount of cloud cover, so that their smooth and gradual interpolation will provide a persuasive cloud shaping with the emulated conditions.
The mask can either be a RGB8 or 3D texture that can contain layers with different cloud formation parameters. Channels of the mask set the following:
- Red channel sets humidity level. The higher the channel value, the more clouds will be generated.
- Green channel sets the readiness of phase transition to form the cloud from vapor. The higher the channel value, the more probable it is that clouds will be generated in this point.
- Blue channel sets extinction probability for clouds. The higher the channel value, the less clouds will be rendered in this point leaving the sky clear.
|Layer||This parameter allows to choose the exact layer of the density mask to form the clouds, depending on the desired visual effect. The number of available layers depends on the mask.
It is also possible to select not only one layer, but to morph layers into each other with the time by setting Z-shift for clouds Velocity.
The pilgrim clouds rarely stand still, they can calmly hover up in the sky or scud with the air blasts. Velocity parameter brings dynamics to the rendered image imitating wind in the clouds:
- The first two slots define the shift of the density image along the X- and Y-coordinates correspondingly, and provide the horizontal clouds drift. The intensity of the latter depends on the specified velocity value. It should be noted, that only the current layer of the density image is shifted.
- The third slot controlling the Z-coordinate results in the successive shifting of all the density image layers. The clouds will subtly segue into another layer form.
Compared to the simple texture shifting (available via the Materials settings), velocity Z-shift also modifies the shape of the clouds and grants their more natural and diverse distribution under the wind.
Clouds greatly vary in structure and composition. With the size option defining the clouds length along three axes, the clouds can grow to towering mass or contract to delicate, wispy and feathery looking.
The size is set along X, Y and Z axes, respectively.
|Min slices||Minimum slices parameter allows to optimize rendering of clouds. It limits the number of cloud slices rendered when the camera is within the clouds bounding box. When looking from inside of clouds, only the nearest slices are actually seen (depending on the density of clouds), while limiting the number of slices allows to reduce the rendering time and increase the performance. By default, the minimum number of slices is equal to 256.
The minimum number of slices will gradually increase up to the maximum number as the player moves away from the clouds.
|Max slices||Maximum slices parameter sets the number of cloud slices rendered when the camera is outside the clouds bounding box. It allows to limit the number of rendering slices when the player is looking at the clouds from beneath of from above. By default, the maximum number of slices is equal to 512.|
The simulation option allows to simulate volumetric clouds in the background, when a volume surface is disabled or no material is assigned to it. When the weather is controlled by Tracker, clouds are enabled and rendered much faster, since all required calculations are already done.
Shadows from Clouds
To gain visual integrity of the rendered scene, the clouds should naturally dim the sun light. Enabling this surface allows them to cast dynamic shadows on the underlying ground, that match the sky dome clouds pattern. Mapping the same texture secures the shadows of varying intensity and precise placement.
The intensity of the cast shadows can be regulated by the shadow Multiplier parameter.