Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

Rain

  • Last UpdatedFeb 21, 2024
  • 4 minute read

Use the Rain node to create a rain effect.

  • The characteristics of rain can be modified at run time.

  • There can be just one snow node per project.

For more information, see Rain Particles Renderer.

Platform support

This node is supported on XR-Windows platform only.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

No support

No support

No support

No support

Full support

No support

No support

No support

No support

Code example

This is a code example for the Rain node.

<Rain name="3DRain" enabled="false" wind="0 0 0" heightmapPosition="-249 35 -173" heightmapSize="1400 80 1400" textureSize="2048" />

Heightmap or Drain

Rain should not typically pass through solid objects.

The Rain node supports two options to determine where rain stops falling:

  • Height map

  • Drain

    Height map

At load time, the system generates a heightmap image by positioning a special camera at the top of the scene.

The heightmap box (heightmapCenter, heightmapSize) defines the area to be included in the heightmap texture calculation.

For each pixel of the map, it is defined at which height the rain should disappear.

The precision of this approach relies on several factors.

Parameter

Description

textureSize

Larger maps are more precise because each pixel covers a smaller area.

textureFormat

Increasing pixel format increases precision.

Drain

The Drain approach is simpler and involves setting an absolute height at which rain drops disappear.

You can use this method in landscapes where there are no high structures.

Rain fields

These are the fields for Rain node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > Rain

Fields

Type

Use

Default value

Description

emitterPosition

svec3

Optional

0 0 0

The emitter position. This is used when followRenderCamera is false.

enabled

sbool

Optional

true

Enables/disables the rain effect.

followRenderCamera

sbool

Optional

true

When enabled, the emitter position moves each frame to match the camera that is being used for rendering.

forcesMultiplier

sfloat

Optional

1

Scales all the forces in the simulation.
Can be used while tweaking forces.
Resets the simulation.

frameZeroAutoPopulate

sbool

Optional

true

Populates the simulation with random particles on the first simulation frame. Otherwise the particles start from a simulated position. But the screen may be empty until the particles fall down.
Resets the simulation.

frameZeroYRange

sfloat

Optional

10

The Y range where the particles spawn if frameZeroAutoPopulate is true.
It is relative to the emitter position. Resets the simulation.

gravity

svec3

Optional

0 -9.8 0

Gravity (or main force).

heightmapPosition

svec3

Optional

0 0 0

Defines the center of the area handled by heightmap.

heightmapSize

svec3

Optional

100 100 100

Defines the size of the heightmap box on the 3 dimensions.

maxParticles

sint

Optional

30000

The maximum number of particles available for the simulation. You should not change this value during runtime. Resets the simulation.

mode

senum

Optional

heightmapRT

Specifies mode between drain and heightmapRT.

numParticles

sint

Optional

30000

The number of particles to be processed and rendered.
Must be less than or equal to maxParticles.

opacity

sfloat

Optional

1

Pixel opacity.

particleWidth

sfloat

Optional

0.05

Width of the rendered particles.

particleYAspect

sfloat

Optional

20

Y aspect ratio of the rendered particles (Y= Width x YAspect).

randomForceRange

svec3

Optional

0.4 -4 0.4

Additional force that is added randomly to each particle.
X and Z components have a random range from -range to +range.
Y component has a random range between 0 and range.
Resets the simulation.

shrinkMinValue

sfloat

Optional

0.3

Minimum shrink value that the particles can have (otherwise they would disappear).
Particles shrink when viewed towards the direction of the camera. This way when looking up (or down) the particles appear less wide.
0 means full shrink, 1 means no shrink at all.

spawnRadius

sfloat

Optional

100

Particles spawn radius (X and Z components).

spawnY

sfloat

Optional

5

Particles spawn Y (relative to the emitter position, Y= emitY + spawnY).

spawnYRandomRange

sfloat

Optional

2

Particles spawn range on the Y axis.

template

sstring

modules/physx/template_rain

Not set

The name of the template particle system loaded as parameter starting point. It can be set at runtime to change the particle system settings.

texture

sstring

Optional

Rain.png

Name of the rain drop texture used for the effect.

textureFormat

senum

Optional

U8

Defines the precision to use for each pixel of the heightmap texture as U8, U16, F16 or F32. Bigger formats allow bigger precision. Use float formats only in case there's a big range of different heights.

textureSize

senum

Optional

1024

Selects heightmap texture size among 512,1024,2048 and \\4096\\.

wind

svec3

Optional

0 0 0

Additional force.

yDrain

sfloat

Optional

0

The Y value where the particles die.
(drain and heightMap cannot be used at the same time).

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in