TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA
CS 148, Summer 2012 Introduction to Computer Graphics and Imaging
Justin Solomon
http://www.kunzhou.net/2010/mptracing.pdf
3D geometry 2D pipeline
Matrices preserve flat geometry
0BB@
: : :
matrix
: : :
1CCA£ =
Matrices preserve flat geometry
0BB@
: : :
matrix
: : :
1CCA£ =
Matrices preserve flat geometry
0BB@
: : :
matrix
: : :
1CCA£ =
Matrices preserve flat geometry
0BB@
: : :
matrix
: : :
1CCA£ =
3D triangles look like 2D triangles
under camera transformations.
3D triangles look like 2D triangles
under camera transformations.
Only true for flat shapes! http://drawntothis.com/wp-content/uploads/2010/09/Random_Guy.jpg
Only true for flat shapes! http://drawntothis.com/wp-content/uploads/2010/09/Random_Guy.jpg
1. Apply camera transformation to all triangles in the scene.
2. Render them one at a time.
Draw items one at a time
Draw items one at a time
Draw items one at a time
Draw items one at a time
Pre-compute rendering order Cut geometry as needed …
Each pixel can decide what is on
top independently.
Each pixel can decide what is on
top independently.
Render depth alongside color http://upload.wikimedia.org/wikipedia/commons/4/4e/Z_buffer.svg
Fragment blending phase
Generate fragments containing color and
depth
http://ps-2.kev009.com/CATIA-B18/basug_C2/basugbt1510.htm
Offset or scale one of the objects
Offset or scale one of the objects
Integer Arithmetic!
[znear; zfar] 7! f0;1; : : : ;B¡ 1g[ f1g
¢z =zfar ¡ znear
B
Integer Arithmetic!
[znear; zfar] 7! f0;1; : : : ;B¡ 1g[ f1g
¢z =zfar ¡ znear
B
Integer Arithmetic!
[znear; zfar] 7! f0;1; : : : ;B¡ 1g[ f1g
¢z =zfar ¡ znear
B
zworld 7! z = znear + zfar ¡znearzfar
zworld
dz
dzworld=
znearzfar
z2world
zworld 7! z = znear + zfar ¡znearzfar
zworld
dz
dzworld=
znearzfar
z2world
¢z ¼ znearzfar¢zworld
z2world
zworld 7! z = znear + zfar ¡znearzfar
zworld
¢z ¼ znearzfar¢zworld
z2world
Better resolution when closer to the screen.
http://www.cs.unc.edu/Courses/comp575-f11/present/present11.html
For each of six planes do
If entirely outside of half space
Break (not visible)
Else if triangle intersects plane
Clip triangle
If quadrilateral is left
Break into two triangles
Textbook, page 171
Cull [kuhl]: To identify and throw away invisible geometry to save processing time.
Textbook, page 181
View volume culling: remove geometry outside frustum
Occlusion culling: remove invisible geometry
Backface culling: remove geometry facing away from the camera
http://i.minus.com/i75qjiyFQzVCI.jpg
Potential strategies: Approximate frustum with simpler shape Store scene hierarchically …
Portal rendering http://www.aaid.ca/flash/media/hkmh/images/floor1/000a-geology-portal-cg-rendering.jpg
Potentially Visible Set (mirror reflection!) http://www.cs.virginia.edu/~luebke/publications/portals.html
Normal [nawr-muhl]: A vector perpendicular to a surface or piece of geometry; constant for planes and triangles.
Cull triangles with back-facing normals http://medialab.di.unipi.it/web/IUM/Waterloo/node70.html
None Backface culling
Hidden surface removal
http://www.gamerendering.com/category/optimizations/culling-optimizations/
http://artist-3d.com/free_3d_models/uploads/mantalray.jpg
Reflection and Shadows
http://www.archicadwiki.com/Bugs/TransparencyIn3dWindow
Transparency
Depth of Field http://www.seemsartless.com/guides/camera-dof-cars-fast-360.jpg
http://littlemissmetamorph.blogspot.com/2011/07/game-inspired-portal-doing-makeup-with.html
Nonphysical effects
http://www.implovator.com/wp-content/uploads/2010/11/teapot_flat.png http://upload.wikimedia.org/wikipedia/commons/4/4e/Z_buffer.svg
Flat shading is boring.
Depth values aren’t flat.
f(~v3)
f(~v2)
f(~v1)
f(~v)?
f(~v3)
f(~v2)
f(~v1)
f(~v)?
f(~v) =
3X
i=1
®i(~v)f(~vi)
f(~v3)
f(~v2)
f(~v1)
f(~v)?
f(~v) =
3X
i=1
®i(~v)f(~vi)
f(~v3)
f(~v2)
f(~v1)
A3
A2
A1
f(~v3)
f(~v2)
f(~v1)
A3
A2
A1
®i =Ai
A1 +A2 +A3
Lots of nice properties:
3X
i=1
®i = 1
Lots of nice properties:
~v 2¢(~v1;~v2;~v3)
0 · ®i(~v) · 1 8i
Lots of nice properties:
Can compute using
linear solves,
cross products, ...
Lots of nice properties:
Right way to
interpolate depths
Lots of nice properties:
Right way to
interpolate depths
~a ¢~b = k~akk~bk cos µ = axbx + ayby + azbz
µ
Used for: Projecting vectors
onto other vectors
Checking orthogonality
~a~b
~a£~b =
¯̄¯̄¯̄
~i ~j ~k
ax ay azbx by bz
¯̄¯̄¯̄ ; k~a£~bk = k~akk~bkj sin µj
µ
Used for: Finding normals
Checking if vectors
are parallel ~a
~b
~a£~b
Rasterize 3D scenes with occlusion and
per-vertex shading.
TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA
CS 148, Summer 2012 Introduction to Computer Graphics and Imaging
Justin Solomon
http://www.kunzhou.net/2010/mptracing.pdf