Lesson 10: Shader Basics
After modeling a scene you can apply attributes such
as color, texture, transparency, and reflectivity
to objects to achieve photorealistic results. These attributes are created
using shaders to create realistic looking materials to assign to objects.
Shaders are kept in the Multi-lister, an important
window that displays shaders, lights or forces, or all of these at the
same time. The Shader mode of the Multi-lister is used in this lesson as
you begin working with shaders and their various parameters.

In this lesson, you create shaders for all parts of
a fruitbowl model and assign these shaders to the objects. At the end you
quick render the scene to see a test of the results.
Note: In lessons 10 through 13 you will
continue working on this model to add more sophisticated shaders, lighting,
and some animation.
Initial setup
A file has already been prepared containing the fruitbowl
model. Start by opening it and performing a quick render.
Clear the workspace and retrieve a wire file
- From the Alias File menu, select Open.
- In the File Browser, click the Show List button.
- In the CourseWare project folder in the File Lister, double-click
the L10_Fruit1 icon to retrieve the wire file. If a confirm box
is displayed, click YES to delete all objects, shaders, views
and actions.

Four windows are displayed. Each window shows a
bowl on a tabletop containing an apple, a banana, and an orange.

QuickRender the scene
- Click in the Perspective window to make it active.
- Select Quick render from the Alias Render menu.
All the objects are rendered in blue to show that they are using the Alias
default shader.
- Click anywhere in the QuickRender window to close it.
Creating and assigning a new shader
Next you create a shader for the apple.
Open the Multi-lister
- From the Windows menu, select
Multi-lister
Shaders.
The
Multi-lister displays the default Environment and Shader
icons. The menus at the bottom contain relevant shader functions.
Tip: To find out more about the buttons
and menu items found in the
Multi-lister, click on the question mark in the title bar. This opens Netscape
where you can access the information you need from the Alias Reference
material.

Make a new shader
- Select New Shader from the Edit menu in the Multi-lister.
New shaders are copies of the default shader.

Tip: You can delete any shader, except
the DefaultShader and Environment shader, by clicking on
it to make it active, and then selecting Delete
Active from the Multi-lister menu.
Rename the new shader
Double-click on the default shader's name and press the Esc
key to clear the existing text.
Type Apple and press Enter.
Note: Both mixed case and lower case names
are used for shaders in this series of lessons.

Pick the apple object
In this lesson, the objects have already been named
and can be picked by name.
Tip: You can also name objects using the
Information window (Windows
Information
Information
window).
Make sure the Apple shader icon has a white border to indicate
that it is the only active shader.
Select Pick
Object from the Tool Palette and type apple
in lowercase at the prompt line.
Press Enter to pick the apple.
Assign the shader to the object
With both the Apple shader icon and apple object active,
select
Shading
Assign
Shader from the Multi-lister menu to assign the shader to the apple.
Note: You can also create shaders and not
assign them to objects. However, only assigned shaders are displayed when
you render the scene.
Editing shader parameters
You can edit some of the shader parameters to create
the look you want using the Shader and Color editors.
Open the shader editor
- Double-click the Apple shader icon to open the Shader editor.
Tip: You can also open the shader editor
by selecting Edit
Edit from the
Multi-lister menu.
Edit the shading model and shader color
- Select the PHONG shader from the Shading Model pop-up
menu at the top of the Shader editor.

This gives the Apple shader icon a shiny,
reflective appearance, and displays parameters such as specularity, shinyness,
and reflectivity in the editor.
- In the Common Shader Parameters section, click once on the blue
color sample next to the Color parameter to open the Color editor.

Tip: You can also open the Color editor
by selecting Edit
color from the Multi-lister menu.
In the Color editor, drag the R slider to 255, and the
G and B sliders to 0. This changes the Red, Green
and Blue values to define a new red color.

Notice that the Apple shader icon in the
Multi-lister has turned red. In another lesson, you will make this shader
even more realistic by adding a texture map.
Keep the two editors open while you proceed.
Copying a shader
To create a shader for the orange, you can copy the
apple shader. This lets you create the orange shader more quickly.
Copy and rename the apple shader
- With the Apple shader active, select Edit
Copy from the Multi-lister menu. This creates a copy of the
Apple shader.
- Double-click on the name Apple#2, press the Esc key to clear
the name, then type Orange to rename it.
Assign the orange shader
With Nothing
picked, select
Pick
Object
from the Tool Palette and type orange when prompted.
- With both the Orange shader and orange object active, select
Shading
Assign
Shader to assign the shader to the orange.
Edit the shader's reflectivity and shinyness
Leave the Orange shader's Shading Model at PHONG.
Double-click on the Shinyness value in the Shader Editor and
change it to 5 to make it less shiny than the apple.
Oranges are not as reflective as apples, so change the Reflectivity
value to 0.1.

