460 likes | 824 Views
REYES micropolygons. Jordi Roca Monfort 20/02/07. Introduction. RenderMan Specification. RenderMan Interface Specification: Pixar Animation Studios (1988) Renderman Shading Language Allows specify high-level geometric primitives, (like quadrics or bicubic) Comparing with OpenGL spec:
E N D
REYES micropolygons Jordi Roca Monfort 20/02/07
RenderMan Specification • RenderMan Interface Specification: • Pixar Animation Studios (1988) • Renderman Shading Language • Allows specify high-level geometric primitives, (like quadrics or bicubic) • Comparing with OpenGL spec: • Both stack-based state machine with “immediate” rendering of primitives • It is possible to implement either API in terms of the other
RenderMan Spec Implementation • A “renderer” is “RenderMan-compilant” if: • Implements Minimum requeriments and • optionally some advanced capabilities (see the paper) • RenderMan-compilant renderers: • 3Delight (REYES) • AIR • Aqsis (REYES) • Blue Mon Rendering Tools • jrMan (REYES) • Pixie (REYES) • PhotoRealistic RenderMan (REYES)
REYES: Renders Everything You Ever Saw • A software architecture/algorithm to implement RMan Spec. • Strong points : • Fast render of scenes with vast visual complexity. (3’’/frame or 2 hours movie at 24fps taking a year) • Low-memory and resource usage regardless of the scene complexity. • Weak points : • Raytracing not supported efficiently. • Unpredictable ray direction causes model & texture page trashing (for complex scenes)
RenderMan Geometric primitives • Surfaces, Points, Curves (linear, cubic) • Polygons, Polygonal meshes • Subdivision Surfaces • Patches • Quadrics (Spheres, Cylinders, Cones, Tori, Hyperboloids, Paraboloids, Disks) • Blobbies • Constructive Solid Geometry (CSG) • Procedurals • Instancing • Reference geometry • Handedness, sides
Curves • Parameters: Some control points and a “t” domain • Expression: C(t) = f [ P0, P1, ...., Pn , t ]
Patches • Parameters: • Mesh of control points • U and V domains • Expression: S(u,v) = f[ P00, P01, ...., Pnm , u,v ]
Subdivision surfaces • Widely used implementation:the Catmull-Clark algorithm.
Quadrics • RiCone(height, radius, thetamax, parameterlist) • RiCylinder(radius, zmin, zmax, thetamax, parameterlist) • RiSphere (radius, zmin, zmax, thetamax, parameterlist) • RiParaboloid(rmax, zmin, zmax, thetamax, parameterlist)
Procedural Geometry • A set of parametrizable algorithms generate, on-demand, irregular geometry at diferent LODs • Example Fractals 2D: The same algorithm/pattern is repeated at ever smaller scales. • The 3D model only stores the algorithms and input parameters.
Blobbies • A Particle system specially suitable for liquids like water and mercury. • Particle: primitives with “physical” properties: • Position, Velocity, Colour, Lifetime, Mass,… • Particle system algorithm: for each video frame { generate new particles remove old particles for each particle { resolve forces by vector addition calculate a, v, x update other particle properties render particle } }
Constructive Solid Geometry (CSG) RiSolidBegin("difference"); RiSolidBegin("primitive"); RiSphere(1.0,-1.0,1.0,360.0,RI_NULL); RiSolidEnd(); RiSolidBegin("primitive"); RiDisk(2.0,0.5,360.0,RI_NULL); RiCylinder(0.5,-2.0,2.0,360.0, RI_NULL ); RiDisk(-2.0,0.5,-360.0,RI_NULL); RiSolidEnd(); RiSolidEnd();
Implementation-specific primitives • RiGeometry( type, parameterlist ) • Example: • RiGeometry(“teapot”, RI_NULL);
REYES Pipeline: Model primitives read 3D Model RIB Parser RI API RIB commands RI Calls: RiFrameBegin(0); RiWorldBegin(); RiTranslate(0.0,0.0,frame-5.0); RiColor(col); RiSphere(1.0,-1.0,1.0,360,RI_NULL); RiWorldEnd(); RiFrameEnd(); FrameBegin 0 WorldBegin Translate 0 0 -5 Color [1 1 1] Sphere 1 -1 1 360 WorldEnd FrameEnd
REYES Pipeline: Bounding test Compute bounding box Eye-space transform Cull outside frustum RiSphere View Matrix RI API View Matrix RiBasis(Bezier, ..)
REYES Pipeline: Splitting • Turn a complex primitive into smaller (maybe of different type) primitives. • Each primitive support must include the algorithm to split into smaller/supported primitives. • Like TESSELATION but not necesarily into triangles
Diceable? Generate µpolygons Yes No Split REYES Pipeline: Split/Dice Inside Frustum Original Primitive Queue Cull • Diceable? • Estimate the pixel area of the bounding box • If area > ‘dice threshold’ then SPLIT into smaller primitives Cull Splitting Primitive Stack
REYES Pipeline: Dice • Subdivide / dice the primitive into small polygons of ½ a pixel on a side, called µpolygons. • The dicing is performed in surface coordinate system: • Each primitive with a projected screen size equal or less than dice threshold is “micropolygonized” using ui,vi as position coordinates.
Why ½ a pixel? • Nyquist sampling limit: if sampling at not enough rate, the signal couldn´t be uniquely defined by our sampled values. • Samples read a completely black surface for a one-pixel-res checker. • Aliasing artifacts • If Sampling at a twice the pixel freq the artifact is avoided
Why micropolygons? • Simplicity: Each µpolygon vertex is flat-shaded & textured at only one stage. • Accuracy: No attribute interpolation & no perspective correction needed. • Visual quality: The model geometry resolution adapts automatically to the viewer distance. • Performance: Group µpolygons into Fixed-size grids, sharing vertices: A great work unit for the next stages • Resource & memory usage bounded to the working set needed for one or more grids being processed in parallel. • Vectorizable shading of a entire grid. • Texture locality/less filtering computation (CAT).
RAT: Random Access Texture Texture projection: s = f(world coords x,y,z) Texture requests: sequential but aliased (filtering required for acceptable quality) P0 P1 t P2 P3 B(t) = P0 ( 1 – t )3 + 3 P1t ( 1 – t )2 + 3 P2 t2 ( 1 – t ) + P3 t3 , t є [0,1]
RAT: Random Access Texture Environment mapping: s = f(view vector, N(t)) Texture requests: random P0 P1 t P2 P3 B(t) = P0 ( 1 – t )3 + 3 P1t ( 1 – t )2 + 3 P2 t2 ( 1 – t ) + P3 t3 , t є [0,1]
CAT: Coherent Access Texture Projective texture mapping: s = at + b Texture requests: sequential and not aliased. P0 P1 t P2 P3 B(t) = P0 ( 1 – t )3 + 3 P1t ( 1 – t )2 + 3 P2 t2 ( 1 – t ) + P3 t3 , t є [0,1]
CAT: Coherent Texture Access • Most used primitive: Patches (u,v expansion) • If: • s = u and t = v, and • Grid dimensions are power of 2, like textures. • Then: • an appropiate dicing will line-up exactly to texels. • If textures prefiltered and prescaled as resolution pyramids then almost no filtering is required.
Jittering sampling • Divide the Pixel area in a 4x4 grid. • Sample are generated at random offsets of each cell center point.
Z-buffer • High-resolution scenes • 16 samples per pixel • Transparency and CSG require storing multiple hits in each sample. • Huge Z buffer size: • Solution: Bucket rendering. Screen partitioned in small frustums that are sequentially processed.
Advanced Features • Motion Blur: • For each shaded micropolygon draw the pixel for each sample in many “jittered” times. • Depth of field: • For each shaded micropolygon draw the pixel in many “jittered” samples.
Summarizing REYES advantatges • Allows rendering of large and complex scenes with no primitive limit using a small subset of resources. • “Adaptative tesselation/subdivision” of high-level primitives into micropolygons improves visual quality. • Unlike Raytracing there is high memory locality: • Primitive calculations/shading is local (not depending on reflection hits in other primitives) • Textures are mostly CAT accessed (Patches the most used primitive) • Even the z-buffer exhibits locality with bucket rendering.
Summarizing REYES disadvantages • Shading occurs before the visibility test: • Many shading calculations never used. • Ideal CAT access requires a costly texture preprocess to make up resolution pyramids. • Some high-level primitives are really hard to render (split and dice computation is very expensive) i.e: blobbies and SCGs.
Why is not the REYES-arch well-suited for interactive 3D Hw?
Geometry on GPU Papers Resolution-Independent Curve Rendering Using Programmable Graphics Hardware Charles Loop, Jim Blinn,Microsoft Research Real-Time GPU Subdivision Kernel Le-Jeng Shiue, Ian Jones, Jorg PetersUniversity of Florida GPU-Based Trimming and Tessellation of NURBS and T-Spline Surfaces Michael Guthe, Ákos Balázs, Reinhard Klein, Universität Bonn Blister: GPU-Based Rendering of Boolean Combinations of Free-Form Triangulated Shapes John Hable, Jarek Rossignac, Georgia Institute of Technology Procedural Geometry Synthesis on the GPU Patrick Lacz John C. Hart University of Illinois Urbana-Champaign
Implements REYES arch. Primitives: Bicubic/Bilinear, NURB patches, B-Spline patch grid, Points, Cubic/Linear curve, All quadrics, Implicit, Polygonal meshes, Subdivision, Procedurals, Instancing Does not implement: Blobbies and CSG 90% of source code is about geometry split/dice/intersect algorithms!! Uses OpenGL, but for GUI and Previews. PIXIE: Open Source RenderMan
PIXIE: Source code • Class for Sphere primitive: Class CSphere : public Csurface { public: CSphere(CAttributes *,CXform *,CParameter *,unsigned int,float,float,float,float); ~CSphere(); voidintersect(CShadingContext *,CRay *);// Intersect a ray with the surface intmoving() const;// TRUE if we're moving voidsample(int,int,float **,float ***,unsigned int &) const;// Sample the surface of the object void interpolate(int,float **,float ***) const;// Interpolate the variables voidinstantiate(CAttributes *,CXform *,CRendererContext *) const; voiddice(CShadingContext *);// Split or render this object voidshade(CShadingContext *,int,CRay **);// Shade the object private: Cparameter*parameters; unsigned intparametersF; floatr,umax,vmin,vmax; float*nextData; voidcomputeObjectBound(float *,float *,float,float,float,float); };
NVIDIA Gelato • Film-like rendering system using a NVIDIA card.
NVIDIA Gelato • The Rendering pipeline: • Non-RenderMan Spec based. • But arch very similar to REYES. • Uses also micropolygon, but 1 pixel size. • Uses OpenGL? • The system requeriments states that Gelato requires the last OpenGL NVIDIA driver version.
First steps in my thesis • RenderMan/REYES scenes are good source for micropolygon workload. • Pixie implements subdivision/dicing algorithms for most of the high-level primitives. • There are some related papers about subdivision in GPUs. • In addition, we can try to find out what GELATO does with OpenGL.
References • L. Cook et al., The Reyes Image Rendering Architecture, SIGGRAPH’ 87 • J.D. Owens et al, Comparing Reyes and OpenGL on a Stream Architecture, Graphics Hardware 2002. • Patrick Lacz John C. Hart, Procedural Geometry Synthesis on the GPU.