switch

Keywords:
  • blend

Switches or blends between several inputs, without the need to rebuild the shader, allowing for fast switching.

Note that inputs that are not connected are skipped over when assigning numbers to them, so if inputs 1, 2, and 4 are connected, they will use indices 0, 1, 2.

Parameters

Name Description Regular Handling Read-Only Handling
Enable
Source

When 0, the first source is used, 1 for the second, etc.

Runtime Baked
Blend Between Inputs

Whether to blend between inputs.

Semi-Baked Semi-Baked
Index Field

Field that can provide index values instead of using the parameter.

Index Mode

How to map index values to inputs.

Runtime Baked
  • Index (0 .. N-1): First is 0, second is 1, and so on.
  • Index (1 .. N): First is 1, second is 2, and so on.
  • Normalized (0 .. 1): Scaled to a 0..1 range, so 0 is the first and 1 is the last.
Extend

How to handle indices that are outside the expected range based on the selected Index Mode.

Runtime Baked
  • Clamp:
  • Loop:
  • Zig-Zag:

Inputs

  • Input 1: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 2: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 3: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 4: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 5: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 6: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 7: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Input 8: (optional)
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float vec4 Sdf Volume Ray Light Particle
  • Index Field: (optional) Field used to choose the source index
    • From Parameter: Index Field
    • Coordinate Types: float vec2 vec3 vec4
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext VertexContext PixelContext
    • Return Types: float