Temitope FALADE's profile

HOUDINI - FOOTPRINT/TYRE TRACKS

HOUDINI - FOOTPRINTS/TRACKS
 SIMULATION
INTRODUCTION
In this module, we are going to examine how to create some special type of softbody simulations such as footprints and tire tracks effects inside Houdini. We will not be using vellum method here, instead we will be doing this with the SOP nodes, that's why we created a separate module for this.

What we have to know is that the colliding geometry (the mesh making the print) and the surface geometry (on which we will create the print) have to intersect each other. If we have an animated character, the character's feet have to actually penetrate the surface geometry (we can control how deep into the surface the print is going to happen).

We are also going to learn about some new nodes and techniques as we progress.

So let's jump right into it.
HOUDINI SETUP
Let's start with a geometry node named "footprint" and enter it's SOP level. 

We will create the in-built crag character to use as our collider, and a grid as the ground surface. We are going to crank up the subdivisions on the grid to 1000 by 1000 so that we a lot of resolutions to work with.
In order to transfer data from the collider geometry (crag) to the ground so that we can create the deformation, we will start by using an attribute transfer node. As the name suggests, it allows us to transfer attributes from one object to another.
Right now, nothing is being transferred. If we add a color node each to the ground and the collider and assign different colors, we can for example, use this attribute transfer node to transfer the color from the collider to the ground, and vice versa.
If we activate the attribute transfer node, the resulting ground geometry turns to red. This is because of the order of input connections. If you examine the input nodes on the attribute transfer node, the first one is where we are transferring attributes to (where the ground is connected), and the second one is where we are transferring attributes from (where the collider is connected), thus the result is the ground inheriting the color of the collider.

