Create
a New Textured Shader
In the following lesson,
you will learn how easy it is to use a procedural approach to texture
the body of a snail.
Part
One: Prepare the Basic Network
This lessons starts with
the snail_start.hip file that contains geometry for a snail that
already has its shell and eyeballs textured. This lesson will focus
on the main body which needs a shader that matches the detail found
on the rest of the character.
1.
Change Desktops
Select Desktops
> VEX_builder to go to a desktop view that
shows a configuration of panes that is designed to help you set
up the shader. The upper left pane should be a Viewer pane set to
vops. This will display the shader ball. The upper middle pane should
be a Parameters pane set to vops and the lower pane should be a
network pane set to vops. The upper right pane should be a Viewer
pane set to Objects
so that you can test render using the complete snail.
2.
Create a new Surface Shader
In the network
pane, press tab > VEX Surface
Shader. Click in the network pane to place the
vex operator (VOP). Change its name to body. With this selected,
press i to go
into the shader. Press h
to center the output node. Every vex shader has an output node that
cannot be deleted.
3.
Define the Lighting Model
In the Network
pane, type tab > Materials >
Lighting Model. Click in the Network pane to
place the operator. The materials list gives you a number of high
level shaders, such as skin, already prepared with their own network
of operators. By starting with the Lighting
model operator, you will get to build up your
shader from scratch. This node define the network's shading properties,
such as specularity.
4.
Connect the Lighting Model
Click on lighting1
> color output and connect it to the output1
> Cf (surface color) input. The shader ball updates.
In the Parameter pane, change the Diffuse
color to a pinkish
hue to create the snail skin base color. Now
set your Specular color
to white and
the U Roughness
to about 0.1
to strengthen the specular highlights.
5.
Test the Shader
Drag the output1
VOP onto snail body in the 3D Object view. This turns the VOP network
into a shader operator (SHOP) and assigns it to the snail's body.
In the Objects view pane, press
tab > Render. Click-drag a bounding box over
the part of the snail you want to preview. This area is rendered
using Houdini's Mantra renderer.
You can see
the pinkish surface material starting to take shape. Now you want
to add more subtle detail to add realism to the character. The SHOP
that was created here is a higher level shading tool that uses vex
code to add color and texture to objects. An animator might assign
SHOPS to objects while a texture artist uses vex (VOPS) to create
the shader.
Part
Two: Adding Detail
The shader has been built
using a couple of vex operators. You will now add more operators
to refine the material. Some of these operators are actually networks
that have been collapsed into a single node. Houdini lets you dive
into these subnetworks to view and edit the low level operators.
1.
Add a Bump Map
In the network
pane, type tab > Displace >
Cellular Cracks and place the operator. Next
type tab > Vector > Normalize.
Place this operator between the cellcracks1 VOP
and the lighting1 VOP. Click on cellcracks1
> dispN (displace normal) output and connect it to the
normalize1 > vec input then connect the normalize1
> nvec (normalized vector) output to the lighting1
> nN (normal vector) input. The normalize VOP was used
to make sure that all the normals have the same value in order to
give the whole surface a coherent look. This step is important when
adding a bump map to a lighting model.
Retest the render
in the Object viewer pane. Now play with the Cellular Crack parameters
such as cell frequency
to get the look you want. This prebuilt operator offers a great
pattern when applied as a bump map.
2.
Rewire the Cellular Cracks VOP
To add a sense
of depth to the cracks, a sublayer of veins can be added by entering
into the Cellular Cracks VOP and adding more low
level control. Select the Cellular Crack VOP and
press enter
or i. Now press
h to see all
of the operators that make up this VOP. These subnetworks offer
a great way of learning how the lower level VOPs can be combined
to create particular effects.
Type tab
> Combine > Multiply and place the operator
near the suboutput VOP. Click on the square with three dots on primarycells
to expand the visible parameters. Connect the primarycells
> dist1 (Distance to closest point) output to the multiply1
> Input1. Next connect the secondarycells >
dist1 output to the multiply1 > Input2.
Now connect the multiply1 > product to the suboutput1
> amount. This parameter will be used as an output for
the cellular cracks VOP. Press u
to go up out of the cellular cracks subnetwork.
3.
Create a Parameter
MMB-click
on the lighting 1 > diff input and select Create
Parameter. This creates a parameter VOP named
diff that contains the pinkish values set earlier.
A parameter VOP is very powerful because it becomes an editable
value at the SHOP level. This makes it possible for texture artists
to reveal some values that can be adjusted at the SHOP level without
diving back into the particulars of the VOP network.
4.
Mix Colors
Type tab
> Combine > Color Mix and place the operator
between the diff VOP and the lighting1
VOP. Connect the diff > diff output to the colormix1
> primary. MMB-click
on the colormix1 > sec (secondary)
input and select Create Parameter.
This will allow you to edit both colors later at the SHOP level.
For now click on the secondary VOP, click on the Color
tab in the Parameter pane and change the color
to a shade of red.
5.
Use Cellular Cracks for Mixing
Connect cellcracks1
> amount to the colormix1 > bias.
Next connect the colormix1 > color output to
the lighting1 > diff input. Now the multiply
VOP set up within the cellular crack subnetwork is defining the
mixing of the red and pink colors. The skin is now pinkish while
the relief areas are reddish.
6.
Add Noise to the Bump
To give the
surface of the skin a rougher look, you can add some bump noise.
Type tab > Displace > Bump
Noise and place the operator to the left of
the cellcracks1 VOP. Connect the bumpnoise1
> dispN (displaced normal) to the cellcracks1
> N (surface normal). This adds a little more randomness
to the displacement of the surface.
7.
Set the Rest Position
Because the
bump noise VOP works in 3D space, it will appear to crawl
on the surface if the snail is animated. You can lock this down
by adding a rest position VOP to the base of the
network. Type tab > ShadingUV
> Rest Position and place the operator to
the left of the bumpnoise1 VOP. Connect the restpos1
> restP output to the bumpnoise1 > P
input. Now the texture will be locked down when you animate the
snail.
Part
Three: Smoothing the snail's belly
Up until now,
the textures have been designed to cover the whole surface of the
snail evenly. To smooth out the snail's belly, you will add some
more VOPs then paint a smooth parameter onto the snail to determine
localized behavior. Since both the displacement and the red veins
are a result of the cellular cracks pattern, you can smooth out
the belly by controlling this part of the network.
1.
Create a Smoothness Parameter
Click on the
cellcracks1 VOP and press i
then h
to go into and home the subnetwork. Type tab
> Workflow > Parameter and place the operator
at the upper right of the network. Change its Parameter name to
smooth and the Parameter label to smoothness.
Now type tab > Generic > Complement
and place the operator to the right of the parameter
VOP. Connect the parameter1 > smooth output to
the complement1 > val.
Once you hook
this vop into the larger network, you will be able to paint a smooth
value onto the snail and it's complement will drive the look of
the belly.
2.
Connect the Smoothness Parameter
Now type tab
> Combine > Multiply and place the operator
to the right of the complement1 VOP. Connect the
complement1 > complem (complement) output to
the multiply2 > input1. Connect the displace_amount
> sum output to the multiply2 > input2.
Connect the
multiply2 > product output to the displacenml1
> amount. This allows you to control the displacement
with the smooth parameter. Also connect the multiply2 >
product output to the multiply1 > input3.
Now the vein color will also be affected by the smooth amount.
The network
you just built is designed to feed values from the smooth parameter
into different parts of the network. Now you can paint this parameter
on the snail's body.
3.
Create a New Attribute
Switch the network
pane to the Object level. Select the snail's body then press i
to go into the Geometry (SOP) level. Press tab
> AttribCreate and click below the
flip-normals SOP. Connect the flips-normals SOP
to the attribcreate1 SOP. In the Parameter pane
change the Name
to smooth and make sure that Class
is set to Point
and Type to
Float.
4.
Paint the New Attribute
In the Viewer
pane, press tab > Paint.
Press a to select all the geometry then RMB-click
to accept. In the Parameter pane, turn on Override
Color and add the name smooth
next to it. Now go to the SOP view pane and paint the new attribute
onto the snail's belly. The preview is set by default to infra-red
therefore the white color will be applied when the belly appears
red.
Re-rendering
in the object view pane will show the belly as smooth without the
veins. Only a bit of the bump noise is left to give a consistent
look overall.
Conclusion
With vex operators,
Houdini texture artists can harness the power of procedural shading
without losing the ability to create localized effects. By applying
a layering technique not unlike compositing, color and texture can
be applied to any object at varying levels of detail.
The fact that
these same networks can be used to build models or add detail to
particles only highlights the power of Houdini. This combination
of powerful results driven by an easy to use procedural interface
makes it easy for the artist to develop looks while retaining the
ability to make changes down the line. In a production setting,
this combination of power and flexibility is key to hitting deadlines
while achieving your creative goals.
|