Even more jobs Spring Career Fair Shading Architectures Fair Wednesday, March 28th 11am - 4pm Gordon Field House Interviews Thursday, March 29th www.rit.edu/recruit Plan Shader Architectures Today RenderMan Shader Architectures Cg Next Week Shader Language Specifics How they are alike Tuesday: Lecture How they are different Thursday: Lab Shader System RenderMan Common traits: Renderman consists of three parts: Functional scene description mechanism (API for Scene separate from shader C) Renderman is an Interface! “load” a “compiled” shader State Model Description – Maintains a current graphics Parameter passing between scene and shader state that can be placed onto a stack. Global “graphics state” variables Geometry is drawn by utilizing the current graphics state. File format - Renderman Interface Bytestream Shader programs components of rendering (RIB) pipeline. Shading Language and Compiler. https://renderman.pixar.com/products/rispec/index.htm 1
Rendering using RenderMan Runtime architecture 3D Scene Shader 1 Shader Shader / render link Description “object” RenderMan file Shader 2 slc (RIB) Renderer Shader Shaders Shader 3 “object” (prman) Graphics file state (compiled shader code) Shader “object” file Texture Map Rendering application Renderman Shading Language Renderman Shading Language Renderman Shading Language Unlike other shading languages, RenderMan allows for procedural definition of all types of light transport, Inspired by Cook’s shade trees not just reflection Goals Light emission Atmospheric effects Abstract shading language based on ray optics, Reflection independent of any specific algorithm or Transmission implementation Transformations Interface between rendering program and Bump Mapping shading model High level language that is easy to use. Renderman Shading Language Renderman Shading Language Types of shaders Types of Shaders Light source shaders - calculates the color of Displacement Shaders - perturb the surface of a light being emitted in given direction. an object Surface reflectance shaders - computes the Imager Shader - post processing on image light reflected from a surface in a given pixels. direction Volume shaders - implements the effect of light passing through a volume of space, i.e., exterior, interior and atmospheric scattering effects. 2
Renderman Shading Language RenderMan scene RenderMan assumes a basic “graphics state” Dataflow Model scene model Scene hooks into shader Achieved via predefined “global” variables Result of shader Achived by setting other predefined “global” variables. Shaders programmed independently from other shaders [ Renderman Companion , 277] Renderman Shading Language Renderman Shading Language Attaching shaders to object Dataflow Model RiLightHandle RiLightSource (“name”, parameterlist); or LightHandle LightSource “name” parameterlist - sets shader “name” to be the current light source shader RiSurface (“name”, parameterlist); or Surface “name” parameterlist - sets shader “name” to be the current surface shader. RiAtmosphere (“name”, parameterlist); or Atmosphere “name” parameterlist - sets shader “name” to be the current atmosphere shader. [ Renderman Companion , 277] Light Shaders Light Shaders Define color and intensity of light in a given direction Light is “collected” by other shaders not “emitted” by light source shader Light shaders define “potential” light that can be collected later. [ Renderman Companion , 277] 3
Surface Shaders Light Shaders [Renderman Companion , 277] Surface Shaders Illumination Models Defines color/opacity at a surface point Can query defined light sources Approaches Illumination Model Image Textures Procedural Textures Bump Mapping Image Texture Mapping Environment Mapping 4
Procedural Textures Procedural Texture Different plain Grooved grain Different colors mortar colored within bricks bricks Olano, 1998, http://www.cs.unc.edu/~olano/papers/dissertation/ Displacement Shaders Displacement Shaders Used to perturb normal to give appearance of wrinkles Basic bump mapping Applied before surface shader [Renderman Companion , 277] Volume shaders Displacement Shader [Renderman Companion,277] 5
Volume Shader Volume shader Defines change of color/opacity of light going through a volume Fog, smoke, fire, haze Imager Shader Imager Shader Allows for postprocessing of final rendered image Applied pixel-by-pixel Tone reproduction Non-photorealistic rendering Supported in prman? [ Renderman Companion , 277] Imager Shader Shader order in prman Displacement Shader Surface Shader Queries light shaders Volume Shaders Imager Shader prman creates bytecode for SIMD virtual machine for compiled shaders 6
Summary -- RenderMan Real-time Shading Interface -- not a renderer Linked to hardware Independent of actual implementation RenderMan == GOOD Scene / Shader separation Can it be done on the graphics card? Shaders define interactions of light & Assembler geometry modification Higher level language Light / Surface / Displacement / Volume / Imager break Real time vs Off-line shading Graphics Hardware Pipeline Interactivity Viewpoints will change Performance is critical Frame to frame Execute on GPUs Restrictions Memory Registers Texture units and memory Data type accuracy Graphics Hardware Pipeline Graphics Hardware Pipeline Vertices define geometrical primitives Position in 3D space Color / text coords / materials / etc. Fragments “pixel state” -- Correspond to pixels 3D -> 2D Projection Scan conversion 7
Shading applets Programmable Graphics Pipeline Gouraud: http://www.vidimce.org/college/school/cs4 413.f96/program.6/ GPU Assembler Programmable Graphics Pipeline Vertex processor Operates on vertices Vertex shaders Fragment processor Operates on fragments Fragment / Pixel shader Cg Environment Cg Enviornment Cg == “C for Graphics” Cg Compilation Proceed with caution. Indirect link to GPU Standard APIs Compiles to interface with OpenGL or Direct3D layer Layer of standardization / abstraction from OpenGL/DirectX will command the GPU graphics card (GPU) CGRuntime OpenGL Direct3D 8
Cg Environment CgFX Putting it all together File format for encapsulating complete render state for an effect Allows for “packaging of effects” Loading of effects in external applications. Maya 3D Studio Max SoftImage CgFX Some realtime demos So what, you say Unintended effects GPUs are good processors in their own nVidia videos right Programming non-graphical apps on GPUs Image Processing Numerical Computation Animation Data Mining 9
Cg Summary Next week Platform / Hardware independent Lecture: Language nuts and bolts language Lab: RenderMan / Cg “Hello World” Scene / Shader separation Shaders Linked to hardware Only fragment and vertex shaders Questions 10
Recommend
More recommend