|
|
The default interface layout is currently
optimized for a display resolution of 1600x1200.. Therefore, if
your not at this resolution, reposition each ShaderWorks toolbar
windows to what you like and when you exit the program it will save
these settings for next time.
On the
left upper side, you’ll see a sphere showing the default material.
This is called the Preview. If you right click your
mouse and drag, it will zoom in and out. If you left-click your mouse
and drag, it will rotate the camera around the object.
You
may choose a new mesh or skybox background by selecting from these
two buttons shown in this next image. Like I said earlier, some meshes
dont' have UVs in them and will not display the mateials properly,
so to be sure, stick with Sphere.x, Face.x or Torus.x for now. As
for background materials, click the second button circled in red and
you'll be brought to all ShaderWork's collection of textures. go into
Cube Maps or Cube Maps (HDR) to choose a cube-map.

This next image shows the effect's (material) structure.
Globals holds any global settings that are used across
each effect or rendering pass. Techniques are basically
sub-materials. These effects are comprised of techniques so that if
a specific hardware does not support for example pixel shader 2.0,
then it could attempt to use the next technique in the list. Typically,
in a good material, you would create a high-end technique, for next-generation
hardware, then a fallback technique which you would attempt to make
look the same, but would code it to work on middle-end hardware. Then
you would probably have a base technique, which most or all hardware
can handle just in case. You would try to make each technique as similar
as possible.

Now each technique is comprised of 1 or more rendering passes.
For typical mateials, you only need one rendering pass. But for
some materials, like Fur, you need to re-render
the same object multiple times to simulate the fur. There for you
can right click on the rendering pass and make it render a specific
amout of times. Each rendering pass in this type of material would
be treated differently in your actual shader.
Now, each rendering pass is comprised of a vertex shader and a
pixel shader. The vertex shader performs it's calculation on each
vertex using data from the mesh and user constants. Once that is
done on the GPU, the vertex shader passes any of it's calculated
data to the pixel shader. The pixel shader then performs it's calculations
on a per pixel basis using data from the vertex shader, textures
and user constants. So when you hear me speak of doing per-pixel
materials, that simply means most of my calculations are being done
in the pixel shader because it is more precise than doing them on
the vertex shader, but is slower. As you can see in this next drawing,
this is the WORKFLOW of a shader based material.

Right click on any of the items in this material tree and you will
have more options to edit, move, rename, copy and set specific settings.
This next image shows the debuging window. While coding
or making any changes to the shader graph, you'll be able to view
any errors that have occured while ShaderWorks attempts to compile
the HLSL shader.
This next image shows the output or compiled code.
This is what ShaderWorks is great at. Creating the final HLSL shader
code for you. As shaderworks is a graph based editor, you cannot directly
edit this code, but you can view any changes that are being made in
real-time and just like Visual C++, there will be a small grey pointer
on the left hand side of the code indicating where the errors are.

This is where the fun is... This is the material library.
If you double click on any material, it will make that material the
current material and allow you to edit it's settings. You can righ
click on the material and there will be many options. Also, if you
right click anywhere in the material editor, but not on a material,
you will be given the library tools, so load, save, delete, rename,
etc.. Scroll down and discover all the materials. We have many here,
and these will be fully optimized by monday with the addition of some
new exciting anisotropic and anisotropic fur materials I've benn working
on.
Here, in the bottom right, is the performance stats..
This is pretty straight forward. They do not change unless you click
on the preview window. To increase GUI performance, ShaderWorks only
renders to the preview window when you make changes, edit code, or
rotate/move the object.
This next control bar is a list of all the variables that the shader
makes available for "tweaking". This is up to the developer
to expose which values he would like to make "editable".
Editable values can then be exposed in other applications or games
using these materials. This is more or less for the artists. For
example, in this material, you can change the BUMP amplitude (height),
the bump texture, the scale, etc.. You can expose any variable or
constant or texture.
This next control bar is one of the most important.
It contains all the Rendering States, Texture States, and Texture
Sampler States. Each rendering pass has a set of Render States. Each
Texture block has a set of Texture States, and each sampler block
has a set of Sampler Texture states. These values are a bit more complicated,
butallows you to tweak things like mip-mapping, alpha blending, shading
and so forth. We won't get into these settings just yet.
Ok, now you know your way around ShaderWorks. Now
on to the heart of the software. What you see here is the vertex shader.
You can click on the tabs (indicated in blue) to
change from vertex to pixel shader. The flow of the material graph
goes from LEFT to RIGHT.

The graph is made up of many BLOCKS.
Each block has input and output nodes. These nodes can be linked together
to great your graph flow. You can only link nodes that are the same
type. Types include, floats, integers, bools, matrices, vectors, and
textures. Each node can be edited by right clicking on the node.
Each block can be any of the following types.
-
INPUTS - When used in the vertex
shader, would be object vertices, normals, uv coordinates etc.
When used in the pixel shader they would be inputs being passed
through from the vertex shader..
-
OUTPUTS - When used in the
vertex shader, would be any of the 8 vector variables to pass
to the pixel shader or the final transformed vertex or fog values
which would be passed to the pixel pipeline).
-
CONSTANTS - As mentioned before,
each vertex and pixel shader has a set amount of constant float
vectors that can be set by the user or the application that
are passed to the shader when rendering and used to change the
results of the shader. For example you can change the "brighness"
constant of a metal shader at run time and you will see the
results instantly as the shader does not need to be recreated.
They calculate using these dynamic constants.
-
FUNCTIONS - These are the heart
of the graph. To complete a shader successfully, you must follow
the flow. Link vertex shader inputs -> Functions
-> vertex shader outputs then in the pixel shader,
you would link the pixel shader inputs -> Functions
-> pixel shader output. These functions can have
as many inputs or outputs as the user wants.
-
TEXTURES - Textures are used
only in the pixel shader and are sampled using sampler blocks
and UV coordinates.
-
SAMPLERS - Samplers are used
to sample textures in the pixel shader using the linked UV coordinates.
You may edit settings of any of these blocks by right clicking
on the top bar of the block.
Although ShaderWorks compiles the final shader, you are still able
to modify function code directly. Right click on the block's top
(highlighted in bluc) and choose to "Edit HLSL function".

Here is the window you'll see. This is the function
editor which allows you to code directly to your shader. The best
thing to do to get used to things, is to try modifying functions from
the materials provided with ShaderWorks. As shown in blue, the "auto-compile"
feature is enabled, so go ahead and type in some code. You will notice
that the obejct will not render, the debug window will show an error,
and a grey tab will appear next to your error line.
Here is this function modified... with errors
Here is what a complex function would look like...
Now you'll need to know how to code HLSL wich is very
similar to C or C++, but has it's own intrinsic functions to choose
from. You can create shaders using pre-built blocks and not deal with
any code, but currently, there is only about 20 functions to choose
from and there will be much more included shortly. Any 3D coder or
shader developer will be able to easilly edit this code.
CONCLUSION
For now, it will take you a little while to get used to ShaderWorks,
especially if you've never used any shader development program out
there. You may load our pre-built materials and learn from them
which is the best way to go.
|
|