Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

Reyes architecture pipeline, algorithm overview and phases of the algorithm explained in detail (more info in the slides' notes).

Published in: Software
  • Be the first to comment


  1. 1. Reyes Dragan Okanovic @abstractalgo
  2. 2. REYES BIRTH  rendering algorithm developed by Robert L. Cook, Loren Carpenter, Edwin Catmull at Lucasfilm’s research group  name: Renders Everything You Ever Saw  made with goal of film-quality CGI: smooth surfaces, shading, depth of field and motion blur at a reasonable speed  raytracing was slow, memory consumption and execution time were too big  first used in the movie Star Trek II: The Wrath of Khan (1982)  long time used as a primary method for offline rendering (Pixar was leading in this area)  first feature-length computer animated movie: Toy Story (1995)
  3. 3. REYES FEATURES  rasterization-based algorithm with adaptive tessellation for rendering analytic surfaces with support for high-quality camera effects via stochastic sampling  features:  analytic surfaces (parametric shapes, Catmull-Clark subdivision surfaces, Bezier patches, NURBS…)  programmable shaders (usually Renderman interface compliant)  stochastic rasterization (antialiasing, depth of field, motion blur)  order independent transparency (A-buffer)  parallelizable (SIMD, multicore, network distributed…)
  4. 4. ALGORITHM OVERVIEW Bound - Split Dice Shade Sample Resolve Tessellation Rasterization Resolve
  5. 5. DATA STRUCTURES  Primitive/Shape  represents analytic shape (mathematically described geometrical surface using UV parameters or similar)  Grid/Microgrid  grid of (displaced and shaded) vertices after the primitive was diced  A-buffer  pixel buffer that holds per-sample list of values for each sample location struct Vertex { RGBA color; Vector3 position; } typedef Vertex[GRID_WIDTH][GRID_HEIGHT] Grid; struct PixelSample { RGBA color; float depth; // z-coord PixelSample* pNext; } typedef PixelSample[RES_X][RES_Y][SAMPLES_PER_PIXEL] ABuffer; class Shape { virtual Vector3 getNormal(UV coord); virtual Vector3 getPosition(UV coord); }
  6. 6. TESSELLATION - CONCEPTUALLY  the idea of the tessellation phase is to adaptively tessellate the shape into micropolygons that are all approximately less than a pixel (area < 1px)  tessellation is done in three steps  shape’s size is estimated in screen-space (BOUND)  if (size of the shape is “small enough” so that, after the dicing, micropolygons in the grid are smaller than the pixel)  dice the shape (DICE)  continue onto next phase (shading and sampling)  else  split the shape somehow into smaller sub-shapes (SPLIT) and put each of them into queue for further tessellation BOUND DICE SMALL ENOUGH ? SPLIT Shape Shape Microgrid Shape AABB Shape [ ]
  7. 7. BOUND  estimate the screen-space size of the shape  calculate the scree-space AABB and compare to some predefined threshold  bound phase should take care about the vertex displacement after the dice phase  bounding the shape:  coarsely dice the shape  displace the vertices in the microgrid  project the vertices  using image properties, estimate the pixel-sized bounding box
  8. 8. SPLIT  splitting the analytic surfaces is usually very lightweight process, and it involves creation of a new shapes that just get the sub- intervals of the parametric surfaces that define them  determining the good split direction is important ✓✗
  9. 9. DICE  this step requires microgrid with an array of vertices that are sampled uniformly across the shape’s surface and whose values are evaluated using the shape’s information  if we already diced the shape enough in the bound phase for virtual micropolygons of the microgrid to be approximately less than a pixel area, then we can go straight to the next phase Dice (evaluate vertices in the grid) Displace (run “vertex shader”)
  10. 10. TESSELLATION - DETAILED Shape DICE Microgrid BOUND MicrogridCamera AABB SMALL ENOUGH ? SHADE Microgrid SPLIT Shape Shape [ ] DISPLACE
  11. 11. “ “ virtual micropolygons SHADING  for each vertex in the microgrid, a coloring shader is executed, outputting the color of the vertex  this is where all the programmable features of the shading system come into play  logically, this is also where “primitive assembly” happens, because further stages will not look at one vertex at the time, but rather at the micropolygon as a whole, with its corresponding vertices that make it  micropolygons can be either triangles, quads or polygons (basic geometrical primitives that can actually be rasterized)
  12. 12. SAMPLING  each micropolygon is rasterized  color is interpolated between the vertices of the micropolygon at each sample point within each partially-covered pixel  number of sampling locations and positioning within the pixel can be chosen to best fight aliasing and to give high-quality results for the depth of field and motion blur effects Sample pattern Sampling the color
  13. 13. SAMPLING  stochastic sampling is done at predefined sample locations but with added random jitter  for the depth of field effect, the CoC is calculated and then the sampled color is spread across the sample locations in the A-buffer that would be affected by the CoC  for motion blur, all the sampling locations that would be affected by the motion of the shape are resampled stochastically and injected into A-buffer  results of the each sampling operation are written in the A-buffer, slowly filling it with per-sample-location list of all the samples that affect it
  14. 14. RESOLVE  final stage is color resolve  using the A-buffer, for each pixel, mix the recorded samples  for each sample, choose a filter and combine with all the others  take care of the depth while resolving transparency  output the final color of the pixel in the framebuffer Pixel 1 Pixel 2 Pixel 2 mix …
  16. 16. FULL REYES PIPELINE Shape DICE Microgrid BOUND MicrogridCamera AABB SMALL ENOUGH ? Microgrid SPLIT Shape Shape [ ] DISPLACE SHADE Microgrid Microgrid Micropolygon SAMPLE Sample UPDATE A-BUFFER STOCHASTIC SAMPLING RESOLVE A-Buffer Image
  17. 17. OPTMIZATIONS  bucketing  find the “sweet spot” for performance by balancing the parameters  A-buffer ops, fast discard  dynamic dicing  parallelization (SIMD)  cache utilization
  18. 18. OVERVIEW PROS  high-quality imagery  lens effects via stochastic sampling  antialiasing and OIT via A-buffer  flexible shading  parallelizable CONS  cracks in geometry due to dicing at different level for patches that are neighbors  wasteful uniform dicing for vey skewed patches  huge memory consumption  requires additional post-processing for GI effects  “deprecated”
  19. 19. REYES TODAY  smooth surfaces are no longer exclusive to Reyes, but Bezier patches and subdivision surfaces can be raytraced via Bezier clipping and similar techniques (implemented in RIS, but Reyes-based algorithms still exist)  pathtracing using robust methods such as VCM seem like a future of high-quality CGI  Reyes-like approach towards solving problems adaptively and in tiles are still in use today:  desktop GPUs optimize much of the shading and culling through tiling (also PowerVR and mobile GPUs)  object-space, adaptive, decoupled deferred shading and shading reuse techniques for real-time  screen-space tessellation is reconsidered for use with new APIs (Vulkan, DX12)  Reyes might not be used actively, but lessons learned from it can still be applied in many formats today
  20. 20. CODE  check out repository for example C++ implementation of Reyes architecture (currently w/o stochastic sampling)  see repo’s description for entire list of features  pipeline, with bound and cull test: pipeline.hpp  Shape structure: shape.hpp  Microgrid structure with AABB function used for bound phase: grid.hpp  dice: dice function  sampling that utilizes OpenGL’s rasterization with simple Z-buffer: rasterize function  more to come…
  21. 21. REFERENCES  “The Reyes Rendering Architecture”, Alexander Boswell (part 1, part 2)  “Implementing a modern, RenderMan compliant, REYES renderer”, Davide Pasca (slideshare)  “Reyes architecture and Implementation”, Kayvon Fatahalian  “A real-time micropolygon rendering”, Kayvon Fatahalian  “Parallel micropolygon rendering”, course material (pdf slides)  “Real-time Reyes-style Adaptive Surface Subdivision”, Patney and Owens  “RenderAnts: Interactive Reyes rendering on GPUs”, Kun Zhou et al.  additional resources at  I borrowed some of the images from Davide Pasca’s slides, Alexander Boswell’s blog and Scratchapixel website, it’s purely for educational purpose
  22. 22. Thanks! @abstractalgo