realtlacitka.png (1143 bytes) Real3D Amiga Environment Real3D Amiga Tutorials Real3D Amiga Projects Real3D Amiga Macros Real3D Amiga Other Back to Real3D Amiga home page

6.15.2 Snow in the Wind

The purpose of this example is to demonstrate use of multiple methods at the same hierarchy level. This means that more than one force field affects the particles and the result force is the sum of several forces.

First we need a force field which pulls the snow down (the gravity). This can be implemented using a straight line as a parameter for the DIRECTED FORCE method.

Then we need a force field representing the wind.

One way to create wind is to use several force methods at the same level so that different parts of the particle mass are affected by different methods; the closer a particle is to a method, the more that method affects it. This naturally causes some turbulence to the particle mass.

However, in this example we will create a customized force field. The direction of the wind depends on the position of the particle causing the particle mass behave like snow in a storm.

1. Create particles representing snow flakes. The more memory you have, the more snow you can have.

2. Create a DIRECTED FORCE method and rename it as "gravity".

3. Add the following tag to the method:

                   SFOR f=9.81

This means that the strength of the gravity is always 9.81. In other words, the distance between the parameter object and particles does not determine the strength of the force. The value 9.81 is very close the force field generated by the earth.

4. Create a straight line under the method object, representing the direction of the gravity (it should point downwards).

5. Create another DIRECTED FORCE method to the same hierarchy level with the first one and add the following tag to it:

                   SFOR f=10, fx=sin((y+t)*10), fy=cos((x+t)*10), fz=0

Variables fx, fy and fz are used for defining the direction of the force and they are initialized to reflect the direction defined by the parameter of the method. Here we override the original values by using sin() and cos() functions.

6. Create an offset primitive under the method. We can use any evaluable object here, because our custom formula overrides the direction anyway.

7. Create a PROCESSOR method to the same hierarchy level with the other methods.

realtut6.15.2_1.png (2871 bytes)
YouTube Figure T6-46: Snow particles are affected by two separate force fields:one simulating the gravity and one simulating the wind.

Open the animation window, set Resolution to 100 and Seconds to 10, and play the animation. If the result is not what you expected, cancel it and use Undo feature to restore the situation. Note that you cannot play the animation backwards to restore the situation; particle methods are such by their nature that running the time backwards does not produce the same events in reversed order, but results in a new situation.

If things do not happen fast enough in the animation, increment the "Seconds" value. If too much is happening, decrement Seconds and/or increment frame resolution.

You may also save the project before you play the animation; it is safer than using Undo, whose depth may not be sufficient if you make too many mistakes.

For more information about the variables for the DIRECTED FORCE, see the Reference manual.

ghh don'tpanic