Plain Houdini tricks in Softimage style, Volume 00001
Posted: 06 Feb 2015, 23:10
Hello
Just wanted to share some of small learning exercises, I've created in last few months. As some of us already knows, Houdini networks does not contains only nodes, and these nodes aren't actually nodes we know from Softimage ICE, Softimage Render Tree or Maya Bifrost, they are more like nodes from compositing app. Everything seems to be present in usual Houdini network. Expressions, code wrangling, scripting of all kind, parameters, what else not. More ever, Houdini community seems to be proud to show just every aspect of Houdini, even for simple tasks, in ICE usually solved by some stupid simple compound, able to download somewhere.
I've just tried to build a small tent, having some familiar things inside, somewhere in wonderful Houdini ... jungle. That's all.
By the way, just figured out, how all three examples are somehow.. "patterned", well no big deal to fit into this in H. Believe me, I also have some a bit randomized, too
1: Group, or Cluster
Let's start with something familiar. Here's typical procedural modeling task - how to create a solid structure in fishnet style, from thick, planar polygons. First one of this kind I've created in Softimage XSI. Perhaps it's possible to do this in any poly modeling app, today. Network of Houdini SOP nodes looks similar to operators, someone will use in Softimage for this purpose. Divide edge, poly bevel on points for first rounding, inset the polygons to get first thickness, subdivide to smooth them all, poly extrude to get solid mesh.
Except one node: Group. By Houdini docs, Group 'generates groups of points, primitives, or edges according to various criteria'. It's comparable to cluster in SI, but in Houdini, "cluster" is, let's say, dynamic. It's really comprehensive operator, able to select by ID pattern, by custom attribute, by expression, by volume of another object, by open edges, so on. It can combine previously created groups, convert to another type, for example form point to polygons. And more, including ability to get the manual selection.
Later, group could be used to define the area affected by another SOP, it could be imported into VOP network, too. Some surface operators are able to create groups, like front, side or back group from Poly Extrude SOP, or hit points from Ray SOP. Ray SOP is similar to SI Shrinkwrap operator.
Here's group for isolating the polygons with more than four corners, for later use by Poly Extrude SOP. $NVTX expression means, number of vertices in polygon.
Now I think there is time for short glossary on Houdini - Sotimage route.
Vertex = Polygon corner, polygon node. Usually used in SI for storing the vertex colors or UV sample points.
Point = Point.
Primitive = Unit of geometry above points: polygon face, subcurve, NURBS subsurface.
Detail = whole geometry. Yes exactly that...
2: Attribute, parameter, get set data, import and export
In Softimage ICE and Houdini, we are using node networks to manipulate the attributes. Definition from Houdini docs, "Attributes are named values stored on vertices, points, primitives, and objects" applies to Softimage ICE as well. However, the way how to create and manipulate the attribute, it's different. In ICE there is unified way, we have get - set data nodes, result is plugged into ICE root node. In Houdini, it's not that simple. Perhaps the most common method for creating attribute, is "Attribute Create" SOP node.
Anyway I'll try to suggest the ICE - like method, 'enough good to live with it' also in fashion of Houdini 14. As we already know, VOP SOP is hidden in v14. When trying to put the "Add Attribute" into suggested Attribute VOP, Houdini mentioned 'Bind Export" VOP as faster option. So, we will be around Attribute VOP and Bind Export.
In image, there's new V14 feature, 'relax' feature of Scatter SOP. Scatter SOP is similar to ICE's "Generate Sample Set". "Relaxation" is one of methods to get the uniform, 'blue noise' distribution. In ICE, for some reason, more popular method to get blue noise is a 'dart throw'.
Here is polygonal sphere for start. "Mountain" node in Houdini could be called "Push by Turbulence" in ICE."Attribvop_density" uses some turbulent noise to set the custom attribute called 'my_density'. Scatter SOP uses 'my_density" for variable distribution. Later, "attribvop_scale" gets the "my_density" to calculate the appropriate scale. "Copy" SOP creates copies of another sphere, on points created by Scatter SOP.
Behavior is somehow typical to Houdini: attribute created somewhere earlier in network, dictates the behavior of SOP node, applied later. SOP node won't tell you what forced it to behave differently. In other word, once you're in Houdini, I'd say, first do a search for attributes, do not looking into parameter view that much.
Same applies to simulation network. Frequently, parameters in DOP (dynamic) network are inherited from attributes set on 'static" geometry. Perhaps nothing new for ICE users, it reminds to set data in un - simulated ICE tree, for later use in simulated ICE tree. However in Houdini, sometimes, previously created attribute acts as multiplier, sometimes is sort of override.
So how to find what attributes are running around. Simplest way: MMB on node to get the node info.
Between other info, node info tells about 'my_density' float (f is for float) attribute.
Take look into Attribute VOP. As it is noticeable, there is no equivalent of "ICE root" node. Some default inputs and outputs are there, but this is not everything.
There's 'parameter' node called 'turbulence_scale', this time used for controlling the turbulence scale. Parameter node in Houdini is able to act as ICE get data and ICE set data. Or, just as plain parameter (that is, not an attribute), living only 'on' VOP node. And here's another Houdini specific behavior: Parameter node, or Ramp parameter (Gradient or function Curve in ICE) displays their control 'on top' of VOP node. We have to close the VOP node, to be able to use them.
We also see the "bind export" which acts as sort of "set data". By default, it's set to "Set Parameter Attributes", also it's set to export. 'Export' could be translated
as 'able to live out of VOP node', or "it sets an attribute".
And 'get data' in later VOP called "attribvop_scale". Because parameter of "my_density" name already exists, this time operator references it and now has functionality of ICE's GET data.
Consequently, some nodes are able to "import" attribute data for use in VOP node. From another node or even geometry on hard disk. For example, if we want the effect of ICE 'ID to location' we'll use "Import point attribute" node.
Short glossary of attribute names:
P = position
N = normal
v = velocity
Point Number = Point ID
Cd = color
Scale = particle or instance/copy scale
pscale = particle size
*note: I intentionally mentioned 'position' instead of 'point position'. That is, if Attribute VOP binds to primitives, exported P attribute is center of primitive, let's say center of polygon. If it binds to detail, P attribute is average of all points - similar to what we already know in ICE as "get set average" of all points.
Tips:
- One VOP node = one evaluation. Using many VOP nodes one after another, actually IS a good idea. It allows Houdini to optimize and do multi threading as he wants.
- Houdini is case sensitive. my_density and mY_density is not the same.
- There are no limits of ICE "switch context" in Houdini. No big deal to get the "polygon position" from another operator, and use it in VOP which binds to points.
If there is no polygon with called polygon number, Houdini just do nothing in this case.
3: Copy to polygons, Primitive Attribute or UV to location
One really frequent SOP node in Houdini is "Copy" node, which created copies on points of another geometry. Great, but how about copy to polygons. I think I found a dozen or two of methods. So here is yet another one, I'd believe a good example for "Primitive Attribute" as something *close* to ICE "UV to Location". Just close, anyway. In case of NURBS surface or curve it works in pretty much same way. But, "Primitive Attribute" works with polygons, too ( as it is mentioned, polygon face is a kind of "primitive". In case of polygons, UV means uv parametric location, not uv texture projection. That is, relative cord inside four corners of polygons. Node is able to work with triangles, pentagons and more, too. But just for now, I decided to stay with quads.
I've used "point generate" SOP node to create "matching" of point count, to count of polygons in reference geometry. Of course there are another ways to do the same, but this method somehow reminds to "matching", we like to use in ICE: get number of polygons in mesh, build array of same size, use ID to align the position and everything else. Expression in 'Number of Points" in Point Generate node, means 'number of primitives in any name of node connected to first ( zero) input".
So another utilization of "Copy" node is here, with pre defined attributes.
Attribute VOP called "attribvop_set_attribs", contains several "Primitive Attribute" nodes, actually more than we need for plain copy and align to polygons. Some of them are for getting the effect of "one segment lattice deformation" so each copied geometry is sheared, if needed, in order to perfectly fits into polygon.
Last node, called "post transform" contains another interesting Houdini VEX nods, "Make Instance Transform". This is one is able to reconstruct the transform of instance /copy, so 'local transform" could be applied even after something is copied or instanced. Actually, entire network could be done in different and faster way, by using a "Duplicate" SOP, taking the all attributes by what we know as modulo trick in ICE. Anyway this is just an example.
So that's it, this time. Get hiplc files, here.
Just wanted to share some of small learning exercises, I've created in last few months. As some of us already knows, Houdini networks does not contains only nodes, and these nodes aren't actually nodes we know from Softimage ICE, Softimage Render Tree or Maya Bifrost, they are more like nodes from compositing app. Everything seems to be present in usual Houdini network. Expressions, code wrangling, scripting of all kind, parameters, what else not. More ever, Houdini community seems to be proud to show just every aspect of Houdini, even for simple tasks, in ICE usually solved by some stupid simple compound, able to download somewhere.
I've just tried to build a small tent, having some familiar things inside, somewhere in wonderful Houdini ... jungle. That's all.
By the way, just figured out, how all three examples are somehow.. "patterned", well no big deal to fit into this in H. Believe me, I also have some a bit randomized, too
1: Group, or Cluster
Let's start with something familiar. Here's typical procedural modeling task - how to create a solid structure in fishnet style, from thick, planar polygons. First one of this kind I've created in Softimage XSI. Perhaps it's possible to do this in any poly modeling app, today. Network of Houdini SOP nodes looks similar to operators, someone will use in Softimage for this purpose. Divide edge, poly bevel on points for first rounding, inset the polygons to get first thickness, subdivide to smooth them all, poly extrude to get solid mesh.
Except one node: Group. By Houdini docs, Group 'generates groups of points, primitives, or edges according to various criteria'. It's comparable to cluster in SI, but in Houdini, "cluster" is, let's say, dynamic. It's really comprehensive operator, able to select by ID pattern, by custom attribute, by expression, by volume of another object, by open edges, so on. It can combine previously created groups, convert to another type, for example form point to polygons. And more, including ability to get the manual selection.
Later, group could be used to define the area affected by another SOP, it could be imported into VOP network, too. Some surface operators are able to create groups, like front, side or back group from Poly Extrude SOP, or hit points from Ray SOP. Ray SOP is similar to SI Shrinkwrap operator.
Here's group for isolating the polygons with more than four corners, for later use by Poly Extrude SOP. $NVTX expression means, number of vertices in polygon.
Now I think there is time for short glossary on Houdini - Sotimage route.
Vertex = Polygon corner, polygon node. Usually used in SI for storing the vertex colors or UV sample points.
Point = Point.
Primitive = Unit of geometry above points: polygon face, subcurve, NURBS subsurface.
Detail = whole geometry. Yes exactly that...
2: Attribute, parameter, get set data, import and export
In Softimage ICE and Houdini, we are using node networks to manipulate the attributes. Definition from Houdini docs, "Attributes are named values stored on vertices, points, primitives, and objects" applies to Softimage ICE as well. However, the way how to create and manipulate the attribute, it's different. In ICE there is unified way, we have get - set data nodes, result is plugged into ICE root node. In Houdini, it's not that simple. Perhaps the most common method for creating attribute, is "Attribute Create" SOP node.
Anyway I'll try to suggest the ICE - like method, 'enough good to live with it' also in fashion of Houdini 14. As we already know, VOP SOP is hidden in v14. When trying to put the "Add Attribute" into suggested Attribute VOP, Houdini mentioned 'Bind Export" VOP as faster option. So, we will be around Attribute VOP and Bind Export.
In image, there's new V14 feature, 'relax' feature of Scatter SOP. Scatter SOP is similar to ICE's "Generate Sample Set". "Relaxation" is one of methods to get the uniform, 'blue noise' distribution. In ICE, for some reason, more popular method to get blue noise is a 'dart throw'.
Here is polygonal sphere for start. "Mountain" node in Houdini could be called "Push by Turbulence" in ICE."Attribvop_density" uses some turbulent noise to set the custom attribute called 'my_density'. Scatter SOP uses 'my_density" for variable distribution. Later, "attribvop_scale" gets the "my_density" to calculate the appropriate scale. "Copy" SOP creates copies of another sphere, on points created by Scatter SOP.
Behavior is somehow typical to Houdini: attribute created somewhere earlier in network, dictates the behavior of SOP node, applied later. SOP node won't tell you what forced it to behave differently. In other word, once you're in Houdini, I'd say, first do a search for attributes, do not looking into parameter view that much.
Same applies to simulation network. Frequently, parameters in DOP (dynamic) network are inherited from attributes set on 'static" geometry. Perhaps nothing new for ICE users, it reminds to set data in un - simulated ICE tree, for later use in simulated ICE tree. However in Houdini, sometimes, previously created attribute acts as multiplier, sometimes is sort of override.
So how to find what attributes are running around. Simplest way: MMB on node to get the node info.
Between other info, node info tells about 'my_density' float (f is for float) attribute.
Take look into Attribute VOP. As it is noticeable, there is no equivalent of "ICE root" node. Some default inputs and outputs are there, but this is not everything.
There's 'parameter' node called 'turbulence_scale', this time used for controlling the turbulence scale. Parameter node in Houdini is able to act as ICE get data and ICE set data. Or, just as plain parameter (that is, not an attribute), living only 'on' VOP node. And here's another Houdini specific behavior: Parameter node, or Ramp parameter (Gradient or function Curve in ICE) displays their control 'on top' of VOP node. We have to close the VOP node, to be able to use them.
We also see the "bind export" which acts as sort of "set data". By default, it's set to "Set Parameter Attributes", also it's set to export. 'Export' could be translated
as 'able to live out of VOP node', or "it sets an attribute".
And 'get data' in later VOP called "attribvop_scale". Because parameter of "my_density" name already exists, this time operator references it and now has functionality of ICE's GET data.
Consequently, some nodes are able to "import" attribute data for use in VOP node. From another node or even geometry on hard disk. For example, if we want the effect of ICE 'ID to location' we'll use "Import point attribute" node.
Short glossary of attribute names:
P = position
N = normal
v = velocity
Point Number = Point ID
Cd = color
Scale = particle or instance/copy scale
pscale = particle size
*note: I intentionally mentioned 'position' instead of 'point position'. That is, if Attribute VOP binds to primitives, exported P attribute is center of primitive, let's say center of polygon. If it binds to detail, P attribute is average of all points - similar to what we already know in ICE as "get set average" of all points.
Tips:
- One VOP node = one evaluation. Using many VOP nodes one after another, actually IS a good idea. It allows Houdini to optimize and do multi threading as he wants.
- Houdini is case sensitive. my_density and mY_density is not the same.
- There are no limits of ICE "switch context" in Houdini. No big deal to get the "polygon position" from another operator, and use it in VOP which binds to points.
If there is no polygon with called polygon number, Houdini just do nothing in this case.
3: Copy to polygons, Primitive Attribute or UV to location
One really frequent SOP node in Houdini is "Copy" node, which created copies on points of another geometry. Great, but how about copy to polygons. I think I found a dozen or two of methods. So here is yet another one, I'd believe a good example for "Primitive Attribute" as something *close* to ICE "UV to Location". Just close, anyway. In case of NURBS surface or curve it works in pretty much same way. But, "Primitive Attribute" works with polygons, too ( as it is mentioned, polygon face is a kind of "primitive". In case of polygons, UV means uv parametric location, not uv texture projection. That is, relative cord inside four corners of polygons. Node is able to work with triangles, pentagons and more, too. But just for now, I decided to stay with quads.
I've used "point generate" SOP node to create "matching" of point count, to count of polygons in reference geometry. Of course there are another ways to do the same, but this method somehow reminds to "matching", we like to use in ICE: get number of polygons in mesh, build array of same size, use ID to align the position and everything else. Expression in 'Number of Points" in Point Generate node, means 'number of primitives in any name of node connected to first ( zero) input".
So another utilization of "Copy" node is here, with pre defined attributes.
Attribute VOP called "attribvop_set_attribs", contains several "Primitive Attribute" nodes, actually more than we need for plain copy and align to polygons. Some of them are for getting the effect of "one segment lattice deformation" so each copied geometry is sheared, if needed, in order to perfectly fits into polygon.
Last node, called "post transform" contains another interesting Houdini VEX nods, "Make Instance Transform". This is one is able to reconstruct the transform of instance /copy, so 'local transform" could be applied even after something is copied or instanced. Actually, entire network could be done in different and faster way, by using a "Duplicate" SOP, taking the all attributes by what we know as modulo trick in ICE. Anyway this is just an example.
So that's it, this time. Get hiplc files, here.