top of page
  • Writer's pictureMatt Norris

Introduction to VEX part 1 (words, words, words)

Updated: Feb 25, 2020

Hello again,


Although this blog isn't intended to be a beginner's guide to Houdini I thought it might be a good idea to give a quick run down of some concepts about how Houdini actually operates so that what VEX does and doesn't do makes a bit of sense. I also wanted to establish a few definitions and naming conventions I will use throughout my blog in an attempt to minimise confusion.



Objects & Geometry (spot the difference)



To start with, let’s get right down to basics, Houdini differentiates between object level and geometry level, this is comparable to how Maya splits an object into transform and shape nodes. The geometry level or SOPs level contains the actual geometry (stating the bloody obvious there!) which is made up of the raw building blocks of geometry, points, prims, verts and volumes whilst the Houdini object node contains world space translation, scale and rotation information allowing the geometry to be positioned in your scene at will. Further the world space transform acts as a local space origin for everything at the geometry level, we can prove this very easily.


  • Create an empty obj level geo node

  • Dive inside, create an add node, create a single point with @P set to 1,1,1

  • Jump up to obj level and move it around a bit

  • Dive back inside, the value of @P remains 1,1,1

  • Thus proving that the obj level transform acts as a local pivot or origin for all geo at SOPs level.


This separation of objects/geometry (or transform/shape to use the Maya terminology) is common to most 3D software, Unreal engine for example uses the StaticMeshActor class of objects to place and move geometry in world space, the geometry data is stored as a StaticMesh object and then you import it as a StaticMeshActor and move it around your scene/level using a transform operation


objects Vs "Objects"


Ok, just to confuse matters let’s talk about objects, from a user point of view it’s easy to think of objects as specifically referring to the /obj/ level nodes which exist in your scene, that's fair enough and would seem pretty logical. The problem is that, from a programming point of view, Houdini is constructed in an Object Oriented fashion. So literally everything in your scene is an object! Every node you put down in any context is an object, every parameter on those nodes is an object, every connection you make between nodes is an object, hell, even the windows and panes of the UI are objects! This can often cause confusion when we use the word "object" what exactly are we talking about? I do my best to contextualise the word "objects" whenever I can so that people know exactly what I’m talking about so:


/obj/ level objects are:

-geo objects

-cameras

-nulls

-lights

-anything else that lives in the /obj/ context


SOPs level objects are:

-nodes

-sub nets

-dopnets

-anything else that lives “inside” a geometry node


VOPs level objects

-vop nodes

-you get the idea


Geometry level objects:

-points

-prims

-verts

-volumes (sort of)

-groups


I'll caveat everything I just said by pointing out that this is just the language I use to describe the different classes of objects Houdini uses, it's not necessarily correct it's just what I'll be using throughout my my blog.


So this brings us nicely onto how Houdini actually builds and manipulates geometry, the very best way to see what is really going on in your geometry is simply to open the geometry spreadsheet. Each horizontal entry on the spreadsheet represents a single geometry level object (a point, prim or vert), each column represents an attribute associated with that object, the first column is always the index of the object and ensures that each object has a unique identifier. Each column after that represents a particular attribute, some of which are “special” attributes with specific functions such as P (position), Cd (colour) or N(normal), some of which are data to be used in other parts of Houdini such as simulation, rendering or caching such as v(velocity), mass(mass), shop_materialpath (mantra material) or path(alembic hierarchy path). The user can also add literally as many custom attributes as they wish and there is a huge variety of flavours that those attributes can come in. Finally come the groups.



Streams




I like to think of my Houdini scripts as a stream of geometry data, starting at the top with some basic geometry or an imported cache, then passing through a network of nodes which perform discrete operations on the data stream before being compiled at the bottom into an output which can be sent to render or to be cached out.


Almost every SOP level node is essentially doing some combination of the following things:


-adding geometry level objects (new point, prims or verts)

-removing geometry level objects (blasting points, prims and verts)

-adding attributes ( )

-removing attributes ()

-altering attributes ( mountain SOP changes point position ("P"), color sop changes color ("Cd"))

-creating groups (group)

-removing groups(group delete)

-changing group membership(group)


Out of these relatively simple discrete operations a SOP can build extremely complex behaviour.


What’s this got to do with vex I hear you ask? Aha! Finally I get to the bloody point! Vex is all about performing discrete operations on the geometry data stream in fact VEX can do everything that’s on that list above so, at least in theory, any SOP operation could be replicated with VEX! I mean from a purists point of view that alone should be reason to immediately switch to using VEX for literally everything! All jokes aside the great thing about VEX is that if you are trying to do something to your geometry but can’t think of a node that does that, why not just write your own? VEX!!


Well the point is that vex is purely limited to the geometry level, it’s absolutely not to be confused with Houdini expression language (the stuff you type into node parameters) and it definitely can’t be used to create/delete nodes or set parameter values. And if you are doing some cool VEX-ey stuff in a wrangle that is only going to be effecting the data in that specific stream, you can't write a function in a point wrangle that alters the geometry of a different stream, not directly at least.


So, I hear you all cry, VEX must be able to do everything! Well unfortunately not, as breathtakingly amazing as VEX is, it has its limitations. However it’s limitations are entirely based around the structure of Houdini, VEX operates at the geometry level, it’s designed to interact with geometry level objects and their attributes. Vex operates “inside” the data stream and can’t directly interact with higher level objects such as SOPs or their parameters (as an aside that’s where python comes in).


In the next exciting edition of get vexed I'll blather on about what you can, and can't do in VEX...........................


657 views0 comments

Recent Posts

See All
bottom of page