top of page

Working With Switches 

 Blog Entry #5, January 26th, 2020


Switches are probably one of the most useful tools in Houdini. They can allow you to switch(just as it's name describes) between different geometry, simulation outputs and inputs, and more. 

However, telling a switch when to switch, or telling it when to do it's job might be a bit difficult. More so if you are either new to VEX, Hscript, or Houdini in general. This article is going to be a reference, or go to sheet for switch commands. Enjoy!

Switch Commands

  • Current frame,and floating point frame number: $F, $FF.

  • Current time: $T or @Time

  • Switch input number every 50th frame going between 0 and 1: $F%100<50

  • Use the first input for the first four frames, and the second input afterward: $F >= 5

  • Switch to the first input at frame 1: $F - 1

  • The switch will use the second input if there are no errors, if there is, it will switch to the first input: if (strmatch("*Error:*", run("opinfo " + opfullpath("../" + opinput(".", 1)))), 0, 1)

  • To get the switch node affect certain attributes use: point(), prim(), vertex() or detail() expressions.

  • Switch to input 0 if there is no other objects in the merge node. If there is, switch to input 1: if(npoints(“../object_merge1/”) != 0, 1, 0)

  • Delay a simulation by a frame, and pass the previous frame's input data forward: if($F==1, 0, 1)

  • Make things exactly equal to something in a switch: ==

  • Make something greater and equal than something: >=

  • Make something less than and equal than something else: <=

  • Switch if something is not equal to another value: !=


bottom of page