Hi guys,
It's been a while since I last posted but things have been quite busy at work at the moment and I haven't had the time. So, finally here is a quick post about a topic I recently had a thorough look into.
The good old fashioned Attribute transfer, that most ancient and noble of nodes. Cornerstone of many a worthy build, saviour of FX artists across the land and probably one of the most useful nodes in the Houdini toolbox.
However, one of the things I realised recently was that despite using it for years and assuming that I knew exactly how it worked I actually had never taken the time to prove for certain how the underlying mechanics of the node actually work.
Distance threshold, Blend width & Kernel function
So, I made a very quick setup to visualise the effect of the transfer, particularly how the distance threshold, Blend width & Kernel function combine to effect the falloff of the transfer.
So quite simply I'm making an evenly spaced out row of points from the origin along the x axis, I then transfer an attribute called height across to them from a single point at the origin, I then copy a set of boxes onto the points and use the height attribute to govern their scale.y value.
Finally I do some colour and visualisation stuff to make the results more readable and view them from an orthographic camera:
So what I get is essentially a bar graph plotting the values of the transferred attribute.
So, without much further ado here is a gif demonstrating the maths behind the attribute transfer:
So, as we can clearly see the distance threshold (which in this case is set to 5) determines the maximum distance away from a point that the attribute is transferred at it's original value (in this case also 5). The blend width determines the additional distance at which the attribute is copied at a reduced value. That reduced value is in turn determined by the kernel function, as demonstrated below:
Kernel Radius & Max Sample Count
Another slightly mysterious setting on the attribute transfer node is the kernel radius function. In most situations the simple combination of distance threshold and blend width is enough to accomplish whatever effect you are after however there are occasions which require a more complex transfer.
As you can see this is a pretty basic setup, I've got 4 points with different colour attributes (Cd) and a grid, I then scatter some points over the grid:
and finally I use attribute transfer to transfer the colour from the 4 points onto my scattered points:
Beautiful.
In the previous example we are transferring a constant value from the single point onto the row of points. However what happens if we want to transfer an attribute with multiple values? The gif below demonstrates how the kernal radius parameter effects the transfer.
So here we are transferring colour (Cd) from 4 points onto a grid of scattered points. Each of the 4 points has a different colour value. As you can see with a kernel radius of 0 each point in the square simply takes the value of the nearest point being transferred from, this creates a hard border between the different values. As the kernel radius increases, the points begin to blend the different values effectively mixing or blurring the attribute.
Finally there is a parameter called "Max Sample Count" which works in combination with the kernal radius setting. What this attribute does is to determine how many different point to sample from, the gif below demonstrates this.
As you can see with max sample count set to 1 each point in the square only transfers from only a single point. As the sample count increases each point begins to blend from multiple sources.
This attribute combines with the kernel radius to determine values how to blend the values.
Hopefully that explains some of the basic functions of the attribute transfer node, it's a great node and gets used for so many builds it's hard to imagine life without it. However, it does have some limitations so, now that we understand exactly what the node is doing, how hard would it be to recreate all the functions in VEX and give ourselves some extra features to play with?
That is exactly what I intend do in the next blog post. . . . .
Once again thanks for reading and remember
Don't get mad
Get Vexed!
Commenti