Before You Begin

This tutorial is a follow-up to the Render An Image tutorial. In the "Render An Image" tutorial, you downloaded and modified a pre-built shader. In this tutorial, we will learn how to create that shader, starting with one of the default volume shaders provided by Houdini.

Set up the Scene

If you already completed the "Render An Image" tutorial, you can continue working from the scene file you already created. Simply delete your "sample_shader1" node in the shop Network View, because we will be creating this anew.

If you are starting from scratch, open up Houdini. Put your cursor over the Network View, and press TAB on your keyboard to open up the TAB Menu. Type "geometry" and put down a Geometry node. Double-click to step inside the node, and point the File node to the Isolated Galaxy data set. Put your cursor over the Scene View and press the G key on your keyboard to center the view on your object. If you are having trouble with these steps, please re-visit the beginning of the Render An Image tutorial.

Your Houdini scene should look like this.

Create a Shader

We will now apply one of Houdini's default volume shaders, called the "Billowy Smoke" shader, to our volume. We will then modify it slightly to fit our needs.

To get access to Houdini's defualt shaders, select the "Material Palette" tab in the Network View window.

On the left side of the Network View window, scroll through to find the "Volume" gallery, and select "Billowy Smoke". Press the arrow button to load the selected Billowy Smoke gallery entry into the scene. The "Billowy Smoke" icon will appear in the window.

Return to the "/obj" tab in the Network View window. If you are in the "obj/geo1", click on "obj" to step out into the object view. Make sure your "geo1" node is selected (it should have a yellow highlight around it).

In the Parameters window, select the "Material" tab. Next to the "Material" text area, click on the node browser button.

This will open up a small window, showing you your material node(s) in a tre view. Select the "billowysmoke" material, then click "Accept". This now assigns the Billowy Smoke shader to your geometry.

We now have all of the pieces to render an image. At the top of the Scene View window, locate the "Render View" tab and click on it. Click on the "Render" button, and an image will appear in the Render View. If you don't see the cube image, click on the "Render" button.

We rendered something, but it's not very pretty, is it? Let's go back and modify the shader. Let's add color and opacity to our gray cloudy data cube, in order to focus on the interesting data, and get meaning out of it. By leaving the Render tab open, we can preview our changes immediately, so iteration is quick and easy.

In the Network View, select the dropdown menu that currently says "obj", and select "shop" (which is short for "shader operation").

You should now see the "billowysmoke" node.

Since our data is self-luminescent, the first thing we want to do is to remove the diffuse component of the volume's color from the default shader. To do this, in the Parameters view, set "Smoke Intensity" to 0, un-check "Use Smoke Color" and "Use Point Color", and set "Smoke Color" to black by entering 0 0 0 as the R G B values. This will make our volume disappear from the Render View.

To add color back to our volume, in the Parameters view, select the "Temperature" tab. In Houdini, the Density tab drives opacity, and the temperature tab drives the data's self-illuminating brightness and color.

In the "Temperature Field" text area, type in the name of the variable in your data that you want to drive the color. In the case of our IsolatedGalaxy.vdb sample file, we only have one variable called "density", so we use this to drive both the density and the temperature.

Typing this in will apply the default temperature color map to our data, resulting in a solid red cube.

Next, we want to tie the data's min and max values to the low and high end of the color map. To do this, we need to step inside the billowysmoke node, by double-clicking on it in the Network View. This will show us the nodes that this shader is made of, which we can then edit or add to.

Locate the purple "density" and "temperature" nodes.

We want to correct the data range for these two parameters. To do this, we will put down a "Fit Range" node, which will re-map the data range to 0-1, which is what the color map expects.

Put your cursor over the Network View and press the TAB key on your keyboard to pull up the TAB Menu. Start typing "fit range" and select the "Fit Range" option, and click to place down the node.

First, we will work on the "density" node. Connect the "density" output of the "density" node into the "val" input of the "fit1" node that you just created.

We will use the output of this "Fit Range" node rather than the output of the density nodes, so we need to replace the appropriate connections. Connect the "shift" output of the "fit1" node to the two places where the output of the "density" node was orignally going, to replace it. I.e., connect it to the "volumemodel1" and the "multiply2" nodes.

Now, do the same thing for the "temperature" node. Put down a Fit Range node, and put it in the node network after the "temperature" node.

Now, we want to be able to easily modify the data range of interest. If we "promote" the data range parameters, we will be able to see these values in the Parameters view of our Billowy Smoke shader, without having to step inside the complicated inner network.

On one of your Fit Range nodes, middle-mouse click on the "srcmin" input, and select "Promote Parameter" from the menu.

Do this for the "srcmin" and "srcmax" inputs of both of your Fit Range nodes. You will see circles connecting to these inputs if you have done this correctly.

Now, step out of the inside of the Billowy Smoke shader, back into the SHOP Network View, by clicking on "shop" at the top of the Network View window.

In the Parameters view, scroll to the bottom of the window. You will see two sets of new parameters called "Minimum Value in Source Range" and "Maximum Value in Source Range", which are the four parameters you just promoted. The default values for each are 0 and 1, respectively.

Play with these values until you get something that looks nice in the Render View window. Just changing the density minimum to 0.2 creates something cool.

Scroll up in the Parameters window and have fun with the color map too! Adjust the color map, mins, and maxes until you get something you're happy with.


Python SOP data loading

Previous Tutorial

More about Cameras

Next Tutorial