Making it rain in your level

Rain can be an essential part of your level. There are some advanced rain techniques available to you within the CryENGINE that will allow you to enable object interaction with the rain and localized wet areas. This recipe will change a map to a rainy scene.

There are two distinct techniques to achieve rain in the CryENGINE. The following example will explore both the particle-only technique and the deferred rain entity.

Getting ready

You should have the forest level Forest.cry open in the Editor.

How to do it...

We will begin by using the particle-only technique to create our first rain:

  1. Drag-and-drop the ParticleEffect entity into your level from the Particle tab of the DataBase View. The particles are named as follows:

    rain.rain.space_loop = (libName).(subfolderName).(effectName)

  2. The settings for how the rain.rain.space_loop functions, can be adjusted via its property settings on the Particle tab of the DataBase View.
  3. Adjust the Countscale of the Particle effect to 4 (be aware that this value multiplies with the count value of the particle).
  4. Next, set the size to 0.5 for a smaller and more realistic rain drop.
  5. Next, let's limit this effect to a certain area of our level.
  6. First, make a shape and use the pick tool of the shape in the RollupBar to select the spaceloop particle system we just created.
  7. This will cause the particle effect attribute active to be activated and deactivated if the player crosses the border of the shape.

    Note

    You may have to set active to false to have the particle disabled when you enter the game initially.

The next effect we will use is the PostEffect Rain that is new to CryENGINE 3. This is a rain effect entity that will apply a post effect within its radius. These entities are placed just like normal entities:

  1. Remove the particle effect we created earlier to disable the particle only rain.
  2. Drag the Rain entity from Entity | Environment in the RollupBar.
  3. You can adjust the amount. A good heavy rain setting is 3.
  4. Now, change the color to a dark blue or grey. If left white, it can be mistaken for snow quite easily.
  5. Finally, adjust the puddles amount to 5 and the fresnel to 4; this will give a dramatic yet realistic looking wet effect.

This type of entity is best suited for large, out-of-door types of settings.

How it works...

The Post Effect entity renders on all objects and players in its radius. The underside of objects will remain dry, and objects can be adjusted in real time to show how the rain runs down slanted surfaces.

The advantage of the this entity over the simple space loop particle effect or using the wet layer on objects is that all objects within the radius of the entity are affected and can be changed or dynamically modified in real time. Objects can even be half in and half outside of the light's radius. Crytek developed a genius solution in CryENGINE 3 where areas underneath objects that would be obstructed by "real" rain are indeed occluded of the wet effect. The full screen rain effect will automatically disable if objects are seen in screen space to be above the player that would occlude the rain.

There's more...

You may have noticed some other Atmospheric entities available to you. The following explains some of the ones that pertain directly to a stormy or rainy environment.

Lightning entity

Add the Lightning entity to your level from the Entity/Environment section. This will enhance the rain and storm effect by adding a procedural particle and light effect, which can be adjusted to suit most situations.

Apply the sounds | environment:fantasy:distant_thunder_oneshot to hear a thunder sound after every lighting effect. Then edit the delay to simulate the distance to the effect.

Wind

The global wind speed can be adjusted by entering the numbers (values in meter/second) into the Environment settings wind vector field (positive y values determine fast wind to the north, negative y to the south, positive x to the east, and negative x to the west).

This can be important as all plants and entities that have wind bending properties will react to this and can be used to simulate strong storms.

Fog volumes

The Fog entity is used to overwrite the fog effect in specific areas. In the indoor areas, a subtle fog effect can be added to simulate a dusty area. To use, create an Area Box and attach the Area Box to the Fog entity. When in game mode, you can walk into the area and see how the fog gets different inside. Outside the game mode, the fog is not visible.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.125