Difference between revisions of "Weather effects"

From Oldunreal-Wiki
Jump to navigation Jump to search
 
Line 32: Line 32:
*'''WeatherType'' Default EWF_Rain:  how are the particles moving, what type of behaviour is it trying to mimic: ''EWF_Rain'' will rain the particles down, and the particles will be perpendicular to the direction of the WeatherEmitter. ''EWF_Snow'', once its speed is properly scaled down (say 30-50), sends particles slowly tumbling down with a slight swinging movement. ''EWF_Dust'' spawns particles with regular initial speed, but particles slow down until they reach total stilness. ''EWF_Neighter'' rains particles down much like EWF_Rain, but particles will always be facing the camera, not oriented accordingly to their velocity.
*'''WeatherType'' Default EWF_Rain:  how are the particles moving, what type of behaviour is it trying to mimic: ''EWF_Rain'' will rain the particles down, and the particles will be perpendicular to the direction of the WeatherEmitter. ''EWF_Snow'', once its speed is properly scaled down (say 30-50), sends particles slowly tumbling down with a slight swinging movement. ''EWF_Dust'' spawns particles with regular initial speed, but particles slow down until they reach total stilness. ''EWF_Neighter'' rains particles down much like EWF_Rain, but particles will always be facing the camera, not oriented accordingly to their velocity.


Note that no good texture for this effect does exist in stock Unreal packages. However, Rain textures can be as simples as a small white dash on a black background, which will give good result when made translucent and spawned to a nice speed (see DmRiot at the beginning of the page). Snow and Dust textures might be harder to create from scratch however.
[[Category:Mapping]]
[[Category:Mapping]]

Revision as of 22:50, 12 September 2011

A WeatherEmitter used to spawn rain in a realistic fashion (map DmRiot).

Weather effects such as rain, snow, falls of dust, hail and so on, can be added to a map in a map, using the newly introduced WeatherEmitter added by Unreal 227. This actor, a subclass of XParticleEmitter, is specifically designed to spawn falling sprites. It holds significant advantages over Particle Emitters regarding weather conditions, such as not spawning a huge amount of sprites over the entire affected zone, but only in a limited radius around the player to mimic weather without being too much of a strain on the engine.

Theory and uses

