CParticleSamplerDoubleCurve

From PopcornFX
Jump to: navigation, search

Particle sampler double curve - Main page : Particle samplers Particle samplers


Available since v1.5.4
The double curve sampler allows you to sample a custom ranged curve of 1, 2, 3, or 4 dimensions.


Double-curve editor


Particle sampler curve Node properties

Field name Default value Description
Particle sampler curve General
MinLimits -Infinity Clamps the curve to a minimum value. Useful to avoid getting values below a certain value, usually 0.0.
MaxLimits +Infinity Clamps the curve to a maximum value. Useful for curves that shouldn't go beyond a certain value, for example 1.0
Particle sampler curve properties


Particle sampler curve Script bindings

for each sampler, depending on the curve's dimension, the following are published to scripts:


Curve Dimension Function
1
float	sample(float cursor);
float	sample(float cursor, float rangeCursor);
2
float2	sample(float cursor);
float2	sample(float cursor, float rangeCursor);
3
float3	sample(float cursor);
float3	sample(float cursor, float rangeCursor);
4
float4	sample(float cursor);
float4	sample(float cursor, float rangeCursor);


versions without 'rangeCursor' will behave as if calling:

MyCurve.sample(cursor, rand(0,1));


The 'cursor' parameter should be in the [0,1] range, and will map the horizontal axis of the curve.
The 'rangeCursor' parameter should be in the [0,1] range and will be used as the interpolation value between the two curves.
the function will return the value of each component of the curve at that coordinate:


CParticleSamplerDoubleCurve Cursors.png


Here, we have:

cursor = 0.3016
rangeCursor = 0.7054

Sampling the curves @ t = 0.3016 gives the two samples :

s0 = 0.363
s1 = 0.788

The sampler then interpolates between these two using the 'rangeCursor' :

s = s0 + rangeCursor * (s1 - s0)
  = 0.363 + 0.7054 * (0.788 - 0.363)
  = 0.6628


Particle sampler curve Node viewer panel

When this node is selected, it will display the Spline editor inside the Node viewer panel.


Curve editor