REYES micropolygons Jordi Roca Monfort 20/02/07. Introduction.

Post on 21-Dec-2015

220 views 3 download

transcript

REYES micropolygonsREYES micropolygons

Jordi Roca MonfortJordi Roca Monfort

20/02/0720/02/07

IntroductionIntroduction

RenderMan SpecificationRenderMan Specification RenderMan Interface Specification:RenderMan Interface Specification:

Pixar Animation Studios (1988)Pixar Animation Studios (1988) Renderman Shading LanguageRenderman Shading Language Allows specify high-level geometric primitives, Allows specify high-level geometric primitives,

(like quadrics or bicubic)(like quadrics or bicubic)

Comparing with OpenGL spec:Comparing with OpenGL spec: Both stack-based state machine with Both stack-based state machine with

“immediate” rendering of primitives“immediate” rendering of primitives It is possible to implement either API in It is possible to implement either API in

terms of the otherterms of the other

RenderMan Spec RenderMan Spec ImplementationImplementation

A “renderer” is “RenderMan-compilant” if:A “renderer” is “RenderMan-compilant” if: Implements Minimum requeriments andImplements Minimum requeriments and optionally some advanced capabilities (see the optionally some advanced capabilities (see the

paper)paper)

RenderMan-compilant renderers:RenderMan-compilant renderers: 3Delight (REYES)3Delight (REYES) AIRAIR Aqsis (REYES)Aqsis (REYES) Blue Mon Rendering Tools Blue Mon Rendering Tools jrMan (REYES)jrMan (REYES) Pixie (REYES)Pixie (REYES) PhotoRealistic RenderMan (REYES)PhotoRealistic RenderMan (REYES)

REYES: REYES: Renders Everything Renders Everything You Ever SawYou Ever Saw

A software architecture/algorithm to A software architecture/algorithm to implement RMan Spec. implement RMan Spec.

Strong points Strong points :: Fast render of scenes with vast visual Fast render of scenes with vast visual

complexity. (3’’/frame or 2 hours movie at complexity. (3’’/frame or 2 hours movie at 24fps taking a year)24fps taking a year)

Low-memory and resource usage regardless of Low-memory and resource usage regardless of the scene complexity.the scene complexity.

Weak points Weak points :: Raytracing not supported efficiently.Raytracing not supported efficiently.

Unpredictable ray direction causes model & texture Unpredictable ray direction causes model & texture page trashing (for complex scenes)page trashing (for complex scenes)

RenderMan Geometric RenderMan Geometric primitivesprimitives

Surfaces, Points, Curves (linear, cubic)Surfaces, Points, Curves (linear, cubic) Polygons, Polygonal meshesPolygons, Polygonal meshes Subdivision SurfacesSubdivision Surfaces PatchesPatches Quadrics (Spheres, Cylinders, Cones, Tori, Hyperboloids, Quadrics (Spheres, Cylinders, Cones, Tori, Hyperboloids,

Paraboloids, Disks)Paraboloids, Disks) BlobbiesBlobbies Constructive Solid Geometry (CSG)Constructive Solid Geometry (CSG) ProceduralsProcedurals InstancingInstancing Reference geometryReference geometry Handedness, sidesHandedness, sides

RenderManRenderManGeometric primitivesGeometric primitives

CurvesCurves

Parameters: Some control points and a “t” Parameters: Some control points and a “t” domaindomain

Expression: C(t) = Expression: C(t) = f [ Pf [ P00, P, P11, ...., P, ...., Pnn , t ] , t ]

PatchesPatches Parameters: Parameters:

Mesh of control pointsMesh of control points U and V domainsU and V domains

Expression: S(u,v) = fExpression: S(u,v) = f[ P[ P0000, P, P0101, ...., P, ...., Pnmnm , u,v ] , u,v ]

Subdivision surfacesSubdivision surfaces

Widely used implementation:Widely used implementation: the Cthe Catmull-atmull-CClark lark algorithm.algorithm.

QuadricsQuadrics

RiConeRiCone(height, radius, (height, radius, thetamax, thetamax, parameterlist)parameterlist)

RiCylinderRiCylinder(radius, (radius, zmin, zmax, thetamax, zmin, zmax, thetamax, parameterlist)parameterlist)

RiSphere RiSphere (radius, (radius, zmin, zmax, thetamax, zmin, zmax, thetamax, parameterlist)parameterlist)

RiParaboloidRiParaboloid(rmax, (rmax, zmin, zmax, thetamax, zmin, zmax, thetamax, parameterlist) parameterlist)

Procedural GeometryProcedural Geometry A set of parametrizable algorithms generate, on-demand, A set of parametrizable algorithms generate, on-demand,

