Within CRYENGINE Sandbox exist 3 types of solutions to display cloud objects in your environment.
Each solution has a specific benefit and drawback, balancing performance vs. visual quality.
- Cloud Render Entity (3D, simple shading)
- Volume Object Render Entity (3D, best shading)
- Distance Cloud Object (2D)
Cloud Render Entity (3D, Simple Shading)
Drag a Cloud entity into the level from Entity -> Render -> Cloud
It is recommended to place it at above 1000 meters (Z value = 1000).
Make sure that the Cloud entity is selected, so that its properties are displayed in the RollupBar, then click <No Custom Material> material button.
This opens the Material Editor, where you can select the the desired Cloud Material. Make sure that the Common.Cloud Shader is selected in the Material Settings.
Since CryENGINE 3.5, this step is done automatically as the Sandbox Editor will read and apply the default material (
materials/clouds/baseclouds.mtl) defined in the default cloud XML:
Scale it by selecting the Scale tool from the Toolbar, making sure to select all three axes.
In order to enable cloud movement, set the AutoMove property to True and set a fade distance to 100 to make them fade in when they reach the edge of the box in which they are moving.
Then, you need to define how big the box (SpaceLoopBox) in which they are moving from one end to the other, should be. 2000 is the default value for all three axes.
Finally, you need to set the speed at which they will move. For normal clouds, you can use 5, and for storm clouds, about 15. Experiment a bit, but remember that if you want to select a cloud, it's wise to turn off AutoMove; otherwise, in can be difficult to select the cloud.
Cloud Creation Tool
The Cloud Creation tool allows the creation of cloud definition files (placed in
Libs/Clouds/*.xml) that can be later placed using the Entity Render/Cloud. This tool should be used for creating the definition files only.
Once the definition files have been exported, the actual cloud instances should be placed using the Cloud Entity.
Using the Cloud Creation Tool it is easy to setup a combination of sprites that look like clouds. The tool can be found under the Clouds Menu in the main toolbar.
In order to create a Cloud template we need a reference entity to use for some basic data, such as position. The Area Box object is a good reference object to use as we can adjust the size of the box to define the limits of our cloud. We can now create a new cloud template.
We need to assign a material to you cloud in order for it to be generated. So as with the normal cloud object we should assign one of the commom.cloud shader materials to the object.
There are a few properties in the Cloud tool that allow us to tweak the size and look of our cloud. Play around with the settings till you're happy with the cloud that you've created. With the Preview Cloud property set to true, press the Generate Clouds Button to view your cloud.
|Merge Static Geometry|
|Number of Rows||Number of sprite rows in the texture. (Leave at 4 when using default cumulus_01.dds)|
|Number of Columns||Number of sprite columns in the texture. (Leave at 4 when using default cumulus_01.dds)|
|Sprites Row||Chooses a row in the cloud texture for rendering.|
|Number of Sprites||Set number of sprites to be generated in the cloud.|
|Size of Sprites||Set the scale of the sprites in the cloud.|
|Size Variation||Defines the randomization in size of the sprites within the cloud.|
|Angle Variations||Defines limits of randomization in the rotation of the sprites within the cloud.|
|Minimal Distance between Sprites||Defines minimum distance between the generated sprites within the cloud.|
|Every Box has Sprites|
|Show Particles like Spheres||Additional sphere rendering for each sprite generated.|
|Preview Cloud||Render the generated cloud.|
|Auto Update||Update the cloud rendering automatically with each parameter change.|
Cloud Texture Layout
A cloud texture is split up into columns and rows. When using the default cloud material, the texture cumulus_01.dds (below) is assigned. This texture has 4 rows (0,1,2,4).
To create the cloud .xml file you simply need to Export the cloud settings to an .xml file. Pressing the export button will bring up a Save As dialog window. Here you can navigate to the
Game\Libs\Clouds folder and save the file in there.
Now if you create a new cloud entity you should be able to set your new template as the Cloud File for your cloud entity.
If we are happy with our clouds we should now delete our previous cloud object that was used to create our cloud definition file.
Volume Object Render Entity (3D, best shading)
To place a cloud with nice shading, drag a Volume entity to the level from Entity -> Render -> VolumeObject.
With the VolumeObjectFile set to
Libs/Clouds/Default.xml, select a cloud material in the Material Editor. Make sure that the Shader is set to VolumeObject. The Cloud can now be scaled as needed.
Example of a VolumeObject with a cloud material and VolumeObject shader applied.
The difference between the normal 3D cloud and a VolumeObject is that volume object clouds have correct self shadowing. Do not place too many volume object clouds because they greatly affect performance.
If you assign a new material, ensure that it has the correct shader applied. For volume clouds, you have to assign the VolumeObject shader.
Distance Cloud Object (2D)
Distance Clouds are basically horizontal planes placed into the sky. Unlike other types of clouds they cannot be flown through and thus they're mostly suitable for filling the sky in at far distances (horizon) or high altitudes.
However, this limitation also allows for more advanced shading at a cheap performance cost (simple single pass shader, no impostors needed).
The Distance Cloud Tool allows you to place planes in the sky that look like clouds if the right texture is assigned. They are great for creating a realistic distant sky setup for your level without causing huge render slowdown issues.
Drag the DistanceCloud object to the level from the Misc -> DistanceCloud menu.
Scale it with the Scale tool to about 100, then assign one of the Distancecloud materials (all materials with Distanceclouds shader in
\materials\clouds folder can be used).
Note that since CryENGINE 3.5, this step is no longer required as they are scaled 100x on creation.
Distance clouds are 2D so they should be placed far away or above so that the player does not see that they are flat:
Clouds don't cast real-time shadows but there can be a (moveable) texture used that is cast on the entire level, creating the illusion that clouds cast shadows.
There are 3 variables that need to set in order to enable this type of cloud shadows.
- In the Environment tab in the rollup bar there's the cloud shadow texture variable. Here you need to assign a texture for the cloud shadows.
You can use
\textures\clouds\cloud_pattern.ddsor create your own by adjusting it in Photoshop by painting it white in the areas where you don't want to have shadows.
- Also in the environment tab is the ExtendLastShadowLODMinSpec variable. This represents the minimum spec that the cloud shadows will be enabled on. 0 = off, 1 = low, 2 = medium and 3 = high.
- And finally you need to set the console variable e_GsmCastFromTerrain to 1.
Step 2 is not required in CRYENGINE 3.5 and beyond.
With all of these set you should be able to see the shadows on the terrain.
You can also set the Cloud Shadow Speed to 0.001 for fast moving clouds and 0.0005 for normal clouds.