The Weather Emitter is the placeable subclass of XWeatherEmitter, itself a subclass of XParticleEmitter. This is a directional actor: when added to the map, its rotation is shown by a red arrow and is very important to determine many things. For a Weather Emitter, the direction of the arrow is the direction into which weather effects "fall". Though usually, it will be directed to the ground, more or less inclined (to imitate, for example, falling rain, it is possible to have rain "falling" from the ground to the sky if you need such an effect.

A reguler Particle Emitter is assigned a radius or a box - by the mapper - in which particles are spawned. The Lifetime of the particles spawned are used to determine how far they travel before being destroyed. This is an intuitive way of doing things, but its drawback when having large-scale effects is that a great number of particles will have to be spawned to cover a large area. Even modern computers may be brought to their knees given a sufficiently lush emitter covering huge tracts of land. For rain, snow or such effects, which may cover entire maps and always be visible somewhere, this is simply not an option, as the number of particles would be so high playing the game would be like watching grandma's slideshow - if the engine does not simply give up on trying to crash.

The WeatherEmitter, on the other hand, tackles this issue in an efficient way: instead of spawning particles all over the map, a weather emitter is assigned a volume or an entire zone. When a player enters the zone, particles are spawned only around him to give him the illusion that rain is actually falling. Picture players running around, each one surrounded by his own cube of falling particles visible only to him : because all players see rain falling around, they believe the whole map is covered in it. In fact, only a few hundreds of particles are spawned around him. When sufficiently far away from the zone or volume in which rain is spawned, the player will see nothing; when running towards the rainy zone, he will see rain slowly appearing in the distance and becoming more and more dense, more and more opaque, exactly as one would when getting closer and closer to a window.

The WeatherEmitter

The WeatherEmitter actor. Notice the directional red arrow when selected.

When added to the map, the WeatherEmitter is displayed as a small cloud with rain drops falling out from it. The first step to create realistic weather conditions is to rotate it so that it is oritented towars where the rain, snow or whatever you want to spawn, is falling. If you activate RealTime Preview, you may notice that it already spawns the traidtional pawn actor texture. Now let's see what we can make of this bad boy.

Properties

All the properties of the WeatherEmitter are in the XWeatherEmitter tab of its properties. All proprety names are quite self-explanatory, and a quick look at the XWeatherEmitter code can give you hints if need some help. The WeatherEmitter is very easy to use and can pretty much be used with its default properties when provided with a rain texture.

Sprites are spawned by the WeatherEmitter in a cube around the player.
  • AppearArea: Default: all 0; This property lets you define a volume with Min and Maw coordinates on all axis. The defined box will be the volume in which it is raining. A player standing outside of the volume will be able to see rain falling inside the volume. As explained above, there will not be a constant stream of particles spawned all over the box; particles will be created in the parts of a cube around the player which are inside the volume or zone in which the rain is spawned. See the illustration. For this parameter to be active, AppearAreaType must be set to EWA_Box.
  • ApearAreaType: Default EWA_Zone; Decides the spawning of particles either in the entire zone where the WeatherEmitter is located (determined by portals and zoneinfos) with EWA_Zone, or in a determined volume specified in AppearArea.
  • FadeOutDistance: Default 0- 650; Rain is spawned in a cubic volume around the player. The particles spawned very close to the player are almost totally opaque; the particles at the limit of the volume are almost totally translucent. Between these two extremes, particles are more or less opaque depending on the distance between them and the player. These Min and Max settings decide the distance at which the particles start to become translucent (min) and are totally invisible (max).
  • LifeTime: Default, 0.4 - 0.7 : the lifetime of a single particle in seconds.
  • ParticleCount: Default, 250; how many particles are spawned.
  • ParticleColor: Default: all 0; Colours of the particles: X is Red, Y is Green and Z is Blue. You set mins and maxs to all in order to have several colours or several variations of one colour.
  • PartStyle: Default STY_Translucent: Style of particles. Like most sprites, it should mostly remain on Translucent, but Masked may be useful.
  • PartTextures: The texture used on sprites. You can add up to 8 different textures to spawn multiple different sprites.
  • Position: Default: X: -50;200, Y -200;200, Z -50;400: this is the series of parameters that determines the size of the cube around a player (see illustration).
  • Size: Default 0.15-0.2; The size of particles, 1 being the full size of the texture.
  • 'Speed: Default 300-500; The speed of particles. The default values are good for rain. You might want to slow it down dramatically for snow or dust.
  • WallHitEvent and WaterHitEvent: Default, HIT_DoNothing; behaviour of the particles when hitting solid surfaces or water. HIT_DoNothing does nothing : the particle goes through the object. HIT_Destroy kills the particle on impact. HIT_Bounce will make particle bounce... Which can be very fun when the WeatherEmitter is strongly inclined. Otherwise, the fact that particle keep the same speed while bouncing makes it useless to simulate raindrops bouncing in the floor or such effects. HIT_Script calls a scripted event you may have created.
  • 'WeatherType Default EWF_Rain: how are the particles moving, what type of behaviour is it trying to mimic: EWF_Rain will rain the particles down, and the particles will be perpendicular to the direction of the WeatherEmitter. EWF_Snow, once its speed is properly scaled down (say 30-50), sends particles slowly tumbling down with a slight swinging movement. EWF_Dust spawns particles with regular initial speed, but particles slow down until they reach total stilness. EWF_Neighter rains particles down much like EWF_Rain, but particles will always be facing the camera, not oriented accordingly to their velocity.

Note that no good texture for this effect does exist in stock Unreal packages. However, Rain textures can be as simples as a small white dash on a black background, which will give good result when made translucent and spawned to a nice speed (see DmRiot at the beginning of the page). Snow and Dust textures might be harder to create from scratch however.