irregular geometry at diferent LODsirregular geometry at diferent LODs Example Fractals 2D: The same algorithm/pattern is repeated Example Fractals 2D: The same algorithm/pattern is repeated

at ever smaller scales.at ever smaller scales. The 3D model only stores the algorithms and input parameters.The 3D model only stores the algorithms and input parameters.

BlobbiesBlobbies A Particle system specially suitable for liquids like A Particle system specially suitable for liquids like

water and mercury.water and mercury. Particle: primitives with “physical” properties:Particle: primitives with “physical” properties:

Position, Velocity, Colour, Lifetime, Mass,…Position, Velocity, Colour, Lifetime, Mass,… Particle system algorithm: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 Constructive Solid Geometry (CSG)(CSG)

RiSolidBeginRiSolidBegin("difference"); ("difference"); RiSolidBeginRiSolidBegin("primitive"); ("primitive"); RiSphereRiSphere(1.0,-1.0,1.0,360.0,RI_NULL); (1.0,-1.0,1.0,360.0,RI_NULL); RiSolidEndRiSolidEnd(); (); RiSolidBeginRiSolidBegin("primitive"); ("primitive");

RiDiskRiDisk(2.0,0.5,360.0,RI_NULL); (2.0,0.5,360.0,RI_NULL); RiCylinderRiCylinder(0.5,-2.0,2.0,360.0, (0.5,-2.0,2.0,360.0,

RI_NULL ); RI_NULL ); RiDiskRiDisk(-2.0,0.5,-360.0,RI_NULL); (-2.0,0.5,-360.0,RI_NULL);

RiSolidEndRiSolidEnd();();RiSolidEndRiSolidEnd(); ();

Implementation-specific Implementation-specific primitivesprimitives

RiGeometryRiGeometry( type, parameterlist )( type, parameterlist ) Example:Example:

RiGeometry(“teapot”, RI_NULL);RiGeometry(“teapot”, RI_NULL);

The REYES Rendering The REYES Rendering PipelinePipeline

REYES Pipeline: OverviewREYES Pipeline: Overview

REYES Pipeline: Model REYES Pipeline: Model primitives readprimitives read

RIB Parse

r3D Model

RIB commands

FrameBegin 0 WorldBegin Translate 0 0 -5 Color [1 1 1] Sphere 1 -1 1 360 WorldEnd FrameEnd

RI APIRI 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();

REYES Pipeline: Bounding REYES Pipeline: Bounding testtest

RI API

RiSphereView

Matrix

Eye-space transformCompute bounding box

RiBasis(Bezier, ..)

View Matrix

Cull outside frustum

REYES Pipeline: SplittingREYES Pipeline: Splitting

Turn a complex primitive into smaller Turn a complex primitive into smaller (maybe of different type) primitives.(maybe of different type) primitives.

Each primitive support must include Each primitive support must include the algorithm to split into the algorithm to split into smaller/supported primitives.smaller/supported primitives.

Like TESSELATION but not necesarily Like TESSELATION but not necesarily into trianglesinto triangles

REYES Pipeline: Split/DiceREYES Pipeline: Split/Dice

Diceable? Diceable? Estimate the pixel area of the bounding boxEstimate the pixel area of the bounding box If area > ‘dice threshold’ then SPLIT into smaller If area > ‘dice threshold’ then SPLIT into smaller

primitivesprimitives

Cull

Inside Frustum Original Primitive Queue

Splitting Primitive Stack

Diceable?

No

Yes

Split

Generate

µpolygons

Cull

REYES Pipeline: DiceREYES Pipeline: Dice Subdivide / dice the primitive into small polygons of ½ a Subdivide / dice the primitive into small polygons of ½ a

pixel on a side, called pixel on a side, called µµpolygonspolygons.. The dicing is performed in surface coordinate system:The dicing is performed in surface coordinate system:

Each primitive with a projected screen size equal or less than dice Each primitive with a projected screen size equal or less than dice threshold is “micropolygonized” using uthreshold is “micropolygonized” using uii,v,vi i as position coordinates.as position coordinates.

Why ½ a pixel?Why ½ a pixel?

Nyquist sampling limitNyquist sampling limit: if sampling at not : if sampling at not enough rate, the signal couldn´t be enough rate, the signal couldn´t be uniquely defined by our sampled values.uniquely defined by our sampled values.

Samples read a completely Samples read a completely black surface for a one-pixel-black surface for a one-pixel-res checker.res checker.

Aliasing artifactsAliasing artifacts If Sampling at a If Sampling at a twicetwice the the

