1 / 34

Matrices from HELL

Matrices from HELL . Paul Taylor 2010. Basic Required Matrices. PROJECTION WORLD VIEW. Matrix Math (Joy!). Matrix Addition Matrix Multiplication Translation and Rotation Matrices. Matrix Addition is Easy. =. +. =. +. Matrix Multiplication Row,Colum. =. x. =. x.

miriam
Télécharger la présentation

Matrices from HELL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matrices from HELL Paul Taylor 2010

  2. Basic Required Matrices • PROJECTION • WORLD • VIEW

  3. Matrix Math (Joy!) • Matrix Addition • Matrix Multiplication • Translation and Rotation Matrices

  4. Matrix Addition is Easy = + = +

  5. Matrix Multiplication Row,Colum = x = x

  6. That’s great, what do I need them for? Translation Matrices • Coordinates from Object Coordinates to world Coordinates Object Translation World Typically we use a Matrix Multiplication = +

  7. Scaling Scalar Matrices Object Scalar (1/10) World = x

  8. Translation by Multiplication • This is a computationally longer way to do a simple translation = x

  9. Rotational Matrices glRotatef(Theta,x,y,z); http://en.wikipedia.org/wiki/Rotation_matrix#Dimension_three A Rotation around the unit vector u = (ux,uy,uz)

  10. Putting it all together Typically you will want to: Translate Rotate Scale Matrix Multiplication is the inverse to the logical order! So: Scale then Rotate, then Translate

  11. Retrieving Matrices • This is slow! • The Video Matrices are 4x4 hence: D3DMATRIX world; world=

  12. DirectX 10 Has your back! Static float rotation; D3DMATRIX world; D3DMatrixIdentity(&world); rotation = 0.001f; D3DMatrixRotationY(*world, rotation); This creates a matrix on the PC, not on the Video Card, that’s the next step

  13. Update your Shader (Effect) Matrix World; float4 VS( float4 Pos : POSITION ) : SV_POSITION { Pos = mul( Pos, World); return Pos; } float4 PS( float4 Pos : SV_POSITION ) : SV_Target { return float4( 1.0f, 1.0f, 0.0f, 1.0f ); // Yellow, with Alpha = 1 } technique10 Render { pass P0 { SetVertexShader( CompileShader( vs_4_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, PS() ) ); } }

  14. Putting you matrix on the GPU Create a Pointer to the GPU Matrix: ID3D10EffectMatrixVariable worldMatrixPointer; Fill the Pointer to the GPU Matrix: Effect->GetvariableByName(“World”)->AsMatrix(); Set the Matrix on the GPU: worldMatrixPointer->SetMatrix(world);

  15. Parallel Rendering

  16. Parallel Rendering (Rendering Farms) • There are Three major Type Definitions • Sort-First • Sort-Middle • Sort-Last • These are just the outlines, in reality things need to be customised based on technical limitations / requirements

  17. Sort-Middle Application Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Sort Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Display Display Display Display

  18. Sort-Middle • Pros • The number of Vertex Processors is independent of the Number of Pixel Processors • Cons • Normal Maps may mess with Polygons on overlap areas • Correcting Aliasing between Display Tiles (RenderMan??) • Requires specific hardware • Rendering may not be balanced between Display Tiles

  19. Sort-Last Application Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Composite Display

  20. Sort-Last • Pros • Can be easily created from networked PCs • Cons • Each Vertex Processor requires a Pixel Processor • Unsorted Geometry means each Pixel Processor must carry a full-size frame buffer • Limited scalability • Composing the image requires integrating X frame buffers considering X Z-Buffers

  21. Sort-Last • Compositing can be done more efficiently (memory requirements) utilising a binary tree approach • May lead to idle processors • Another approach is a Binary Swap architecture • Large Data Bus usage

  22. Sort-First Application Sort Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Display Display Display Display

  23. Sort-First • Pros • Pixel Processors only need a tile of the display buffer • Can be created utilising PC hardware • Infinitely Scalable • Cons • We are sorting Primitives BEFORE they are translated into projected space!!! • This requires some overhead • Polygons crossing tiles will be sent to both pipelines • An error backup could consider a bus to move incorrectly sorted polygons to the correct render queue (Transparency causes issues here!) • Correcting Aliasing between Display Tiles • Rendering may not be balanced between Display Tiles

  24. Parallel Processing Techniques • Conclusively • Sort-Middle is for expensive hardware • Sort-Last is limited by scalability • Sort-First requires careful consideration on implementation • Sort First / Sort Last COULD be run on a Cloud • Bandwidth?? • Security?? • What happens when you max the cloud??

  25. Image Based Rendering • Geometric Upscaling! • The process of getting 3D information out of 2D image(s) • Far outside our scope, but interesting in Research

  26. https://renderman.pixar.com/ RenderMan

  27. RenderMan / Reyes • Reyes (Renders Everything You Ever Saw) • RenderMan is an implementation of Reyes • Reyes was developed by two staff at the ‘Lucasfilm's Computer Graphics Research Group’ now known as Pixar! • RenderMan is Pixar’s current implementation of the Reyes Architecture

  28. The Goals of Reyes • Model Complexity / Diversity • Shading Complexity • Minimal Ray Tracing • Speed • Image Quality (Artefacts are Unacceptable) • Flexibility • Reyes was designed so that new technology could be incorporated without an entire re-implementation

  29. The Functionality of Reyes / RenderMan • Objects (Polygons and Curves) are divided into Micro Polygons as needed • A Micro Polygon is a typically smaller than a pixel • In Reyes Micro Polygons are quadrilaterals • Flat shading all the Quads gives an excellent representation of shading • These quads allow Reyes to use a Vector Based Rendering Approach • This allows simple Parallelism

  30. Bound • Bounding Boxes • Split • Geometry Culling & Partials • Dice • Polygons into grids of Micro Polygons • Shade • Shading Functions are applied to the Micro Polygons • Functions used are Independent of Reyes • Bust • Do Bounding and Visibility checking on each Micro Polygon • Sample (Hide) • Generate the Render based on the remaining Micro Polygons

  31. The Reyes Pipeline • http://en.wikipedia.org/wiki/File:Reyes-pipeline.gif

  32. Interesting Facts • Some Frames take 90 hours!!! (1/24th of a second of footage) • On average Frames take 6 hours to render!!!! • 6 * 24 = 1 second = 144 Hours • About 2 years for a 2 hour Movie!!

  33. Licensing • $3500 us per Server • $2000us – 3500us per Client Machine • Far cheaper than expected, until you build your cluster....

  34. References http://en.wikipedia.org/wiki/Reyes_rendering http://en.wikipedia.org/wiki/Rendering_equation http://www.steckles.com/reyes1.html

More Related