Introduction to Computer Aided Modeling Instructor: Brent Rossen CGS 3220 Lecture 4 Shaders,...
-
Upload
hollie-preston -
Category
Documents
-
view
227 -
download
1
Transcript of Introduction to Computer Aided Modeling Instructor: Brent Rossen CGS 3220 Lecture 4 Shaders,...
Introduction to Computer Aided Modeling
Instructor: Brent Rossen
CGS 3220
Lecture 4
Shaders,
Textures,
and Light
Overview
Working with the menu-less UI Working with the Hypershade Creating shading groups Texture mapping an object Creating basic lighting Rendering a single frame
Getting Serious
So far we’ve been making use of numeric input fields, menus, and other UI elements. With this lesson, let’s pretend we’re hard core and hide all the menus while relying on the hotbox and hotkeys.
Open our file from last time Resave it as litGarage.mb
Turn off all menus
After we hide the menus, to access them we’ll hold spacebar to evoke the hotbox
Hold spacebar now, click on Hotbox Controls Select Window Options
Show Main Menubar: off Show Pane Menubars: off (windows only)
Display > UI Elements > Hide UI Elements Now we’ve got a much larger and cooler looking
workspace. Which should allow us to forget the computer and focus on Modeling and Animation.
Menu-less Navigation
Change the Panel Organization Evoke the hotbox by holding the spacebar Click the area above all the menus to apply the
north Marking Menu Select Hypershade/Render/Perspective Hypershade: where you build shaders Render: where you see the output You can drag the divisions between the windows
to change the size of each window
Menu-less Navigation Cont…
Each of the four cardinal directions in the hotbox has its own Marking Menu You can edit the contents of the Marking Menus
from Window > Settings/Preferences > Marking Menus
Open the attribute editor Display > UI Elements > Attribute Editor or Ctrl+a Use the attribute editor to update shading network
attributes. You can also access most of the same channels as are available in the channel box
Important Hotkeys
Spacebar: hotbox/window popping Ctrl+a: Show/hide attribute editor F: frame selected A: frame all Q: pick tool W: move tool E: rotate tool R: scale tool T: show manipulator tool Y: invoke last tool G: repeat last command Alt+v: stop/start playback Alt+shift+v: go to first frame
For the complete list – or to change hotkeys: Window > Settings/Preferences > Hotkeys
Shading Networks
To add colors and texture we’ll use shading networks
Shading Network: contains materials, textures, lights and geometry to create a desired look.
The Hypershade panel has: Create Bar: allows you to create material nodes Hypershade Tabs: list all nodes in the scene Work area: where you can look more closely at a
particular shading network’s graph
Hypershade
We’ll use the hypershade to create materials that define the look of the boxes, shelves, lamp, door, and door knob.
Create Blinn
RMB in the materials area and Create > Materials > Blinn Or click the checkered button to open the create
tab, and select blinn from there You can see that a blinn shading node is
added to the materials area Blinn: a material node that gives you special
control over a materials highlights. Very good for Metals and other shiny objects.
Assigning the Blinn
Double click the blinn node, and the attribute editor will pop up (or ctrl+a).
Rename the blinn to lampMat Let’s edit the color attribute first. Double click the
gray box next to color in the attribute editor. Choose any color you want, and hit accept MMB+drag the lampMat onto your lamp, or select
the lamp, RMB the lampMat and Assign material to selection
Softer Lamp
In the perspective window, notice how the lamp appears very polygonal, perfectly showing every edge. To create a slightly smoother effect, without adding geometry, we’ll just turn on Soft Edges.
With the lamp selected, Edit Polygons > Normals > Soften/Harden
You can see now that we have smoother edges, try different angles from the options box
Wire Material
RMB in the work area > Graph > Clear Graph If there was anything in the work area, it would be removed
Create a Phong material, change the color to black Phong mats have a plastic look to them
Change the name to wireMat Select the wire and RMB wireMat > assign material
to selection Assign Material to selection can be used with
multiple selected objects
Bulb Material
Create a Lambert material, with a yellow color and rename it bulbMat
Change the incandescence color to dark yellow
Lambert Materials: good for anything that doesn’t have strong specular highlights, such as clothing, paper, and other fibers. Adding incandescence flattens the material and
makes it appear to glow, though it does not actually give off any light.
The Bulb
Create a basic NURBS sphere, rename it bulb and place it in the lamp
Assign the bulbMat to the bulb
Creating a procedural texture Map Click the clear graph button (looks like an
eraser) Let’s give the boxes a texture Create a Lambert and name it boxMat Create > 2d Texture > grid MMB drag the Grid icon onto the boxMat
Select color on the box that pops up Click the Rearrange Graph button
Crate Material
Assign boxMat to one of the crates
Activate the perspective window, Hotbox > Shading > Hardware Texturing (hotkey 6) Warning: be careful with
hardware texturing, it can significantly reduce machine performance
Double click the grid1 node, change the line and filler color to whatever you want
Changing the Mat
Click the “place2dTexture1” tab on in the attribute editor
Change Repeat U and V to 2
Display the whole shading group With the grid selected, click on Input and
Output Connections You can MMB wheel to zoom in and out,
most of the same controls that work for the main view, work for all other windows
Press ‘a’ to frame all lambertXSG is the connection from the
boxMat to the crate
Creating a file texture map
You’ll often want to use a texture file instead of an internal procedral texture object
These can be created using Photoshop, Gimp, or any other 2d package
Create a Phong rename it crateMat Open the attribute editor with crateMat
selected Click the Map box next to the color attribute
Assign Texture
Click the folder button, and select your image Be sure your image is already in the
sourceimages folder so you can find it easily Apply crateMat to one of the crates If you make changes to the image outside of
maya, just hit the reload button on the file texture
Normally, textures won’t look good at first, but we got lucky this time
Test Render
Since the perspective window size can change dramatically, let’s use the resolution gate to see what will actually be rendered
Activate the perspective window > Hotbox > View > Camera Settings > Resolution Gate
Dolly in so that the image is well framed. You’ll probably want to be looking towards the boxes to get everything in view
RMB the render window > Render > Render > persp
The Rest of the Room
Our shelves are still gray, so let’s apply a texture to them
Create lambert, rename shelfWood Map a file texture, select a wood texture (find
it next to this lecture on the web page) Assign shelfWood to the shelves The door is just a red blinn, and the handle is
a yellow-orange blinn Render again, click the clapboard button
Default Light Test Render
Add a bulb light
We’re still using the default lighting, which looks very flat
Create > Point Light Rename it lampLight, put it inside the bulb Open the shadows tab, check use depth map
shadows Render, why don’t we see anything but the bulb? Select the bulb, open Render Stats, uncheck cast
shadows
Test Render 2
Add a floor light
That’s better, but it doesn’t show us nearly enough. The lamp shade is blocking everything.
Let’s put another light on the floor to simulate reflected light.
Turn the floorLight intensity down to .3, Turn on shadows
Turn the lampLight intensity to .5 Now we have some very dramatic night-time
shadows
The Lit Room
Conclusion
Save your scene! We’ve now covered the basic concepts of
texturing, lighting, and rendering. We went over materials, procedural textures,
file textures, lights, and rendered a single frame to preview the look of the Shaders and lights.
Next time, we’ll go over the basics of animation.