pixel freq the artifact is pixel freq the artifact is avoidedavoided

Why micropolygons?Why micropolygons?

SimplicitySimplicity: Each : Each µpolygon vertex is flat-shaded & µpolygon vertex is flat-shaded & textured at only one stage. textured at only one stage.

AccuracyAccuracy: N: No attribute interpolation & no o attribute interpolation & no perspective correction needed.perspective correction needed.

Visual qualityVisual quality: The model geometry resolution : The model geometry resolution adapts automatically to the viewer distance.adapts automatically to the viewer distance.

PerformancePerformance: Group µpolygons into : Group µpolygons into Fixed-size Fixed-size gridsgrids, sharing vertices: A great , sharing vertices: A great work unit for the work unit for the next stagesnext stages Resource & memory usage bounded to the working set Resource & memory usage bounded to the working set

needed for one or more grids being processed in parallel.needed for one or more grids being processed in parallel. Vectorizable shading of a entire grid.Vectorizable shading of a entire grid. Texture locality/less filtering computation (CAT).Texture locality/less filtering computation (CAT).

RAT: Random Access RAT: Random Access TextureTexture

B(t) = P0 ( 1 – t )3 + 3 P1 t ( 1 – t )2 + 3 P2 t2 ( 1 – t ) + P3 t3 , t є [0,1]

P0 P1

P2 P3

t

Texture projection:

s = f(world coords x,y,z)

Texture requests: sequential but aliased (filtering required for acceptable quality)

RAT: Random Access RAT: Random Access TextureTexture

B(t) = P0 ( 1 – t )3 + 3 P1 t ( 1 – t )2 + 3 P2 t2 ( 1 – t ) + P3 t3 , t є [0,1]

P0 P1

P2 P3

t

Environment mapping:

s = f(view vector, N(t))

Texture requests: random

CAT: Coherent Access CAT: Coherent Access TextureTexture

B(t) = P0 ( 1 – t )3 + 3 P1 t ( 1 – t )2 + 3 P2 t2 ( 1 – t ) + P3 t3 , t є [0,1]

P0 P1

P2 P3

t

Projective texture mapping: s = at + b

Texture requests: sequential and not aliased.

CAT: Coherent Texture CAT: Coherent Texture AccessAccess

Most used primitive: Patches (u,v expansion)Most used primitive: Patches (u,v expansion) If:If:

s = u and t = v, ands = u and t = v, and Grid dimensions are power of 2, like textures.Grid dimensions are power of 2, like textures.

Then: Then: an appropiate dicing will line-up exactly to texels.an appropiate dicing will line-up exactly to texels.

If textures prefiltered and prescaled as If textures prefiltered and prescaled as resolution pyramids then almost no filtering resolution pyramids then almost no filtering is required.is required.

Jittering samplingJittering sampling

Divide the Pixel area Divide the Pixel area in a 4x4 grid. in a 4x4 grid.

Sample are Sample are generated at random generated at random offsets of each cell offsets of each cell center point.center point.

Z-bufferZ-buffer

High-resolution scenesHigh-resolution scenes 16 samples per pixel16 samples per pixel Transparency and CSG require Transparency and CSG require

storing multiple hits in each sample.storing multiple hits in each sample. Huge Z buffer size:Huge Z buffer size:

Solution: Solution: Bucket renderingBucket rendering. Screen . Screen partitioned in small frustums that are partitioned in small frustums that are sequentially processed.sequentially processed.

Advanced FeaturesAdvanced Features

Motion Blur:Motion Blur: For each shaded micropolygon draw the For each shaded micropolygon draw the

pixel for each sample in many “jittered” pixel for each sample in many “jittered” times.times.

Depth of field:Depth of field: For each shaded micropolygon draw the For each shaded micropolygon draw the

pixel in many “jittered” samples.pixel in many “jittered” samples.

Summarizing REYES Summarizing REYES advantatgesadvantatges

Allows rendering of large and complex scenes Allows rendering of large and complex scenes with no primitive limit using a small subset of with no primitive limit using a small subset of resources.resources.

““Adaptative tesselation/subdivision” of high-Adaptative tesselation/subdivision” of high-level primitives into micropolygons improves level primitives into micropolygons improves visual quality.visual quality.

Unlike Raytracing there is high memory Unlike Raytracing there is high memory locality:locality: Primitive calculations/shading is local (not Primitive calculations/shading is local (not

depending on reflection hits in other primitives) depending on reflection hits in other primitives) Textures are mostly CAT accessed (Patches the Textures are mostly CAT accessed (Patches the

most used primitive)most used primitive) Even the z-buffer exhibits locality with bucket Even the z-buffer exhibits locality with bucket

