CG Surfaces: Materials, Shading, and Texturing ART/CSC/FST 220 Spring 2007 From text: 3D for Beginners, Chapter 7 Art of Maya (pages 116-126, 185-194)
Shading and texturing involves materials and their interaction with light. Materials: reaction of a surface to light. Color of the surface. Texture of the surface. Using procedural or image maps to describe these. UV coordinates for placement.
RenderMan Shaders Shaders, in.sl files, described by shading language -- part of RenderMan specification. Good for procedural shading..sl files are compiled using shader (aqsl) command -- creating.slc files..slc files are used by renderer to create look of surface materials. Example: In.rib file: WorldBegin Color [1 0 0] Surface firstshader Sphere 1-1 1 360 WorldEnd.sl file: surface firstshader() { Oi = Os; Ci = Oi*Cs; } Oi is output opacity. Os is input opacity. Ci is output color. Cs is input color.
Maya Shading Networks Networks of nodes, similar to scene graph. Materials, color, etc. created using Hypershade. (Window-->Rendering Editors-->Hypershade) Nodes for material, file, placement, conditions, etc. Pass information between the nodes to make the overall look of surface. Make decisions, perform calculations, etcetera.
Surface reaction to light. Materials (Lambert, Blinn, Phong, matte, plastic, etc.) describe reaction to light. Recall the dot product: A * B = A x B x + A y B y + A z B z = A B cos(theta), where A and B are vectors, and theta is the angle between them. With unit vectors, result of the dot product will be positive (0 to 1 to 0) for angles that range from -90 o to 90 o (and negative for greater angles). Types of light (diffuse, specular, and ambient) are modeled based on this. The surface normal, angle of incidence, and angle of viewing may be considered. Diffuse light depends on the angle between the light source and the surface normal (angle of incidence) as shown in the picture. It spreads more across the surface. Specular light is more intense and centrally located. It depends on the angle of incidence and the angle of viewing.
RenderMan models: (C is the color of light. N is the l surface normal. L is a unit vector pointing toward the light source. H is a unit vector halfway between the viewing direction (I) and the direction of the light source (L).) Diffuse only, top view. Diffuse only, side view. color diffuse(vector N) { C * max(0, N * L) } l color specular(vector N, V ; float roughness) (1/roughness) { C * max(0, N * H) } l Specular also, top view. Specular also, side view. color ambient() - typically approximated by a low-level, constant, nondirectional value set by the user. (Attempting to also model this inter-reflecting light is called global illumination and may be approximated using radiosity or photon-mapping rendering techniques.) Ambient also, side view.?
/* Compute the color of the surface with a simple plastic-like model. * Typical values used are Ka = 1, Kd = 0.8, Ks = 0.5, roughness = 0.1 */ color MaterialPlastic (normal Nf; color basecolor; float Ka, Kd, Ks, roughness;) { extern vector I; return basecolor * (Ka*ambient() + Kd*diffuse(Nf)) + Ks*specular(Nf,-normalize(I),roughness); }
Color of the Surface Simple color, typically defined in RGB. Image texture map (image file). Procedural texture map (algorithmic). Mip-map filters for level of detail. Placement is based on UV coordinates.
Texture of the surface, and other types of mapping. Bump-mapping: simulating rough surfaces with a texture (either image or procedural) applied to shader. Displacement-mapping: actually modifying geometry. (Heavier.) Maps may also be used for color, specular color, transparency, and reflectivity.
Reference materials and the art of seeing as a CG artist. Observe details in materials in daily life: Color, light sources, transparency, luminescence, smoothness, age, corrosion. Look for a story or history, interaction with other objects, imperfections, etc. Collect reference materials for a project. Keep a morgue of images and samples.
Creating your own image-based maps. Useful tools: Photoshop offset filter clone tool Illustrator
Drawing your own,
Advanced shaders. Based on multi-layers of color, bump, transparency, etc. Layered Shader in Maya. Described procedurally as in Renderman or MEL, or created as a shading network. Many are included in the Maya shader library. Other good sources for shaders and textures: www.highend3d.com/maya/shaders www.3dcafe.com