With this knowledge, we can do some more interesting stuff.
If we look at the attribute transfer properties, we can choose what type of attributes we want to transfer under the attributes tab. For example, in the points section, we can choose to transfer either the color (Cd) or position (p) attributes.
If we navigate to the conditions tab, we can control the extent in which the attribute transfer occurs. For example, if we want to see the red color being transferred only around the immediate point of intersection with the collider geometry (in this case, crag's feet), we will have to reduce the distance threshold (set to 10 by default) to something quite low (like 0.025 in this case).
We will now see that the red color from the crag model is transferred only around the feet.
POINT VOP WORKFLOW
All the node setups that we are going to create to deform and refine the look of the footprints will be done solely inside the point VOP node.

If we connect a point VOP node to a mesh, we can use this node to access the mesh's components' attributes (such as position, color, force, UVs, normals etc.) and perform various operations inside the point VOP's level to modify these attributes. The mesh's components of course can be either points, edges, or primitives. 

The advantage of using point VOP is that it is much faster and efficient to calculate.
From the above setups, we don't just want to see colors, we want to see the ground deformed at the area of intersection. To do this, we are going to add a point VOP node renamed as "deform ground" which we will use to deform the ground plane at that intersection point.
Double click on this point VOP node to enter it's VOP level. We will see two separate nodes inside here. This is where we are going to perform some operations to achieve our result.
What we want to do here now is to deform the footprint areas (the red parts) along the y-axis.

Let's create a constant node to access any axis. We are going to add this constant to the current position as shown in the connection below. Of course, since we are dealing with position here, the output will be connected to position as well.
Let's convert this constant into a vector by choosing 3 floats (vector) in the constant type dropdown. We will then set the y-axis value to 1. This is the direction we want the deformation to go, so we will call it an up-vector.
Right now, this will not do anything. This is because we have not yet define what attribute we want to affect. Since we're using color to mask out the footprint region on the ground, the attribute we will need to affect is the color attribute. In the attribute spreadsheet, we can see that every points on the ground geometry has a color value (r, g, b).
Currently, the ground plane's color value is (0, 0, 1) at the blue areas, and the areas that are red are (1, 0, 0). These values are multiplicative, so that means whatever value we see on the ground's color (r, g, b) are either multiplied by 1 or 0. 

As a result of this, we are going to have to multiply our up-vector inside the point VOP with the color value. So let's connect a multiply node after the constant.
Right now nothing happens because our color value is neither (1, 1, 1) or (0, 0, 0). The only colors that can give us these absolute values are either white or black. 

So let's change the colors on the color nodes to black and white on the ground and crag's geometry respectively. Immediately, we will see that the ground deforms upwards at those intersection points.
Of course this is too much, so let's reduce the up-vector value on the constant to a low number to get a more reasonable result.
Now this looks better.

We can play around a bit by raising the plane upwards more and setting the up value to a negative value (around -0.08 in this case) so that the ground depresses instead. We will get the following result:
The takeaway here is that if we are using point VOP to deform the ground, it is crucial we assign colors to the geometries because point VOP work best with color attributes. Without the color nodes, this won't work.

A different method we can use to deform the ground without using the color or point VOP node is using a ray node. We will look at how this node work later.
Let's continue with the point VOP for now. 

Right now, every time we set visibility on the point VOP node, we get this black and white shade which is quite distracting. So let's use an attribute delete node to delete the color attributes.
Under the attribute delete node's point attributes dropdown, let's choose color (Cd). If we enable the node now, the distracting black color is gone and we can see our ground more easily.
Looking at the footprints alone, this does not look interesting yet.
We want to deform around the edges of the footprints as well to improve the look.

Let's go back into the point VOP node and create a ramp parameter node. We will use this ramp node to control the ranges of color values around the edges of the footprint.

Let's connect the connect it as follows.

Tip: Use Shift + S on the keyboard to change the shape of the wires connecting two nodes.
Let's change the ramp type to 'spline ramp (float)' instead of the default color ramp.

Now we should know that this ramp parameter will automatically be transferred to it's parent node which is the point VOP node. So we can access the spline ramp directly on the point VOP.
Let's go back to the SOP level and tweak the shape of the spline ramp as follows (We temporarily disconnected the wire connecting the add to the output so that we can preview how this ramp is working; we will enable it back once we are happy with our result).
Let's go back into the point VOP level and use the ramp to multiply the constant instead.
Now we get a much interesting result:
The edges of the footprints are looking too sharp right now, so let's blur them out using an attribute blur node. We will connect this right after the attribute transfer node.

This is how our nodes setup is looking so far:
This node will blur position by default. Let's specify color (Cd) instead so that it blurs the color. We will also increase the blurring iterations to 50 to get better results.
The footprints are softer around the edges now.
We can still enhance this footprint even further by introducing some noises so that the footprint edges are not always this smooth and clean.

So let's go back into the point VOP node and see how to do that.

Let's create a turbulent noise node to generate some noise. Of course, we want this noise to affect the position of the points of the ground mesh, so we will connect the position to the turbulent noise node's position input.

Now where do we connect the output of the noise node to? Typically, we would want to connect it to the position output. But since we are using the constant node's up-vector to deform the ground upwards, to add the noise to this deformation, we will have to multiply the up-vector by the noise. So we will connect the noise output into the multiply node.
Let's do the following settings on the turbulent noise node:
This works. However, it creates some problems. The generated noise is pushing some of the points into the negative space which we don't want. 
To fix this, let's create an absolute node. This node is used for converting and clamping negative values into positive values only. So we will connect the absolute node right after the noise node to convert any negative values into positive values only.
This gets rid of the negative space for us:
Let's perform these new settings on the noise:
Let's also set the up-vector to around 0.2

Now we get the following result:
The footprint is looking much better and interesting now. 

However, if we play the simulation, we will notice that the footprints only appears only once every time the character's feet intersects with the ground. The previous footprint disappears as soon as the feet leaves the ground.

We need to store the previous position of the footprints. So for that, let's go back to the SOP level and create a trail node. We will feed the collider geometry into this node so that it will remember the previous positions of the collider.
To create a trail for every single frames that the collider moves, we will have to use the VEXpression: $F inside the 'trail length' parameter to remember every single frames.
But right now, it's going to soon get too heavy as the trails are generated because the entire collider geometry are being generated each frames. So let's try to optimize things first before we go on.

Let's add a delete node before the trail to delete every other parts of the collider except the parts that are intersecting with the ground (in this case, crag's hammer and feet).
Let's enable the bounding volume (or box) on the delete node and resize to cover the range of his motion. We will adjust it such that it deletes every parts of crag except for the tip of his hammer touching the ground and his feet. As long as crag is within the bounding volume, only the feet and hammer tip will remain.
Next, we can scatter some particles using the scatter node.
Let's turn off 'force total count' and set density scale to about 1000.
To make things run faster, we can use a filecache node to save out the scattered particles first so that it doesn't have to evaluate every time.
So let's quickly cache out these scattered particles.

Everything should work now. To make us playback in real time, we will also cache out the result simulation.
We get the following result!
Neat!
We can cache this out as alembic to render inside Maya.
What we observed throughout this setup is that we did not need any solver node to create the effect. This is one of the benefits of working in the VOP level.
VOLUME VOP
The same way we can use Point VOP to affect or modify the arrangements/behaviour of points that exists in the SOP level from inside the VOP level, we can also use volume VOP to affect volumes that exists in the SOP level.

We will do a very simple demonstration here to understand how this works as well;
Let's create a simple box, and reshape it;
Let's convert this box into volume by adding an iso offset node (this node converts any geometry mesh into volume);

Then let's add a volume VOP node after this;
Now we will use the volume VOP to create some noise in the volume, so double click on the node to enter it's VOP level;

