Download presentation
Presentation is loading. Please wait.
Published byMitchell Randell Robertson Modified over 9 years ago
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 123 456 789 ABC DEF GHI + = 1+A2+B3+C 4+D5+E6+F 7+G8+H9+I 400 060 009 300 010 000 + = 700 070 009
5
Matrix Multiplication Row,Colum 123 456 789 ABC DEF GHI x = 1A + 2D + 3G 1B + 2E + 3H 1C + 2F + 3I 4A + 5D + 6G 4B + 5E + 6H 4C + 5F + 6I 7A + 8D + 9G 7B + 8E + 9H 7C + 8F + 9I 400 060 009 300 010 000 x = 1200 060 000
6
That’s great, what do I need them for? Translation Matrices Coordinates from Object Coordinates to world Coordinates ObjectTranslationWorld Typically we use a Matrix Multiplication 10000 0200 00-100 + = 11000 0300 00-100 1000 0 0 000
7
Scaling Scalar Matrices ObjectScalar (1/10)World 10000 0 0 00 0.1 x = 1000 0 0 00
8
Translation by Multiplication This is a computationally longer way to do a simple translation 100x 010y 001z 0001 x = 100x 010y 001z 0001 10010 0105 001 0001
9
Rotational Matrices http://en.wikipedia.org/wiki/Rotation_matrix#Dimensio n_three A Rotation around the unit vector u = (ux,uy,uz) glRotatef(Theta,x,y,z);
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= 048C 159D 26AE 37BF 0123456789ABCDEF
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 Sort Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Display Fragments (Pixel Shading) Geometry (Vertex Shading)
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 Composite Geometry (Vertex Shading) Geometry (Vertex Shading) Geometry (Vertex Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Display Fragments (Pixel Shading) Geometry (Vertex Shading)
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) Fragments (Pixel Shading) Fragments (Pixel Shading) Fragments (Pixel Shading) Display Fragments (Pixel Shading) Geometry (Vertex Shading)
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
RenderMan https://renderman.pixar.com/
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/24 th 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_equatio n http://www.steckles.com/reyes1.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.