Você está na página 1de 16

Daz Studio 3 Advanced:

Basic Shader Mixer Tutorial


2010 Zigraphix

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 Reflection and Refraction blocks. If Reflection or Refraction


are set to non-zero values and an image map is assigned to Reflection
Strength and Refraction Strength on a default shader, these blocks will be
generated by Shader Mixer when the surface is loaded. By default, they
draw their image from the scene itself. It is also possible to pass in an image
using an Image brick, and this brick is generated if an image is assigned to the
Reflection or Refraction channels. There is a bug in the Shader Mixer handling of
Reflection images that prevents appropriate tiling of these images [see
https://bugs.daz3d.com/view.php?id=37757 for details], so they are not included
in this shader network.

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.

Step 1 - Generating the basic shader:


Although Shader Mixer can be used to create custom shaders "from scratch," we
will use a handy shortcut to start our shader network. Shader Mixer will
automatically generate a network containing bricks for any non-zero values
entered into the default shader surface when that surface is loaded into Shader
Mixer from the scene. Any zero or blank value in the surface will not generate a

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.

A - Create a new primitive

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.

D - Open the Shader Mixer tab. (View-


>Tabs->Shader Mixer [BETA]). The tab
opens with a Daz Default Material shader
network, but not the new one you want. You will
probably want to "dock" this tab and expand it
so it is occupying as much of the screen as
possible, to give yourself room to work.

E - In the Shader Mixer tab, use the menu command


File->From Scene...

Note: This is not the standard application File Menu.


The Shader Mixer tab has its own File menu. In the
popup that appears, Material will be selected by
default. Click "OK."

DazStudio3Advanced:BasicShaderMixerTutorial2010Zigraphix 4
The resulting network will look something like this:

Note: there are two


Image bricks here,
one on top of the
other.

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.

Because we set a Reflection Strength value,


but did not set an image for Reflection
Strength, Shader Mixer creates a Trace brick
to control reflection. This will take the scene
contents to generate reflection maps. If you
want to tie the reflection strength to the main
Tiler brick, for example to make specific
parts of a tiling pattern selectively reflective,
you can do so by inserting an "Image" brick
for "Reflection Strength" and dragging from
the S and T parameter inputs of that image
brick to the S and T outputs of the main Tiler
brick, but this will override the ability of this
shader to accept reflections from the scene.
You will need to create an image map to use
for reflections in this case (or use
no_pattern.jpg).

Note the column to the left


of the main Shader Mixer
View. We can display the "Brickyard," an
assortment of components that can be used
to build shaders, or we can see a preview of
what the Surfaces Advanced tab will look
like after we return to editing our scene.

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.

Again, it requires its own Displacement Root Brick. Two Displace-Standard

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.

Note: If you set a normal image


before generating your shader, a
Normal brick will be generated with
its own image parameter, and it,
too, can be connected to the Tiler
brick by using "Show Advanced" to
display the S and T parameters.
You can delete this brick if you
don't plan to use Normal maps with
your shader. Normal maps are
special images that use colors to
represent different directions of displacement from the surface. They can be used
to generate more detailed complex surfaces than displacement maps, but special
software is needed to produce them.

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.

Step 3 - Applying the basic shader:


A - To apply your new shader to an object in the current scene, first select the
surface of the object in the right-hand preview window (the Surface Selection tool
will automatically be set), then click the "Apply" button in the Shader Mixer tab:

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.

Note that since we didn't attach image bricks


to Diffuse strength, for example, it can no
longer take an image parameter.

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.

Step 5 - Saving a Shader Preset:


L - At this point, your work
can be saved as a Shader
Preset (which
automatically includes the
entire Shader Mixer
network and all your
selected images and
numerical settings).

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.

Here, I've created and applied several


different presets using the coordinated
diffuse, bump, and displacement maps
in the Dark Designs texture resources
by Laurie_S and Moyra.

You can also save Material Presets for


a prop or figure that will apply specific
shader preset values to each material
zone on the prop or figure. Note that
while Shader Presets can be applied to
any material zone of any object,
Material Presets are specific to a
specific object (a prop or figure).

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!

Here are some additional experiments you might like to try:

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

Você também pode gostar