Professional Documents
Culture Documents
This tutorial covers how to create a basic shader that allows synchronized tiling
of diffuse, specular, opacity, bump, and displacement channels. You will also
learn how to save shader presets.
Overview:
The shader we will be building in Shader Mixer will look like this when it is
complete. This is a reduced view to capture the whole structure of the shader.
Close-up views will be provided below.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 1
This is the basic shader provided by Daz. The Shader Mixer tab will create
this group of blocks by default when opened. If you select a surface in
DS3A with the default shader (e.g. a new primitive) and use the menu
command File-> From Scene... this is the shader that will be
loaded.
These are the additional bricks that allow an image to be specified to the
Diffuse Color, Specular Strength, and Opacity Strength channels. They will
not be generated by Shader Mixer by default, but if you add an image map
to these channels in a default surface and then load that surface from the
scene into Shader Mixer, these blocks will be automatically added. Note that we
have not added image bricks to all the possible channels, e.g. Specular Color.
You can add these later. I have edited the titles of the image blocks to make
them easier to identify (see below).
These are the blocks governing Bump and Displacement. Again, they are
generated by Shader Mixer only if an image has been assigned to the
Bump and Displacement channels. Note that Bump and Displacement are
governed by a separate Root brick. By default, Bump and Displacement
are not tiled. We will correct this below.
The last two bricks shown here link together the tiling of all the other
channels. The first brick is a standard Tiler brick. The Rotation brick is a
custom brick created by assembling other bricks and using the Group
function (see below). This brick can be saved to your User area and used
in other Shader Mixer brick networks.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 2
brick. So to create a starting brick network that supports all the Daz Default
Shader values, place non-zero, non-blank values in all channels. In this example
we will generate a shader that includes Diffuse Color, Specular Strength, Opacity
Strength, Bump Strength, and Displacement Strength. We will also briefly look at
how to include Normal maps in our shader.
B - Select the primitive object and surface. Either open the Scene tab and select
the object, then open the Surfaces tab and select the surface, or use the Object
Selection and Surface Selection tools (Available in the Tools menu)
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 3
C - View the Surfaces tab: View-> Tabs-
>Surfaces. Inside the Surfaces tab, be sure
you have clicked the Advanced sub-tab. In the
Surfaces Advanced tab, go through and assign
an image and value to each channel you want
to include in the Shader brick network by
clicking the downward pointing triangle next to
the file parameter. The specific image does not
matter. Here, I am using the no_pattern.jpg
image included with this tutorial, which is just a
small plain white square. I have assigned this
image to Diffuse Color, Specular Strength,
Opacity Strength, Bump Strength, and
Displacement Strength. I have also set the
Bump Strength, Displacement Strength, and
Reflection Strength to 100%. I included the
no_pattern.jpg file in the Normal Map
parameter, though we won't be doing much
with it in this example.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 4
The resulting network will look something like this:
This looks complex, but it's quite logical. When we examine just the first few
bricks, we can see that for every channel where we assigned an image, an
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 5
Image brick has been created, and all these image bricks have been linked back
to the same Tiler brick with the exception of the Bump and Displacement Image
bricks and the Normal Map brick.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 6
Step 2 - Editing the basic shader:
A - The Image bricks created by
Shader Mixer do not have unique
names. This doesn't affect the
function of the shader, but can make
the network confusing to work with.
You can give each Image Brick a
more meaningful name by using the
pulldown menu on the brick:
B - This is the Displacement section of the brick network, edited slightly for
clarity.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 7
bricks are rigged in series, and these accept input from Image Bricks. (By default,
the Displace-Standard and Image bricks load on top of one another, which
makes it difficult to understand this part of the shader network. I have
repositioned the bricks and renamed the Image Bricks to "Bump Image" and
"Displacement Image" to make them more obvious.) The Bump Image feeds into
the "Displace" parameter of the first Displace-Standard brick, which affects how
shadows are calculated on the surface, but doesn't actually alter the surface point
positions. (The N value is used to interpret which direction the point is "facing"
during the render, which affects lighting.)
The Displacement and Normal images feed into the second Displace-Standard
brick, which in turn feeds into the P parameter, which does affect the location of
surface points in the final render. Displacement and Normal also feed into the
first Displace-Standard brick and affect shadows. Reminder: Bump,
Displacement, and Normal are not visible in preview mode. They are calculated
during the render. By default, the level of brightness in the Displacement Image
shifts that point outward or inward perpendicular to the surface of the object at
that point, but this can be manipulated with additional nodes.
None of the bricks in the displacement section are connected by default to the
Tiler brick in the rest of the shader, but this can be corrected. Make sure the "S"
and "T" parameters are showing in the Image bricks (if they are not already
visible) by clicking the brick menu and selecting "Show Advanced." Then, drag
from the input Image brick S and T
parameters back to the Tiler S and
T outputs, respectively.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 8
C - You can save your shader network by clicking the "Disk" icon in the Shader
Mixer window. It can be useful to save this way while working on a shader
network. Note: saving your shader network does not apply the shader to your
scene or make it available in
your Content tab. See Step 3.
You can then close the shader tab or switch to a different layout so you can see
your working area.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 9
Step 4 - Adjusting the basic
shader:
A - Our current shader isn't very exciting,
because we still have the "no_pattern.jpg"
graphic selected for all images. Let's add
some images to several channels. Here, I've
added images in the Diffuse Color channel,
the Specularity Strength channel, the Bump
Strength channel, and the Displacement
Strength channel. I've also set Bump
Strength and Displacement Strength to
100%. I've switched the Opacity Strength
image to "none" to make the cube easier to
see in the preview window, and I've set
Reflection Strength to 0 to speed up renders.
The images are contained with this tutorial in
Runtime/Textures/zigraphix.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 10
B - Sample render - Try experimenting with the tiling settings ("Horizontal Tiles"
and "Vertical Tiles"). You'll see that you can change the size of the pattern in the
final render, including all the components of the texture, but you will not see the
change before the render. Scaling changes are not displayed in the preview
window.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 11
While you can customize the shader preset to include only certain settings, e.g.
the scale parameters, it is simplest to record all parameters. You can save the
.dsa script anywhere, but it makes the most sense to save it into a subfolder of a
Content folder defined in your Daz Studio Preferences. It will then show up in
your Content tab.
This script can be used and re-used in many ways. You can alter different
parameters and save Shader Presets with specific colors, image maps, and
strengths for the various channels.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 12
Step 6 - Adding to the basic shader:
Let's add one more feature to our shader. As it is now, our shader can apply any
pattern tiled across a material zone, and the tiler brick includes the functionality
that allows us to scale along horizontal and vertical (u and v) axes, but the
pattern is always in the same orientation. We want to be able to rotate the pattern
within the scene. For this, we will use a special "Rotator" brick included with this
tutorial.
The Rotator brick is really a "grouped" collection of bricks that use trigonometric
calculations on each point in a tile to determine its rotated position:
Fortunately, you do not need to understand the calculations to use the brick. Just
load it into your shader by right-clicking (Ctrl-click on OSX if you have a single-
button mouse) in the brick network:
Right-Click
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 13
Note: The tutorial installer should have added this brick to your Insert Brick->User
context menu. You can also install it manually by copying the file rotator.dcb
to the appropriate directory. On Mac OSX, Shader Mixer saved bricks are stored
here by default:
/Users/[username]/Library/Application Support/DAZ
3D/Studio3/ShaderMixer/Menus
OnWindowsXP,thedefaultlocationishere:
c:\documents and settings\[username]\Application Data\DAZ 3D\Studio 3\
ShaderMixer\Menus
AndonVista/Windows7,thedefaultlocationishere:
c:\users\[username]\AppData\Roaming\DAZ3D\Studio3\ShaderMixer\Menus
Make sure the "S" and "T" parameters are showing in your Tiler brick (if they are
not already visible) by clicking the brick menu and selecting "Show Advanced":
Then plug the Rotator brick into your Tiler brick as shown:
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 14
Apply the modified shader to a surface in your scene as in Step 3, above.
You will now see a new parameter in your Surfaces tab, "Pattern Angle."
This parameter will allow you to specify the amount the pattern should be rotated,
in degrees (i.e. 0 to 360). Note: As with pattern scaling, you will not see the
rotation in the preview window. It will be calculated at render time.
Congratulations! You have now created a flexible tiling, rotating shader with
which you can easily apply textures and coordinated bump, specularity, and
displacement maps to any surface. As an extra bonus, several sample texture
sets with shader presets are provided with this package for you to experiment
with. Enjoy!
Remove all the various Image bricks except for one, and connect that one
Image brick to all the image inputs in your shader. Select a black and
white or grayscale image for that brick, and apply your shader to a surface
in your scene. Render.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 15
Invert some of the images by placing a "Math2" brick between the image
brick and the input of one of the other nodes, e.g. Diffuse or Specular
Strength. Put the value 1 into the first parameter and the Image node input
into the second parameter, and select "Subtract" from the Operation drop-
down menu.
Mix two images together using the Math Mix brick set to Layer Multiply.
DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 16