Skip to content

Example use of the Attribute Randomize node in Houdini

This is a quick example of how to create the below effect using the Attribute Randomize node in Houdini.

To start off, create a sphere object in the global network and double click to expand it.

Select the sphere1 node and update the ‘Primitive type’ property to ‘Polygon’, this will provide more detail (primitives) to work with:

To add further detail, increase the frequency value in the sphere properties:

Press Tab and create an ‘Attribute Randomize’ node and connect the sphere to its input, you’ll notice a change in the object in the viewport:

Update the attribute class dropdown in the randomize nodes properties to ‘Primitives’ to apply the random colours to the faces of the object:

You may be wondering why the attribute randomize node has applied random colours to our object and not any other type of modification, by default Houdini will apply the ‘Cd’ attribute name as a base for the randomize node, and ‘Cd’ refers to the colour property:

Now create a poly extrude node and connect our randomize node to its 1st input, then move the display flags over to this new node:

Change the ‘Divide into’ dropdown to ‘Individual elements’ as we want each extruded face to be disconnected from the others:

The reason we did this is because we are now going to extrude each of the faces by its ‘colour’ value, for example the dark blur primitives will be extruded to a different distance as the yellow primitives.

To do this we first need to extrude all of the primitives by a noticeable amount (0.7):

Then under the ‘Local Control’ tab, enable the ‘Distance Scale’ option, and enter ‘Cd’ in the text field:

What is actually happening

You may be wondering what’s actually going on at a calculation level?  The Dimension scale value is being multiplied by the Distance (Cd).  Looking at the result we can see that the reds are extruded further than the blues:

This is because the ‘Cd’ value for reds is greater than the Cd values for blues (I’ll try and find out how to discover these actual values).

Adding more details

Next we will add more detail to our extrudes by increasing the divisions:

Increase the twist value to twist the extruded primitives:

At the moment this doesn’t look very tidy as the twisted primitives are overlapping, to fix this click on the ‘Extrusion’ tab, enable the checkbox and scale the extruded primitives down (0.4):

This is a good point to make adjustments to the extrusion distance to get abetter effect, I have increased it to 0.291:

This is looking great, but we have very sharp edges, we can smooth the object by adding a ‘subdivide’ node and connecting it to the end of our network stream, this essentially adds more details by increasing the points and primitives:

Removing the colour

Remember we used the colour value to define the extrusion distance, but what if we don’t actually want the colour to display?

This can be done by creating an attribute delete node, connecting it to our stream and specifying the colour attribute (Cd) as the thing we want to delete:

If we take the time to look at the detail of our object, you’ll notice that ‘some’ of the primitives didn’t get extruded by much, this is because the Cd (colour) value for that primitive was very close to 0:

This can be adjusted by going back and defining a min and max value on the randomize node:

Published inHoudiniNetworkObjects