Что такое volumetric clouds в the forest
Originally created in 2009, this program first reads a text file containing initialization variables, then uses those variables to create a voxel grid data structure and uses ray marching to read lighting and density information from the grid in order to render fluffy clouds. The program was updated in 2010: the code was completely rewritten to improve efficiency, several new algorithms were implemented for voxel grid traversal, Perlin Noise was implemented to generate random clouds, and a GUI was created to make it more user-friendly (for the few users that actually stumble across it, that is).
- Generates volumetric clouds with ray marching on a voxel density grid
- Trilinear interpolation to produce more realistic results
- Random cloud generator using Perlin noise
- Can read in custom-made cloud configuration files or output current cloud as a new configuration file
- GUI that allows the user to move the camera and see rendering progress
- Optimized for faster speed
How are clouds rendered?
Previously, rendering clouds in real-time for games and cinematics have primarily been achieved through static materials applied to a sky dome mesh or a similar approach. Now, the volumetric cloud system uses a three-dimensional volume texture that is ray-marched to represent cloud layers in real-time. The material-driven approach provides the most flexibility for artists and designers to create clouds that can move across the sky, of any type, and can handle different times of day.
The sections that follow explore and break down the cloud system's elements that contribute to rendering them for real-time rendering.
Ray Marching the Cloud Volume
The participating media that makes up clouds require complex lighting simulations that either aren't possible, or are too expensive, for real time simulation on consumer-grade hardware. The Volumetric Cloud system employs ray- marching and approximation to simulate cloud rendering for scalable real-time performance across many supported platforms and devices. This makes it possible to support real time time-of-day simulations that support the multiple light scattering effect of lighting, shadowing from clouds and onto clouds, light contribution from the ground onto the bottom layer of clouds, and much more.
Light Multiple Scattering
Light rays that travel through a volume have the potential to scatter on particles within the volume before reaching your eye, or a camera sensor. This effect of light is called multiple scattering, and it is what defines the distinct appearance of clouds. In a cloud, the droplets that make up the cloud usually lead to an albedo that is close to a value of 1, meaning that light is almost never absorbed within the volume. Light that is not absorbed passes through the volume making the scattering effect very complex in the process. The multiple scattering effect of the participating media affects light travel through the cloud volume; it's what makes them look bright while also appearing very thick.
The complexity of multiple scattering in real-time rendering is solved by using an approximation of realistic scattering by tracing multiple octaves (or steps) of light transmittance in the volume material. The Volumetric Advanced Material Output expression enables you to set the number of octaves used along with the amount of multiple scattering contribution, occlusion, and eccentricity that happens.
The example below shows the difference between no octaves used (single scattering), one octave, and two octaves of multiple scattering approximation. High octaves apply additional scattering approximations to your cloud material but make the shader more expensive in the process.
For games projects, it is recommended to only use a single octave of light multiple scattering for performance considerations. However, you can use high Contribution and low Occlusion values on the Volumetric Advanced Material expression in your cloud material to similar effect without impact to performance. See the Volumetric Material section below.
Atmosphere Lights and Sky Light
Atmospheric lights contribute to rendering of the volumetric clouds in your scene with properties that define their lighting in static and dynamic time-of-day scenes.
Directional Light
The Volumetric Cloud component supports lighting from up to two Directional Light sources, such as a moon and sun, or two suns. The Directional Light provides lighting and shadowing for clouds and opaque objects onto clouds. It also enables you to specify the strength, extent, and resolution of the shadows of clouds in your scene.
Atmosphere and Cloud
Atmosphere Sun Light
Whether the Directional Light can interact with the atmosphere, clouds and generate a visual sun disk, all of which compose the visual sky.
Cast Shadows on Clouds
Whether the light should cast any shadows from opaque meshes onto clouds. This is disabled for any secondary Directional Lights that have Atmosphere Sun Light enabled and set to Atmosphere Sun Light Index of 1, such as another sun or as a moon light.
Cast Shadows on Atmosphere
Whether the light should cast any shadows from opaque meshes into the atmosphere when a SkyAtmosphere is used.
Cast Cloud Shadows
Whether the light should cast any shadows from the clouds onto the atmosphere and other scene elements.
Cloud Scattering Luminance Scale
Scales the light contribution when scattered in cloud participating media. This can help counter balance the fact that our current multiple scattering solution is only an approximation.
Per Pixel Atmosphere Transmittance
Whether to apply atmosphere transmittance per pixel on opaque meshes instead of using the light's global transmittance.
Cloud Shadow Strength
The strength of the shadow. Higher values will block more light.
Cloud Shadow on Atmosphere Strength
The strength of shadows on the atmosphere. When set to 0, shadows on the atmosphere is disabled.
Cloud Shadow on Surface Strength
The strength of shadows on opaque and transparent meshes. When set to 0, shadows on opaque and translucent surfaces is disabled.
Cloud Shadow Depth Bias
Controls the bias applied to the front shadow depth of the volumetric cloud shadow map.
Cloud Shadow Extent
The world space radius of the cloud shadow map around the camera. Measured in kilometers (km).
Cloud Shadow Map Resolution Scale
Scales the cloud shadow map resolution. The resolution is clamped by r.VolumetricCloud.ShadowMap.MaxResolution .
Cloud Shadow Ray Sample Count Scale
Scales the number of samples used for shadow map tracing. The sample count resolution is clamped with r.VolumetricCloud.ShadowMap.RaySampleMaxCount .
Sky Light
The Sky Light component provides soft ambient shadowing support that can be enabled and controlled with the following properties.
Atmosphere and Cloud
Cloud Ambient Occlusion
Whether the cloud should occlude sky contribution within the atmosphere (progressively fading out multiple scattering) or not.
Cloud Ambient Occlusion Strength
The strength of the ambient occlusion. Higher values will block more light.
Cloud Ambient Occlusion Extent
The world space radius of the cloud ambient occlusion map around the camera in kilometers (km).
Cloud Ambient Occlusion Map Resolution Scale
Scales the cloud ambient occlusion map resolution. The resolution is clamped by r.VolumetricCloud.ShadowMap.MaxResolution .
Cloud Ambient Occlusion Aperture Scale
Controls the cone aperture angle over which the sky occlusion due to volumetric clouds is evaluated. A value of 1 takes the entire hemisphere into account, resulting in blurry occlusion. A value of 0 takes a single direction of occlusion (vertical) into account, resulting in sharp occlusion.
Volumetric Clouds
Material Expressions
The following Material Expressions can be added to your Material Graph to define attributes of your volumetric clouds.
Volumetric Advanced Material Output Expression
The Volumetric Advanced Material Output expression provides control over a set of cloud parameters that affect the volume material applied to the Volumetric Cloud component when added to a material graph. It also provides additional cloud properties from the Material Editor Details panel when selected (see below).
Phase G
The parameter G input to the phase function describes how much forward (g < 0) or backward (g > 0) light scatters around. A valid range would be between -1.0 and 1.0. Defaults to 0 when no amount is specified. It is evaluated per sample if Per Sample Phase Evaluation is enabled.
Phase G2
The parameter G2 input to the second phase function describes how much forward (g < 0) or backward (g > 0) light scatters around. A valid range would be between -1.0 and 1.0. Defaults to 0 when no amount is specified. It is evaluated per sample if Per Sample Phase Evaluation is enabled.
Phase Blend
The linear interpolation (lerp) factor is used when blending the two phase functions parameterized by G and G2. A valid range is between 0.0 and 1.0. Defaults to 0 when no amount is specified. It is evaluated per sample if Per Sample Phase Evaluation is enabled.
Multi Scattering Contribution
Represents how much contribution each successive octave will add to the multiple-scattering. It is evaluated per pixel, and a valid range is between 0.0 and 1.0 from low to high contribution. Defaults to 0.5 contribution if no value is specified.
Multi Scattering Occlusion
Represents how much occlusion will be reduced for each successive octave. It is evaluated per pixel, and a valid range is between 0.0 and 1.0 from low to high occlusion. Defaults to 0.5 occlusion if no value is specified.
Multi Scattering Eccentricity
Represents how much the phase will become isotropic for each successive octave. It is evaluated per pixel, and a valid range is between 0.0 and 1.0 from anisotropic to isotropic. Defaults to 0.5 scattering eccentricity if no value is specified.
Conservative Density
Represents a three component float vector (Vector3). The X component must represent the participating medium conservative density. If the value is greater than 0, the material will be evaluated and will evaluate the next sample directly. This optimization is used to accelerate ray marching by skipping expensive material evaluation early on. The Y and Z components (of the Vector3) are used to pass extra data with the conservative density to the material evaluation step, which avoids computing it again.
For example, a simple top down 2D density texture would be enough to help by not evaluating the material in empty regions. The Y and Z components can contain parameters that can be recovered during the material evaluation using the Volumetric Advanced Material Input node. This attribute is evaluated per pixel.
When selected, the Material Editor Details provides additional properties that can be set for any cloud material using this material. It enables you to directly set Phase and Multi-Scattering values that aren't parameterized. You can control the number of octave approximations used to simulate the multiple scattering effect of light, apply contribution of ground lighting to the bottom of the cloud layer, and more.
Per Sample Phase Evaluation
Enable this option to force the phase function to be evaluated per sample, instead of once per pixel (globally). Per sample evaluation is slower.
Multi Scattering Approximation Octave Count
How many octaves to use for the multiple-scattering approximation. This increases the cost of the shader, so it's best to use a single octave. 0 means single scattering only.
Ground Contribution
Sample the shadowed lighting contribution from the ground onto the medium (single scattering). This adds some costs to the tracing when enabled.
Gray Scale Material
Sets this material to only be considered for gray scale, only using the R channel of the input parameters internally. The lighting will still be colored. This is an optimization.
Ray March Volume Shadow
Disable this to use the cloud shadow map instead of secondary ray marching. This is usually enough for clouds views from the ground and it should result in a performance boost. Shadows now have infinite length but also become less accurate and gray scale.
Volumetric Cloud Component
The following properties can be found on the Volumetric Cloud component through the Details panel when it is placed in a level. The properties found in this component enable you to define the physical attributes of the cloud placed in your Level, such as its distance from the surface of the planet, how tall the cloud volume is, the quality of the ray-marched clouds, and more.
Layer Bottom
The altitude at which the cloud layer should start, measured in kilometers (km) above the ground.
Layer Height
The altitude at which the cloud layer should end, measured in kilometers (km) above the ground.
Tracing Start Max Distance
The maximum distance of the volumetric surface before which we will accept to start tracing, measured in kilometers (km).
Tracing Max Distance
The maximum distance that will be traced inside the cloud layer, measured in kilometers (km).
Planet Radius
The planet radius used when there is not a Sky Atmosphere component present in the scene.
Ground Albedo
The ground albedo color used to light the cloud from below with respect to the sun light and the Sky Atmosphere. This is only used by the cloud material when the Volumetric Advanced Material Output node has Ground Contribution enabled in its Details panel. (See the Material Expressions section of this page.)
Material
The material assigned that describes the cloud volume. It must be a material that uses the Volume Material Domain.
Use Per Sample Atmospheric Light Transmittance
Whether to apply atmosphere transmittance per sample instead of using the light global transmittance.
Sky Light Cloud Bottom Occlusion
Occlusion amount applied to the Sky Light contribution at the bottom of the cloud layer. This is a fast approximation to sky lighting being occluded by clouds without having to trace rays or sample an ambient occlusion (AO) texture.
View Sample Count Scale
The scale of the view tracing sample count. The quality level scalability console variables affect the maximum range. The sample count resolution is clamped according to the scalability setting of r.VolumetricCloud.ViewRaySampleCountMax .
Reflection Sample Count Scale
The scale of the reflection tracing sample count. The quality level scalability console variables affect the maximum range. The sample count resolution is clamped according to the scalability setting of r.VolumetricCloud.ReflectionRaySampleMaxCount .
Shadow View Sample Count Scale
The scale of the shadow view tracing sample count. The quality level scalability console variables affect the maximum range. The sample count resolution is clamped according to the scalability setting of r.VolumetricCloud.Shadow.ViewRaySampleMaxCount .
Shadow Reflection Sample Count Scale
The scale of the shadow reflection view tracing sample count. The quality level scalability console variables affect the maximum range. The sample count resolution is clamped according to the scalability setting of r.VolumetricCloud.Shadow.ReflectionRaySampleMaxCount .
Shadow Tracing Distance
The shadow tracing distance measured in kilometers (km).
Volumetric Clouds Reference
An overview of real-time cloud rendering using the Volumetric Clouds component and volume materials.
The Volumetric Cloud component is a physically-based cloud rendering system that uses a material-driven approach to give artists and designers the freedom to create any type of clouds they need for their projects. The cloud system handles dynamic time-of-day setups that is complemented by the Sky Atmosphere and Sky Light using the real time capture mode. The system provides scalable, artist-defined clouds that can adapt to projects using ground views, flying, and ground to outer space transitions.
Что такое volumetric clouds в the forest
Volumetric Clouds in Unity
Use three different textures to render the volumetric clouds,
Perlin-Worley texture ( base cloud shape ) : 128^3 resolution
Worley noise texture ( detail base cloud shape ) : 32^3 resolution
Cloud density model
Weather system:
This little map represents the weather settings that drive the clouds over our section of world map. The Red is coverage, Green is precipitation and blue is cloud type.
Cloud type :
Based on weather system map , we could know the weatherData.b = cloud type
Height gradient:
height gradient change the noise signal over altitude.
If we were to describe the probability of change in density over height for a cloud we might use a remapping function.
Basic cloud shape:
We build a basic cloud shape by sampling our Perlin-Worley texture and multiplying it by our height signal and then multiply the result by the coverage.
Detail cloud shape:
Erode the base cloud shape by subtracting the Worley noise texture at the edges of the cloud. If you invert the Worley noise at the base of the clouds you get some nice whispy shapes.
Wind effect :
Cloud Lighting model
Ambient light:
Beer's Law :
Beer’s law states that we can determine the amount of light reaching a point based on the optical thickness of the medium that it travels through.
Henyey-Greenstein model :
In clouds, there is a higher probability of light scattering forward. This is called Anisotropic scattering. This model is used to reproduce Anisotropy in cloud lighting.
Each time we sample light energy, we multiply it by The Henyey-Greenstein phase function plus Beer's Law.
Light Energy = e^*HG
If you want to have a better volumetric clouds, You could add the powder sugar effect which produces the dark edges facing the light.
E = 1 - e^
Rendering sun light:
Rendering cloud:
By ray marching through spherical atmosphere we can ensure that clouds properly descend into the horizon.
Step1. Determine eye position under the clouds, within the clouds or above the clouds.
If you had some questions about" INTERSECTION OF A RAY WITH A SPHERE ", please refer to the references[3], p.388.
Step2. Calculate ray step length based on the distance from eye position to cloud.
A reference of properties available on different atmospheric components that are part of, or that affect, the Volumetric Cloud component.
This page includes reference information for the Volumetric Cloud, Material expressions, and Light component properties.
About
A Volume renderer that utilizes ray casting and ray marching through a 3D voxel grid to generate puffy clouds
Читайте также: