May 20, 2019
Houdini Procedural Fence Asset
Vimeo - Intro to Procedural Modeling in Houdini: Making a Fence Asset
By: trzanko
Notes:
Projecting Curve down onto surface
- make sure curve is entirely above surface first
- done by transforming this up in y an amount equal to the bounding box of the terrain
- can use Ray node
- used wrangle
- VEXpression to project curve onto terrain:
vector rayd = {0, -100, 0};
vector hitP, hitUVW;
int hitPrim = intersect(1, @P, rayd, hitP, hitUVW);
@P = hitP;
- this has every point fire a ray downward and determines where this ray intersects the terrain, and then
sets that point's position to the intersection point
Create Orthos
- used a Polyframe node
- turned off the Normal Name and reassigned the Tangent Name to "N"
- this made all the point normals basically follow allong the curve
- use VEXpression to direct normal vectors
- used wrangle:
- VEXpression:
vector up = {0, 1, 0};
v@side = normalize(cross(up, @N));
v@up = normalize(cross(@N, v@side));
- Seeing as this did two cross products in a row, I this sets v@side directly perpendicular to the curve (in plane)
then v@up creates a vector perpendicular to all of this, including the plane (so this creates a vector that is up from the line)
Created the Posts
- simple boxes where we polyextruded the top with a bit of an inset
Copy Posts to Terrain
- Used simple copyToPoints with our post and points along the terrain
- this placed their centers at the curve location however, so they were buried half way underground
- to fix this, we added another attribute wrangle before the copyToPoints where we moved the points along their v@up vector
a distance equal to half of an offsetDistance
- the offsetDistance channel then referenced the box sizey so it was always half of the height of the box
- this positioned the posts directly onto the surface
Starting Fence Links
Simple Spread
- Made 3 new copies of our offsetDistance wrangle node
- the general offset to center the posts went into the first copy
- this copy offset was used for the link locations
- this copy then went into both of the remaining offset copies
- one of these final offset copies had an inverse relative reference to the other's offset
- these were merged
- this merge with the combined offsets created a spread, where changing the offset of the one offset corresponded to a reverse offset of the other
Creating Separate Staggered Lines
- put all of the points of the link lines into a group called cut
- used polycut node to turn all of these small line segments between the points into individual prims
- used an attribute wrangle with modulus 2 function to basically remove every other primitive
- we then used a copy of this setup but with the opposite modulus (when equal to 1 instead of 0) to delete the opposite segments
- these were then combined with an offset to give an overall controllable pair of segment groups
- this entire setup was then copied to create a second set of links all together
Parameterization
- Using the offset attribute wrangle we created in several different locations lets us control several dimensions of the fence links
- overall distance of links from the ground
- distance between the two sets of links
- spread distance within a link set itself
Creating Links
- used a small grid as the base object
- used Sweep node to place these all along the link points
- used a Polyfill (the polycap they used must be deprecated) to fill in the ends of the links
Extra Polish
- to make the fence links feel less identical, they added a varied horizontal offset to them
- this was done by using another copy of the offset wrangle created, but changing the v@up to v@side
- they then added a dir (direction) vector, which used another mod 2 function, but fit the result between -1 and 1
- this was also applied to the offset, so the links would alternate offset directions with each link
Comments
Post a Comment