Curve sampler

Curve sampler

Sampling functions

Return type

Description

float#

SamplerName.sample(float cursor)
Samples the curve at coordinate cursor on the horizontal axis.The return type is a float vector whose dimension matches the curve dimension.
A 1D curve will return a float, 3D curve will return a float3, etc…​

float

SamplerName.sampleCDF(float cursor)
Treats the curve as a Probability Density Function (PDF), and samples its Cumulative Density Function (CDF) at coordinate cursor on the horizontal axis.Only works for float curves (single channel / 1D).
Useful to get custom random distributions by doing Curve.sampleCDF(rand(0,1))

float#

SamplerName.derive(float cursor)
Computes the derivative of the curve sampler curve at coordinate cursor on the horizontal axis.Return type is a float vector whose dimension matches the curve dimension.
Each xyzw element of the result will contain the derivative of each of the separate curve components.

float#

SamplerName.integrate(float cursorBegin, float cursorEnd)
Computes the integral of the curve sampler curve between coordinates cursorBegin and cursorEnd on the horizontal axis.Return type is a float vector whose dimension matches the curve dimension.
Each xyzw element of the result will contain the integral of each of the separate curve components.

Disclaimer: These are describing the reference implementation. When using attribute samplers, the behavior of these functions can vary depending on the implementation in the game-engine where the effect is loaded.