rendering.rendering.

Summarizing REYES Summarizing REYES disadvantagesdisadvantages

Shading occurs before the visibility test:Shading occurs before the visibility test: Many shading calculations never used.Many shading calculations never used.

Ideal CAT access requires a costly Ideal CAT access requires a costly texture preprocess to make up texture preprocess to make up resolution pyramids.resolution pyramids.

Some high-level primitives are really Some high-level primitives are really hard to render (split and dice hard to render (split and dice computation is very expensive) i.e: computation is very expensive) i.e: blobbies and SCGs.blobbies and SCGs.

Why is not the REYES-arch Why is not the REYES-arch well-suited for interactive 3D well-suited for interactive 3D

Hw?Hw?

Geometry on GPU PapersGeometry on GPU PapersResolution-Independent Curve Rendering Using

Programmable Graphics Hardware Charles Loop, Jim Blinn,

Microsoft Research

Real-Time GPU Subdivision KernelLe-Jeng Shiue, Ian Jones, Jorg Peters

University 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 GPUPatrick Lacz John C. Hart

University of Illinois Urbana-Champaign

REYES ImplementationsREYES Implementations

PIXIE: Open Source PIXIE: Open Source RenderManRenderMan

Implements REYES arch.Implements REYES arch. Primitives:Primitives:

Bicubic/Bilinear, NURB patches, B-Spline Bicubic/Bilinear, NURB patches, B-Spline patch grid, Points, Cubic/Linear curve, patch grid, Points, Cubic/Linear curve, All quadrics, Implicit, Polygonal meshes, All quadrics, Implicit, Polygonal meshes, Subdivision, Procedurals, InstancingSubdivision, Procedurals, Instancing

Does not implement:Does not implement: Blobbies and CSGBlobbies and CSG

90% of source code is about geometry90% of source code is about geometry split/dice/intersect algorithms!!split/dice/intersect algorithms!!

Uses OpenGL, but for GUI and Previews.Uses OpenGL, but for GUI and Previews.

PIXIE: Source codePIXIE: Source code Class for Sphere primitive:Class for Sphere primitive:

Class CSphere : public Csurface{public: CSphere(CAttributes *,CXform *,CParameter *,unsigned int,float,float,float,float); ~CSphere();

void intersect(CShadingContext *,CRay *); // Intersect a ray with the surface int moving() const; // TRUE if we're moving void sample(int,int,float **,float ***,unsigned int &) const; // Sample the surface of the object void interpolate(int,float **,float ***) const; // Interpolate the variables void instantiate(CAttributes *,CXform *,CRendererContext *) const; void dice(CShadingContext *); // Split or render this object void shade(CShadingContext *,int,CRay **); // Shade the objectprivate: Cparameter *parameters; unsigned int parametersF; float r,umax,vmin,vmax; float *nextData;

void computeObjectBound(float *,float *,float,float,float,float);};

NVIDIA GelatoNVIDIA Gelato

Film-like rendering Film-like rendering system using a system using a NVIDIA card.NVIDIA card.

NVIDIA GelatoNVIDIA Gelato

The Rendering pipeline:The Rendering pipeline: Non-RenderMan Spec based.Non-RenderMan Spec based. But arch very similar to REYES.But arch very similar to REYES. Uses also micropolygon, but 1 pixel Uses also micropolygon, but 1 pixel

size.size. Uses OpenGL?Uses OpenGL?

The system requeriments states The system requeriments states that Gelato requires the last that Gelato requires the last OpenGL NVIDIA driver version.OpenGL NVIDIA driver version.

First steps in my thesisFirst steps in my thesis

RenderMan/REYES scenes are good source RenderMan/REYES scenes are good source for micropolygon workload. for micropolygon workload.

Pixie implements subdivision/dicing Pixie implements subdivision/dicing algorithms for most of the high-level algorithms for most of the high-level primitives.primitives.

There are some related papers about There are some related papers about subdivision in GPUs.subdivision in GPUs.

In addition, we can try to find out what In addition, we can try to find out what GELATO does with OpenGL.GELATO does with OpenGL.

ReferencesReferences

L. Cook et al., L. Cook et al., The Reyes Image The Reyes Image Rendering ArchitectureRendering Architecture, SIGGRAPH’ 87, SIGGRAPH’ 87

J.D. Owens et al, J.D. Owens et al, Comparing Reyes and Comparing Reyes and OpenGL on a Stream ArchitectureOpenGL on a Stream Architecture, , Graphics Hardware 2002.Graphics Hardware 2002.

Patrick Lacz John C. Hart, Procedural Geometry Synthesis on the GPU.