Unity vs. Unreal Engine: Which is Best for Real-Time VFX
For those who came to digital art from a non-programming-related background, coding might seem too intimidating. Learning an application like Unreal Engine or Houdini is demanding on its own and figuring out how to code inside them is an even bigger challenge. As some experienced Houdini artists like to say, ‘if you’re not using VEX, you’re not using Houdini to its full potential.’ And as much as we would like to disagree with a statement this categorical, it’s pretty accurate. So, what is VEX and why should you care about it?
In SideFX’s own words, VEX is a high-performance expression language. Now, to avoid confusion, we need to make one thing clear – VEX is not the same as C/C++ (though it’s based on it), Python, or any other programming language. You can use Python coding in Houdini, too, but that is a whole nother story. If you want to use Python scripting inside Houdini, you can do so using Houdini Object Model (HOM). It is an API that allows you to write Python expressions in the application to go beyond its standard toolset. With VEX, you don’t need to switch to the application programming interface. You can find the VEXpressions window on the right among your usual tools.
Most of the time, artists use VEX to write shaders though it’s not the only thing this expression language is good for. Firstly, Mantra rendering relies on VEX for shading calculations including surface, light, fog, and displacement. Secondly, with VEX Generator and VEX Filter, you can create next-level custom COPs. Compositing nodes or COPs are used for working on 2D pixel data like depth maps and render passes.
Plus, VEX is great for manipulating particles. Sure the good old particle operators can do the trick but VEX can make it faster. With VEX, you can write just one code that is going to do the job that several POPs normally do separately. And it will get everything done faster than a POP network. VEX is also often used for modeling, especially when it comes to intricate shapes with atypical geometry. Using the Attribute VOP, you can create custom surface nodes for adjusting point attributes in your model. What’s more, VEX is useful for lookdev – fur behavior in Houdini is controlled through VEX.
Firstly, even though VEX is based on C/C++, the very core of its functioning is different. In VEX, you program everything for a specific context. For instance, when you want to move a surface, you need to choose the ‘displace’ context. When you need to control the shadows in your scene, your context would be ‘shadows’. Depending on what context you pick, Houdini VEX will let you choose a certain number of functions and statements. You will not be able to find, say, functions from the ‘light’ context if you’ve already selected the ‘surface’ context.
Another thing to know about VEX’s syntax is that you should use the ‘@’ symbol for attributes. Attributes in Houdini are named values stored on vertices, points, primitives, and objects. Essentially, they are chunks of data for various levels of your geometry. Those levels are Vertex attributes, Point attributes, Primitive attributes, and Detail attributes.
To put it simply, points are literal points in your 3D space that have the (x, y, z) coordinates. Primitives are like facets that you get when you connect the points. A regular polygon would be a perfect example of a primitive. Now, vertex is a term that often causes confusion, though in fact, vertices simply attach primitives to points. Think of them as corner points of every polygon. Detail is the easiest attribute to understand, as it represents the whole geometry. If you want to dig deeper into those, check out Matt Estela’s amazing in-depth article about attributes in Houdini.
Now, we’ve said it before and we’ll say it again – VEX is loosely based on C/C++ so there are quite a few similarities in the way they function. Just like with C/C++, in VEX you have the usual statements like do loop, for loop, foreach loop, if, and some others. On top of that, there are context-specific statements for shading. One of them is getglobalraylevel which returns the depth of the ray tree for computing global illumination in the scene. Overall, Houdini VEX has a vast library of built-in functions for nearly any task you can think of. Those include the standard ones like variance, getgroupid, rotate as well as the more niche functions like specularBRDF, texture3dBox, or sssapprox.
In case those are not enough, you can always create custom functions. With VEX you can have an unlimited number of user-defined functions, though there are some things you need to keep in mind. Firstly, all the lines you write must be declared before they are referenced. Secondly, because the vcc compiler in-lines your functions by default, you can’t use recursion in VEX programming. In case you absolutely need it, there are shader calls that allow recursive algorithms. Thirdly, SideFX themselves recommend you avoid accessing global variables when writing your functions, since that will likely limit your code to only one context.
If you’re not familiar with programming at all, this might be beyond mind-blowing to you. And while VEX was designed to be user-friendly, it’s not a piece of cake and takes some time to master. Luckily, you can find numerous free and paid sources for learning Houdini VEX online. Entagma has a series of free YouTube tutorials on how to model 3D objects, make particle simulations, and create geometry with Houdini VEX. Nine Between has an awesome series of beginner-friendly lessons covering VEX basics. Plus, you can learn VEX with video tutorials from the master of Houdini, Junichiro Horikawa. You can also find tutorials and articles on how to use VEX on SideFX’s official website.
All these are free and they would be a perfect choice for confident Houdini users who know a bit about coding. If you would rather prefer a structured in-depth coverage of VEX with the possibility of receiving feedback from the industry professionals, paid Houdini courses would be your best choice. At Rebelway, we have a VEX course for intermediate-level Houdini artists that covers both the essentials of VEX programming and the advanced techniques for creating top-notch visuals. The course is taught by Corbin Mayne, FX Supervisor with over 10 years of experience in CG.
If you are not sure whether VEX for Houdini Artists would be the right choice or if you are looking for something different, take our course quiz to find out what Rebelway lessons would be best for you.
By filling out this form you agree to receive email communications from Rebelway.
Unity vs. Unreal Engine: Which is Best for Real-Time VFX
Kseniia Ivanova on her experience working as a VFX artist in Russia and abroad, overcoming sexism in the industry, and starting her own VFX studio.
No risk. Just results.