Now, inside this level, let's create a turbulent noise node. We will use this node to generate the noise. We will multiply this noise by the density to get the required effect;
We get the following result:
This should give us a very basic understanding of how the volume VOP node work now
USING THE SOLVER METHOD
In the above section, we took a look at creating the footprint effect using the point VOP workflow which does not require any solver calculations. In this section we are going to see how to create the prints effect using solver.

Let's start from the initial setup we used for above.
Let's make sure crag's feet and hammer tip are intersecting the ground plane. 
Now let's create a ray node. This node will deform one object based on the intersection point with another. The node has two inputs, the first one being the object we want to deform, and the second one being the collider object. 

So let's connect them as follows:
Right out of the box, we get a deformation.
This is too much though. So first, let's change the ray node's 'direction from' to vector. We want to deform the ground plane along the y-axis, so let's delete the channel on y-axis and set it to -1. Let's also enable 'intersect farthest surface' so that the ground is deformed up to the base of crag's feet.
We get the following results:
However, when we playback or scrub across the timeline, it takes a bit of time because the ray node is always calculating the new deformations. In order to make this node work more efficiently, we need to use it inside a solver's DOP level instead. 

So let's delete the ray node from this SOP level and create a simple solver node instead. This solver node is now going to be responsible for the computations of the ray node.

Let's connect our geometries to the solver as follows:
Then we will double click on the solver node to enter it's DOP level. We will see the following inside this level:
Now, we will create the ray node again inside this DOP level now, and connect it as follows: 

Note how we connect skipped input 1 (where we connected the ground plane to in the SOP level) and connected the object merge input 2 into the ray's second input instead. This is because that is where the collider output was connected in the SOP level. So it is important to connect things in their respective order for this to work.
If we enable the solver, we will get the exact same result like we got before.
When we play the simulation inside this DOP level, we will see that the footprints are actually retained overtime and we did not even needed to do anything special like we did with point VOP.
However, if we go back to the SOP level and play the simulation, we will not see anything happen. We only see the result inside the DOP level. To bring out the results from the DOP level to the SOP level, we are going to first group all the ground points that are being intersected by the collider geometry.

So let's go inside the solver's DOP level again and create a new group node set to points. We can rename this group "deformed ground GRP". We will connect it as follows:
So what we want to do now is to create the points group based on the areas of intersections between the collider geometry and the ground mesh. So let's turn off 'base group' and enable 'keep in bounding region' instead. Then we will change the bounding type to: 'bounding object (points or vertices only)'. Now every points on the ground plane intersected by the collider geometry will be selected and added to the group.
Then let's go back to the SOP level and create a new points group with the same name as the one we created inside the DOP level. We will connect this new group after the solver node.
Let's set the initial merge on this new group and the one inside DOP level to 'union with existing' so that it combines it with the one inside the DOP level to generate the same results for us in the SOP level.
Let's also modify the ray node inside the DOP level as follows; referencing in the new group we created.
Now we can see the results in the SOP level.
Let's add a bit more detail to the footprint.

Let's first grow the thickness of the collider so that we get a bigger footprint area than we got before using a peak node. Let's increase the distance very slightly so that it is slightly thicker than the original.
Then let's create a new solver node to deform the ground geometry upwards following the same steps we did before. Let's delete the peak node and create it inside this new solver's DOP level instead.
We will create a new ray node inside this new solver node,. We will also set it's direction from to 'vector', delete the up-vector channel and set it's value to 1 just like we did before.

We will also create a new points group here, and name it "ground up deformation" (for the upward displacement). Then we will set it's initial merge to union with existing group.
We will slightly peak the ground mesh itself as well via the input 1, and use it as the collider in the ray's second input.
This is the new solver DOP setup:
We get these upwards displacement.
Now let's combine the downward displacement and the upward displacement.

So let's create a group copy node and perform the following settings:
So now both the ground depression and the upward displacement groups now exist inside this group copy node.
Now we will use a blendshape node to blend between these two groups to get the result. We will connect the nodes as follows:
Then we will choose the deformed ground GRP on the blendshape node group field. Also set the blend1 value to 1. 
We will get the following results:
We can always go back to adjust the peak nodes' distance value to refine the thickness of the groove.

Let's add a smooth node to smoothen out the ground. We can also increase the subdivisions on the ground plane at this point as well.
We get a very swampy feel for the ground in our result below:
We can cache out the effect and export as an alembic to render in Maya.
The two methods discussed here are how we can create footprints or tire tracks effect inside Houdini and we can combine these effects with particles (or grains) simulation to simulate the effect of sands.
HOUDINI - FOOTPRINT/TYRE TRACKS
Published:

Owner

HOUDINI - FOOTPRINT/TYRE TRACKS

Published: