Inverse and Negative Values

Another important feature is the use of inverse functions and negative values. You can simply inverse a function (“x” being the appropriate variable, term or function you want to use) by applying

1 / x

Inverse functions are often necessary for falloffs, for example. Any valid function or term can be inverted, but there might be some gaps in the definition of functions, because of divisions by zero. This, for example, happens with the inverse of sine or cosine functions. The cosine of 90° and 270° is 0 and division by 0 is not defined.

 

With 1/cos(t) the graph shows undefined values, indicated by vertical spikes.


The values around 90° and 270° quickly converge against infinity and become very high. This normally leads to completely exaggerated motions or settings. Before you really apply an inverse function it is therefore recommended to print it first. This can either be done directly in the editor’s "Graph" window or an external function plotter. There you can see the values where the expression will cause problems.

Negative values are another typical transformation with functions and expressions. With negative values you can change the direction of a function. Just have a look at the following term:

5 * exp(t)

That is a nice exponential function converging from 5 against 0. It is actually an ideal expression for a daemon, slowly losing its strength or force, but there is one problem: the function plot shows that all the values are on the left side of the origin. This means that you have “negative” time values. With a simple transformation you can change the direction to make the time values positive again:

5 * exp(-t)

This is now an expression you could use for the desired purpose. By changing the initial factor (here: 5) you can shift the starting value. A factor like -t * x will make the curve steeper (if x > 1) or smoother (if 0 < x < 1).

 

The left graph shows the function 5 * exp(t), the right curve represents 5 * exp(-t).


Please keep in mind that some of RealFlow's nodes do not support negative values, for example a particle emitter's “Speed” value. In this case, the forbidden/undefined values will be clipped as shown in the curve below. There, a simple sine function was used, but since there is no negative emission, “Speed” drops to 0. If you want to perform an emission in the opposite direction you have to rotate the emitter node by 180 degrees,