Edit the shader's color
In the Color Editor, click on the value next to G and
type 150 to change the color to orange.

Note: In another lesson, you'll make this
shader bumpy by adding a texture map.
Use the arrows to choose the different shaders
Editors always contain the most current parameters
set for an active shader. The Shader and Color editors now contain the
parameters for the Orange shader.
Tip: To move from one shader to another,
click on the left and right arrows on the Shader editor's title bar, or
use the keyboard arrow keys while holding the Shift key. However,
if you have many shaders, you may find it easier to select the shader icon
in the
Multi-lister.

Copying shader parameters
Next, you create a shader for the banana and copy
some parameters from the Orange shader.
Create and name a new shader
Select Pick
Nothing from the Tool Palette to de-select active objects
or geometry.
- Select Edit
New Shader from the Multi-lister menu.
- Double click on Shader#2 and press the Esc key to clear the
name. Type Banana. Notice that the icon moves in the Multi-lister
so all shaders are listed alphabetically.
Edit the shader's color and assign the shader
- In the Color Editor, change the RGB values to 255,
215, and 70 to make the shader yellow. In a later lesson,
you edit this shader to create a label for the banana.
Select Pick
Object from the Tool Palette, type banana and press
Enter to pick the banana.
- Select Shading
Assign Shader from the Multi-lister menu to assign the new
shader to the banana.
Change the shading model of the banana shader
In the Shader editor, change the shading model to PHONG. By
doing this, you can copy the reflectivity and shinyness values from the
Orange shader.
Copy the desired shader parameters
In the Multi-lister, click the Orange shader icon to select
it.
In the Shader editor, press the Shift key and click on the
names Shinyness and Reflectivity. The background color
behind the names changes to gray.
With the Shift key still pressed, click on the Banana
shader in the Multi-lister. It is highlighted in gray.

Now select Edit
Copy Parameters from the Multi-lister menu to copy the selected
parameters to the banana. Click on the Banana shader to confirm
the copy.
Press the Shift key and click on Shinyness and Reflectivity
in the Shader editor to de-select them.
Close the Shader and Color editors
Click the close box icon in the top left corner of
both editors to close them.
Editing a shader from the Multi-lister
Next you copy the apple shader to create a new shader
for the tabletop and then edit the various attributes of the shader icon.
Create and rename a new shader
Select Pick
Nothing from the Tool Palette to de-select active geometry,
then click on the Apple shader in the Multi-lister to select it.
- Select Edit
Copy from the
Multi-lister menu to copy it.
- Double-click on the name Apple#2, press the Esc key, type
Table and press Enter.
Edit the shader's color
Pressing the Alt key while you click on areas of
the shader ball opens the Color editors for the different parts of the
shader without having to open the Shader editor.
- Press the Alt key and click on the shader ball where the red
is darkest (but not in the shadow area).

- The Table shader's Color editor is displayed. The title bar
of the Color editor reads Table: Color.
- Press the Alt key and click on the white highlight on the shader
ball. The Color editor's title bar reads
Table: Specular.
- Press the Alt key and click on the shadow area of the shader
ball. The Color editor's title bar reads
Table: Incandescence.
- Press the Alt key and click on the red area to return the Color
editor's title bar name to Table: Color.
- Change the R value of the shader to 0 and the G
value to 51 to create a dark green color.
Tip: You can also click-drag on the highlight
to interactively change the highlight size.

Assign the shader
Select Pick
Object from the Tool Palette and type table to make
the table object active.
- Select Shading
Assign Shader in the Multi-lister to assign the shader to
the table.
Importing a transparent shader
You can import and work with shaders created for other
projects. This means you can create a library of shaders that can be re-used
as needed. A glass shader has already been created, which you can apply
to the bowl.
Importing an existing shader
- Select File
Shader Browse from the Multi-lister menu to access the shader
directory.
- In the File Lister, click on the Bowl shader icon, then click
the Load Shader button in the File Browser. The Bowl shader
is displayed in the Multi-lister. You'll add a texture
map to this glass shader in a later workshop.
Tip: Alias comes with many predefined shaders
that can be found on the 3DCD. You can use these shaders in your own work
to quickly render photorealistic images. You should take a few minutes
after this lesson to examine some of the 3DCD shaders and look at how they
were made.
Assign the shader to the bowl
Select Pick
Nothing from the Tool Palette, then select Pick
Object and type bowl at the prompt line to pick the
bowl in the scene.
- Select Shading
Assign Shader to assign the Bowl shader to the bowl
geometry.
Adjust the size and position of the Multi-lister
Select Pick
Nothing from the Tool Palette. There are now
seven shader icons in the
Multi-lister: Environment, Shader, Apple, Banana,
Bowl, Orange, and Table.

