fieldExpr

beta

Modifies field values using a custom expression.

The Expression parameter’s menu contains common examples.

Writing expressions:

  • To access a value from input 1, use a function call like inputOp1(p, ctx)
    • The p part is the spatial coordinate, so you can modify it with something like inputOp1(p + vec3(1, 0, 0), ctx), which would move that field to the left.
    • The ctx part is required as the second argument to the function.
  • Other inputs are available as inputOp2(...) etc
  • The two slider parameters are available as THIS_Param1 and THIS_Param2
  • The two vector parameters are available as THIS_Vecparam1 and THIS_Vecparam2
    • To get at an individual part of one of the vector params, you can use THIS_Vecparam1.y

Parameters

Name Description Regular Handling Read-Only Handling
Enable
Expression
  • sqrt(x) Square Root:
  • abs(x) Absolute Value:
  • sign(x) Sign:
  • cos(x) Cosine:
  • sin(x) Sine:
  • tan(x) Tangent:
  • acos(x) Arccosine:
  • asin(x) Arcsine:
  • atan(x) Arctan ( Input1 ):
  • atan2(x,y) Arctan ( Input1 / Input2 ):
  • cosh(x) Hyperbolic Cosine:
  • sinh(x) Hyperbolic Sine:
  • tanh(x) Hyperbolic Tangent:
  • log2(x) Log Base 2:
  • log(x) Natural Log:
  • exp(x) e ^ Input1:
  • exp2(x) 2 ^ Input1:
  • pow(x) Base ^ Input1:
  • pow(x,y) Input1 ^ Input2:
Param 1 Runtime Baked
Param 2 Runtime Baked
Vector Param 1 Runtime Baked
Vector Param 2 Runtime Baked
Coord Type
  • Use Input:
  • float:
  • vec2:
  • vec3:
Return Type
  • Use Input:
  • Sdf:
  • vec4:
  • float:
  • Ray:
  • Light:
Context Type
  • Use Input:
  • Auto:
  • Context:
  • MaterialContext:
  • CameraContext:
  • LightContext:
  • RayContext:

Inputs

  • Input Field 1: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Ray Light Particle
  • Input Field 2: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Ray Light Particle
  • Input Field 3: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Ray Light Particle
  • Input Field 4: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Ray Light Particle