ExprUtils — Natron 2.5.0 documentation

# ExprUtils

Inherits Double2DParam

## Synopsis

Various functions useful for expressions. Most noise functions have been taken from the Walt Disney Animation Studio SeExpr library.

### Functions

- def `boxstep` (x,a)

- def `linearstep` (x,a,b)

- def `smoothstep` (x,a,b)

- def `gaussstep` (x,a,b)

- def `remap` (x,source,range,falloff,interp)

- def `mix` (x,y,alpha)

- def `hash` (args)

- def `noise` (x)

- def `noise` (p)

- def `noise` (p)

- def `noise` (p)

- def `snoise` (p)

- def `vnoise` (p)

- def `cnoise` (p)

- def `snoise4` (p)

- def `vnoise4` (p)

- def `cnoise4` (p)

- def `turbulence` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `vturbulence` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `cturbulence` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `fbm` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `vfbm` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `fbm4` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `vfbm4` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `cfbm` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `cfbm4` (p[,ocaves=6, lacunarity=2, gain=0.5])

- def `cellnoise` (p)

- def `ccellnoise` (p)

- def `pnoise` (p, period)

### Member functions description

NatronEngine.ExprUtils.boxstep(x, a)
  Parameters

    - x – `float`

    - a – `float`

  Return type

    `float`

    if x < a then 0 otherwise 1

NatronEngine.ExprUtils.linearstep(x, a, b)
  Parameters

    - x – `float`

    - a – `float`

    - b – `float`

  Return type

    `float`

    Transitions linearly when a < x < b

NatronEngine.ExprUtils.boxstep(x, a, b)
  Parameters

    - x – `float`

    - a – `float`

    - b – `float`

  Return type

    `float`

  Transitions smoothly (cubic) when a < x < b

NatronEngine.ExprUtils.gaussstep(x, a, b)
  Parameters

    - x – `float`

    - a – `float`

    - b – `float`

  Return type

    `float`

  Transitions smoothly (exponentially) when a < x < b

NatronEngine.ExprUtils.remap(x, source, range, falloff, interp)
  Parameters

    - x – `float`

    - source – `float`

    - range – `float`

    - falloff – `float`

    - interp – `float`

  Return type

    `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

NatronEngine.ExprUtils.mix(x, y, alpha)
  Parameters

    - x – `float`

    - y – `float`

    - alpha – `float`

  Return type

    `float`

  Linear interpolation of a and b according to alpha

NatronEngine.ExprUtils.hash(args)
  Parameters

    args – `Sequence`

  Return type

    `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.

NatronEngine.ExprUtils.noise(x)
  Parameters

    x – `float`

  Return type

    `float`

  Original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.noise(p)
  Parameters

    p – `Double2DTuple`

  Return type

    `float`

  Original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.noise(p)
  Parameters

    p – `Double3DTuple`

  Return type

    `float`

  Original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.noise(p)
  Parameters

    p – `ColorTuple`

  Return type

    `float`

  Original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.snoise(p)
  Parameters

    p – `Double3DTuple`

  Return type

    `float`

  Signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.vnoise(p)
  Parameters

    p – `Double3DTuple`

  Return type

    `Double3DTuple`

  Vector noise formed with original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.cnoise(p)
  Parameters

    p – `Double3DTuple`

  Return type

    `Double3DTuple`

  Color noise formed with original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.snoise4(p)
  Parameters

    p – `ColorTuple`

  Return type

    `float`

  4D signed noise w/ range -1 to 1 formed with original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.vnoise4(p)
  Parameters

    p – `ColorTuple`

  Return type

    `Double3DTuple`

  4D vector noise formed with original perlin noise at location (C2 interpolant)

NatronEngine.ExprUtils.cnoise4(p)
  Parameters

    p – `ColorTuple`

  Return type

    `Double3DTuple`

  4D color noise formed with original perlin noise at location (C2 interpolant)”

NatronEngine.ExprUtils.turbulence(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.vturbulence(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.cturbulence(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.fbm(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.vfbm(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.fbm4(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.vfbm4(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.cfbm(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.cfbm4(p[, ocaves=6, lacunarity=2, gain=0.5])
  Parameters

    - p – `Double3DTuple`

    - octaves – `int`

    - lacunarity – `float`

    - gain – `float`

  Return type

    `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.

NatronEngine.ExprUtils.cellnoise(p)
  Parameters

    p – `Double3DTuple`

  Return type

    `float`

    cellnoise generates a field of constant colored cubes based on the integer location This is the same as the prman cellnoise function

NatronEngine.ExprUtils.ccellnoise(p)
  Parameters

    p – `Double3DTuple`

  Return type

    `Double3DTuple`

  cellnoise generates a field of constant colored cubes based on the integer location This is the same as the prman cellnoise function

NatronEngine.ExprUtils.pnoise(p, period)
  Parameters

    - p – `Double3DTuple`

    - period – `Double3DTuple`

  Return type

    `float`

  Periodic noise