If there are more shaders listed than you can see,
use the scroll bar at the left of the Multi-lister window, or resize the
window by dragging at the corners.
You can also change the icon display to list by name
or by a smaller icon. To change the display mode, click on any of the three
small buttons on the Multi-lister title bar (text, small sphere, larger
sphere).

To see the objects and surfaces an active shader
is assigned to, select Shading
List Objects.
Try clicking on some shaders to make them active,
and notice how the object list changes.
Editing the Environment shader
Now that the shaders are set up for all the objects,
you can create the scene's background using the Environment shader. The
Environment shader lets you assign a color or a pix file to the scene background,
as well as other 3D environment effects such as fog and textures.
Open the Environment editor
- In the Multi-lister, double-click the Environment shader icon.
The Environment editor is displayed.

Edit the Environment's color
- Click once on the color sample next to Color in the Background
section.
- In the Color editor, use the RGB or HSV sliders to define
a new background color.

Notice that the Environment icon in the Multi-lister
automatically displays the color you choose.
Minimize the Shader and Color editors
Click the Minimize button in the title bar of the editors.

This turns the Environment and Color editors into
Alias icons that you can move into a convenient place on your screen.

To reopen the editors, click the icon.
Quick Rendering
In this section, you can use QuickRender to evaluate
the scene with the new shaders.
Note: While a quick render shows
a preview of the rendered scene, subtle qualities, such as reflectivity
and shinyness, are not displayed. To evaluate these qualities, you must
perform a full rendering.
QuickRender the scene in the Perspective view
- Click in the Perspective view to make it active. The active window
determines the initial quick rendered view.
- From the Render menu, select
Quick render. A new QuickRender window is displayed on top
of the Perspective view.

- Click anywhere in the QuickRender window to close it.
QuickRender with different render options
- From the Render menu, select
Quick render -
to open the
Global Quick Rendering Parameters window.
- Click the Background toggle to display the background color
instead of the ground grid, and click the Turbo Assist toggle to
render the transparency of the bowl.
Note: Turbo Assist uses the hardware
rendering, which offers faster rendering and transparency. Lighting, however,
is different from a normal QuickRender and some features won't display.

Click the Go button. The following is displayed:

Click anywhere in the Quick Render window to close it.
Display the scene's lights in the Multi-lister
When you QuickRender a scene without defining lights,
default lighting is added automatically. You edit the scene's lighting
in Lesson 11.
To see these lights, select List
Lights from the Multi-Lister menu. Two icons displaying a
directional light and an ambient light are displayed.

More QuickRender options
QuickRender has a complete set of options. For example,
you can keep the Quick Render on the screen and render only a part of it.
QuickRender the scene with Persistence toggled on
- From the Render menu, select
Quick render to Quick Render the scene again.
- Click the Options button located on the QuickRender window's
title bar to display the pop-up menu and select Tgl Persistence.

- When Tgl Persistence is checked, the QuickRender window does
not disappear at the next mouse click. To de-select a checked option, click
it again.
QuickRender the Right window
- Open the Options pop-up menu again and select Lock Source Window
to turn this option off.
- Click in the Right window to make it active and click again in the
QuickRender window. The rendered scene is updated using the Right window
as its source.
Note: QuickRender always renders in the
active window, unless Lock Source Window is checked on in the Options
menu. For example, if Lock Source Window had been checked when the
Perspective window was active, the Perspective view would always be quick
rendered, no matter which window view was subsequently selected.
Move the QuickRender window
Move the QuickRender window down slightly to show the Perspective window
underneath.
Click in the Perspective window to make it active again. When you click
next in the QuickRender window, the image is in the Perspective view.
Tip: A handy way to QuickRender only a portion
of a scene is to use a bounding box. Drag the cursor diagonally in the
QuickRender window to create a box around the view area. That area quick
renders and displays a bounding box around the re-rendered area.

This is useful when you have changed an object's
shader and you only want to re-render the area containing that object.
To return to regular QuickRender mode, click outside
the bounding box.
Close the QuickRender window and Multi-lister
To close the QuickRender and Multi-lister windows,
click the close box in each window's title bar. You may have to maximize
the Shader and Color editors to close them.
Save the model
From the File menu, select Save as
to save this file in your CourseWare project. Name it myfruitbowl2
so you can use it in the next lesson.
Conclusion
In this lesson you have learned how to:
- create a shader
- edit a shader's parameters
- edit a shader's color
- copy parameters between shaders
- import a pre-existing shader
- QuickRender your scene. In the upcoming lessons you'll
add texture maps and lighting effects to this fruitbowl.
aliasdocs@aw.sgi.com
Copyright © 1997, Alias|Wavefront, a Silicon Graphics Company.
All rights reserved.