.. module:: NatronEngine .. _ExprUtils: ExprUtils ************* **Inherits** :doc:`Double2DParam` Synopsis -------- Various functions useful for expressions. Most noise functions have been taken from the Walt Disney Animation Studio SeExpr library. Functions ^^^^^^^^^ - def :meth:`boxstep` (x,a) - def :meth:`linearstep` (x,a,b) - def :meth:`smoothstep` (x,a,b) - def :meth:`gaussstep` (x,a,b) - def :meth:`remap` (x,source,range,falloff,interp) - def :meth:`mix` (x,y,alpha) - def :meth:`hash` (args) - def :meth:`noise` (x) - def :meth:`noise` (p) - def :meth:`noise` (p) - def :meth:`noise` (p) - def :meth:`snoise` (p) - def :meth:`vnoise` (p) - def :meth:`cnoise` (p) - def :meth:`snoise4` (p) - def :meth:`vnoise4` (p) - def :meth:`cnoise4` (p) - def :meth:`turbulence` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`vturbulence` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`cturbulence` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`fbm` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`vfbm` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`fbm4` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`vfbm4` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`cfbm` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`cfbm4` (p[,ocaves=6, lacunarity=2, gain=0.5]) - def :meth:`cellnoise` (p) - def :meth:`ccellnoise` (p) - def :meth:`pnoise` (p, period) Member functions description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. method:: NatronEngine.ExprUtils.boxstep (x,a) :param x: :class:`float` :param a: :class:`float` :rtype: :class:`float` if x < a then 0 otherwise 1 .. method:: NatronEngine.ExprUtils.linearstep (x,a,b) :param x: :class:`float` :param a: :class:`float` :param b: :class:`float` :rtype: :class:`float` Transitions linearly when a < x < b .. method:: NatronEngine.ExprUtils.boxstep (x,a,b) :param x: :class:`float` :param a: :class:`float` :param b: :class:`float` :rtype: :class:`float` Transitions smoothly (cubic) when a < x < b .. method:: NatronEngine.ExprUtils.gaussstep (x,a,b) :param x: :class:`float` :param a: :class:`float` :param b: :class:`float` :rtype: :class:`float` Transitions smoothly (exponentially) when a < x < b .. method:: NatronEngine.ExprUtils.remap (x,source,range,falloff,interp) :param x: :class:`float` :param source: :class:`float` :param range: :class:`float` :param falloff: :class:`float` :param interp: :class:`float` :rtype: :class:`float` General remapping function. When **x** is within +/- **range** of **source**, the result is 1. The result falls to 0 beyond that range over **falloff** distance. The falloff shape is controlled by **interp**: linear = 0 smooth = 1 gaussian = 2 .. method:: NatronEngine.ExprUtils.mix (x,y,alpha) :param x: :class:`float` :param y: :class:`float` :param alpha: :class:`float` :rtype: :class:`float` Linear interpolation of a and b according to alpha .. method:: NatronEngine.ExprUtils.hash (args) :param args: :class:`Sequence` :rtype: :class:`float` Like random, but with no internal seeds. Any number of seeds may be given and the result will be a random function based on all the seeds. .. method:: NatronEngine.ExprUtils.noise (x) :param x: :class:`float` :rtype: :class:`float` Original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.noise (p) :param p: :class:`Double2DTuple` :rtype: :class:`float` Original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.noise (p) :param p: :class:`Double3DTuple` :rtype: :class:`float` Original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.noise (p) :param p: :class:`ColorTuple` :rtype: :class:`float` Original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.snoise (p) :param p: :class:`Double3DTuple` :rtype: :class:`float` Signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.vnoise (p) :param p: :class:`Double3DTuple` :rtype: :class:`Double3DTuple` Vector noise formed with original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.cnoise (p) :param p: :class:`Double3DTuple` :rtype: :class:`Double3DTuple` Color noise formed with original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.snoise4 (p) :param p: :class:`ColorTuple` :rtype: :class:`float` 4D signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.vnoise4 (p) :param p: :class:`ColorTuple` :rtype: :class:`Double3DTuple` 4D vector noise formed with original perlin noise at location (C2 interpolant) .. method:: NatronEngine.ExprUtils.cnoise4 (p) :param p: :class:`ColorTuple` :rtype: :class:`Double3DTuple` 4D color noise formed with original perlin noise at location (C2 interpolant)" .. method:: NatronEngine.ExprUtils.turbulence (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`float` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.vturbulence (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`Double3DTuple` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.cturbulence (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`Double3DTuple` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.fbm (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`float` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.vfbm (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`Double3DTuple` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.fbm4 (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`float` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.vfbm4 (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`Double3DTuple` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.cfbm (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`Double3DTuple` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.cfbm4 (p[,ocaves=6, lacunarity=2, gain=0.5]) :param p: :class:`Double3DTuple` :param octaves: :class:`int` :param lacunarity: :class:`float` :param gain: :class:`float` :rtype: :class:`Double3DTuple` FBM (Fractal Brownian Motion) is a multi-frequency noise function. The base frequency is the same as the noise function. The total number of frequencies is controlled by **octaves**. The **lacunarity** is the spacing between the frequencies - A value of 2 means each octave is twice the previous frequency. The **gain** controls how much each frequency is scaled relative to the previous frequency. .. method:: NatronEngine.ExprUtils.cellnoise (p) :param p: :class:`Double3DTuple` :rtype: :class:`float` cellnoise generates a field of constant colored cubes based on the integer location This is the same as the prman cellnoise function .. method:: NatronEngine.ExprUtils.ccellnoise (p) :param p: :class:`Double3DTuple` :rtype: :class:`Double3DTuple` cellnoise generates a field of constant colored cubes based on the integer location This is the same as the prman cellnoise function .. method:: NatronEngine.ExprUtils.pnoise (p, period) :param p: :class:`Double3DTuple` :param period: :class:`Double3DTuple` :rtype: :class:`float` Periodic noise