190 likes | 202 Views
Rendering. The Utah (Newell) Teapot. The Utah teapot or Newell teapot is a 3D computer model which has become a standard reference object in the computer graphics community. Basic flow. Modeling program Ayam, Blender, Houdini Maya. Texture & shadow map(s). Shader (s) . sl filetype.
E N D
The Utah (Newell) Teapot The Utah teapot or Newell teapot is a 3D computer model which has become a standard reference object in the computer graphics community.
Basic flow • Modeling program • Ayam, • Blender, • Houdini • Maya Texture & shadow map(s) Shader (s) .slfiletype RIB file Shader files Rendering program (PRMan, Aqsis, 3Delight)
Shader Language helping RIB RIB: Surface“myShader” “color surfaceColor” [1 0 0] SL: surfacemyShader(color surfaceColor= color(1,1,1);) { }
Programs Involved • Maya – the modeling program • Generates the RIB file • Full-featured modeler • Solids • Meshes • Surfaces • 2012 version supports RIB output • Renderman for Maya • PhotoRealistic Renderman (PRMan) • Comes with the Renderman software • Does NOT appear in a menu, must be invoked by hand or a script
μ-polygon & sub-pixels • μ-polygon • Close to or even less than the area of a pixel • A shader might fill each μ-polygon with a single color or assign colors on a per-vertexbasis • Sub-pixel • One of the R, G or B components of a single pixel • Sub-pixels of a pixel might NOT all be in the same μ-polygon • if a sub-pixel IS inside a μ-polygon, all 4 corners are blended to yield wt/color • Relation of pixels & sub-pixels to a model • The model is superimposed on the matrix of device pixels • Pixels now lie fully or partially inside a μ-polygon
The Reyes Algorithm • Parse incoming RIB file into surface primitives (polygons, curves, etc) • Apply Bounds to each primitive (create "binding boxes") to see if it is inside the viewable area • Cull? If outside the area, discard the primitive • Too large, if yes, split and go back to 2 • Dice into μ-polygon grids (user controlled) • approx. pixel-sized, controlled by ShadingRate • RIB file specifies Gridsize (gridsize=8 means an 8x8 grid = 64 μ-polygons) • Shade at grid vertices (1 color/wt per vertex) • Bust (break-up) the grid into • Apply Bounds μ-polygon b/c shading may obscure it • Cull & discard as needed • Sample at sub-pixel locations • Collapse visible point lists • Blend sample colors, opacities • Output pixels
Installing Autodesk Maya & Renderman/PRMan • Select the Maya 2012 – 32-bit version for Windows • Later versions and Linux versions do NOT support RIBexport • Follow download/install instructions (it's a BIG file) • Run Maya 2012 • Click Window, Settings/Preferences, Plugin Manager • Find RIBexport • Click on "loaded" & "autoload" • Ribexport now appears on the Export All list of choices • Select Renderman Free • Download & Install • Change your PATH statement to include the path to C:\Program Files\Pixar\RenderManProServer-19.0\bin • Open a DOS prompt, type prman [your rib filename]
Using Maya • Use tools in left pane to: • Select • Move • Rotate (all 3 dimensions) • Resize • Saving as RIB • File/SaveAs…/RIBexport • Controls • Display/heads up display/viewcube (f/t/l/r/b/p)
Display your RIB model • Use this BAT file (put it in some directory in your path) @echo off Rem Insert path to your own Maya RIB files below cd {My Documents\maya\projects\default\scenes} Rem change the drive letter below if your files are not on E: E: set /p model=Enter full model filename (w/o extension) must be a RIB file: Set modelfile=%model%.rib prman%modelfile% set rendered_model= persp_%model%.tif mspaint.exe %rendered_model% pause
Trimming an Object • Create a polygon (e.g.; a cylinder) • Resize and move as needed • Create another polygon (e.g.; a cube) • This will be the trimming object • Resize and position to where you want to trim • Be sure that "Polygons" is showing in the menu under "File" • Select the object to keep • Shift+select the trimming object • Click on Mesh/Booleans/ Difference
NURBS • Non-Uniform Rational Basis Spline • Mathematical model to represent curves & surfaces • NURBS surfaces are functions of two parameters mapping to a surface in three-dimensional space. (Wikipedia) • Shape determined by control points • Always connected to the surface either: • Directly • Via "rubber-bands" • Spline • Function defined with polynomial pieces • Smoothed where pieces connect • Basis Spline • Minimal set of non-zero pts http://en.wikipedia.org/wiki/File:Spline01.gif
Subdivision Surfaces • User specifies a polymesh surface • Program generates a smooth subdivided result • Example from wikipedia
Patches • Descriptions of three-dimensional shapes • Specified as bounded equations with criteria • Can be joined to other patches along their common edges • Grid of control vertices • Compared to subdivision surfaces (arbitrary polygonal meshes) • Useful in generating complex surfaces • 3D-Bezier curve • Renderman support • Linear • Cubic
Rendering a model from a RIB file • Navigate to the folder with Prman.exe • Copy the path • Change your PATH environment variable to include Prman • Open a command prompt window • Type "prman" followed by the full path to the RIB file • Output will (by default) be in this same directory with a type of ".tif"
Grid "Busting" • Break up the μ-polygon grid into individual μ-polygons • (4 corners each) • Each corner has its own color & transparency • No unbounded primitives (no infinite planes) in Renderman • One μ-polygon is "about" ¼ of a SCREEN pixel • Screen space bound • determines which pixels might be covered by the μ-polygon
Pixels vs. μ-polygons Each dot is a sub-pixel
Types of shaders • Displacement Shader– • may move grid vertices or change normals • Surface Shader– • requires evaluation of all Light Shaders attached to the original primitive. • Light Shaders– • run as co-routines of Surface shadersand results are cached for later possible use. • Atmosphere Shader • Applies fog, etc. • Note overlap of Surface & Light shader types