I've been wanting to learn more about generating outlines and creating NPR styles within Houdini. I found video showing the backface culling method to generate sweep mesh lines. (Youtube video can be found here). Here are all of my notes detailing the process.
Setup
This technique requires you to make a camera for this to work. You can create a camera node in the node editor or in the top bar. Select the lock next to the viewport to lock the view to that camera and set up the camera to view your scene how you like it.
Any piece of geometry should work with this, so for this test I will be using the Houdini rubber toy test geometry available.
The Node Tree
Once you have your camera and geometry you wish to apply an outline to, select your object and go down into the geometry level.
Delete Node
The first node you'll need is a delete node. Here we are going to delete all the polygons that we do not see from the camera's view. In the parameters window, Enable the normal tab, then in the "Backface from" text entry, put “/obj/”NAME OF CAMERA”/ .
|
|
Group Create Node
Next we have the Outline Node, rename it to a name you will remember because this will be used later (I named it "Outline"). In the Group Name write "$OS". This is our first instance of Houdini's scripting language called VEX. "$OS" means "Operator String", which means that it will take the name of whatever the node is called and it will be used for the group name. This is automatically updated whenever you change the name of the node. Also ensure the Group Type is changed to "Edges".
For the tabs, uncheck the "Base Group" box and check on the "Include by Edges" enable box.
Make sure you check "unshared edges" on as well.
Parameters Window for Create Group Node |
This node is setting up the group for where we are generating outlines from. It is important that we have "unshared edges" turned on. The group only captures edges only if the edge "has one primitive adjacent to it." (Houdini Doc). So since we've deleted the polygons behind the object, we have edges that only have one polygon next to it, and this node collects those edges.
Convert Line Node
The Convert Line node converts edges into line segments. Choose the group "Outline" we've created to create lines from those specific edges. Keep remove unused points on to keep only connected points. Compute length should be set to "restlength", which calculates the perimeter of the lines.
Polypath Node
This node helps to clean up the line segments. You don't have to change any of the default options, it will reduce duplicate edges that overlap each other.
Resample Node
We can use the Resample node to continue cleaning up the line segment. It gets rid of unnecessary points on the line segment while still keeping the original shape.
Orientation along Curve Node
This calculates the orientation of the curves based on the tangents. This should help use when we use the Sweep Curve Node
Sweep Node
The sweep node creates the actual geometry that will be seen for the outline. If the geometry was textured it will most likely take the colors from the original textures
Color Node
We can add a color node to change the overall color of the lines. At the moment, I've found that it only adds to the existing color, and doesn't overrides it. I'll see later how to fix this.
Merge Node
Now that we're finished generating the lines, we can merge it on top of our original geometry.
No comments:
Post a Comment