Drawing in 3D - UW Graphics...
Transcript of Drawing in 3D - UW Graphics...
![Page 1: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/1.jpg)
Drawing in 3D(viewing, projection, and the rest of the pipeline)
CS559 – Fall 2015Lecture 6
September 22, 2015
![Page 2: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/2.jpg)
![Page 3: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/3.jpg)
![Page 4: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/4.jpg)
The first 4 Key Ideas…1. Work in convenient coordinate systems. Use transformations
to get from where you want to be to where you need to be. Hierarchical modeling lets us build things out of pieces.
2. Use homogeneous coordinates and transformations to make common operations easy. Translation, projections, coordinate system shift all become simple matrix multiplies.
3. Create viewing transformations with projection. The geometry of imaging (pinhole camera model) leads to linear transformations in homogeneous coordinates.
4. Implement primitive-based rendering (interactive graphics) with a pipeline. The abstractions map nicely onto hardware, and let you do things like visibility computations easily. Be aware that there are other paradigms for drawing.
![Page 5: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/5.jpg)
The first 4 Key Ideas…1. Work in convenient coordinate systems. Use transformations
to get from where you want to be to where you need to be. Hierarchical modeling lets us build things out of pieces.
2. Use homogeneous coordinates and transformations to make common operations easy. Translation, projections, coordinate system shift all become simple matrix multiplies.
3. Create viewing transformations with projection. The geometry of imaging (pinhole camera model) leads to linear transformations in homogeneous coordinates.
4. Implement primitive-based rendering (interactive graphics) with a pipeline. The abstractions map nicely onto hardware, and let you do things like visibility computations easily. Be aware that there are other paradigms for drawing.
Last 2 Weeks
This Week (and next)
![Page 6: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/6.jpg)
ReCap: Basic Idea
To draw we need a coordinate system
Transformations canMove between coordinate systemsMove objects around
Useful transformations as matrices
![Page 7: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/7.jpg)
ReCap: Math
Points, Vectors, MatricesTransformations as linear operators
Matrices (homogeneous coordinates)
3D Coordinate Systemscross product, right hand rule
![Page 8: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/8.jpg)
ReCap: Code
Matrix stack• Save• Transform (concat)• Draw (current trans)• Restore
![Page 9: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/9.jpg)
What about 3D?
![Page 10: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/10.jpg)
How to draw in 3D?
We are making a 2D picture!
Do it …Like nature doesLike artists do
![Page 11: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/11.jpg)
Do it like Da Vinci!
![Page 12: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/12.jpg)
![Page 13: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/13.jpg)
Primitive-based Rendering
Draw 2D Objects in the imagePaint strokes on canvasLines / Triangles on screen
Map (Transform)3D primitives (world) to 2D primitives (screen)
![Page 14: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/14.jpg)
What does it take to do this?
1. Put a 3D primitive in the World2. Figure out what color it should be3. Position relative to the Eye4. Get rid of stuff behind you/offscreen5. Figure out where it goes on screen6. Figure out if something else blocks it7. Draw the 2D primitive
![Page 15: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/15.jpg)
In terms of the readings…
A lot of the pieces are thereNot necessarily in any particular order
Good for the detailsToday we’ll try for the big picture
![Page 16: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/16.jpg)
What does it take to do this?
1. Put a 3D primitive in the World2. Figure out what color it should be3. Position relative to the Eye4. Get rid of stuff behind you/offscreen5. Figure out where it goes on screen6. Figure out if something else blocks it7. Draw the 2D primitive
![Page 17: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/17.jpg)
1. Put a 3D primitive in the WorldModeling
2. Figure out what color it should beShading
3. Position relative to the EyeViewing / Camera Transformation
4. Get rid of stuff behind you/offscreenClipping
5. Figure out where it goes on screenProjection (sometimes called Viewing)
6. Figure out if something else blocks itVisibility / Occlustion
7. Draw the 2D primitiveRasterization (convert to Pixels)
![Page 18: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/18.jpg)
1. Put a 3D primitive in the WorldModeling
2. Figure out what color it should beShading
3. Position relative to the EyeViewing / Camera Transformation
4. Get rid of stuff behind you/offscreenClipping
5. Figure out where it goes on screenProjection (sometimes called Viewing)
6. Figure out if something else blocks itVisibility / Occlustion
7. Draw the 2D primitiveRasterization (convert to Pixels)
Did some, will do more
A little for P4, lots later
Today (FCG 7)
Not much to say (FCG 8)
Today (FCG 7)
This week (FCG 8)
Not much to say (FCG 8)
![Page 19: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/19.jpg)
In case you’re wondering…(We’ll come back to this. It’s a detail)For the kinds of projection we will use…
3D Points map to 2D Points3D Lines map to 2D Lines3D Triangles map to 2D Triangles
Doesn’t work for curves (even ellipses)
![Page 20: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/20.jpg)
Viewing
How to get from the object to the screen?
A transformation between coord systems
A little weird…
![Page 21: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/21.jpg)
3D to 2D
Do we lose a dimension?
No – we actually need to keep itYes – but we’ll just ignore Z
The screen as a fishtank
![Page 22: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/22.jpg)
Let’s build a viewing transform
A toy example (with code)
![Page 23: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/23.jpg)
My Neighbor …
![Page 24: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/24.jpg)
A (simple) bird
![Page 25: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/25.jpg)
A Tree for the Bird
![Page 26: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/26.jpg)
In it’s coordinate system
![Page 27: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/27.jpg)
Bird in Tree
![Page 28: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/28.jpg)
Bird in Tree, Tree in Park
![Page 29: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/29.jpg)
And a person to look at the bird…
![Page 30: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/30.jpg)
The Eye Coordinate System(or camera)
![Page 31: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/31.jpg)
Look At (the bird)
![Page 32: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/32.jpg)
Perspective (just wait)
![Page 33: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/33.jpg)
Look At (the bird)
![Page 34: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/34.jpg)
Where is everything in the Park?
pMbPoints in
Bird CoordsPoints inTree Coords
Mt
eMeMp
Bird inTree
Tree inPark
Points inPerson Coords
Eye Point0
Eye inPerson
Person inPark
Points inPark Coords
![Page 35: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/35.jpg)
Bird in Eye (Camera) Coordinates
pMbPoints in
Bird CoordsPoints inTree Coords
Mt
eMeMp
Bird inTree
Tree inPark
Points inPerson Coords
Points inEye Coordinates
Eye inPerson
Person inPark
Points inPark Coords
![Page 36: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/36.jpg)
e = Me-1 Mp
-1 Mt Mb p
pMbPoints in
Bird CoordsPoints inTree Coords
Mt
eMeMp
Bird inTree
Tree inPark
Points inPerson Coords
Points inEye Coordinates
Eye inPerson
Person inPark
Points inPark Coords
![Page 37: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/37.jpg)
e = Me-1 Mp
-1 Mt Mb p
pMbPoints in
Bird CoordsPoints inTree Coords
Mt
eMeMp
Bird inTree
Tree inPark
Points inPerson Coords
Points inEye Coordinates
Eye inPerson
Person inPark
Points inPark Coords
Modeling
Viewing
Model MatrixViewing Matrix
![Page 38: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/38.jpg)
From object to eye: ModelView
Modeling matrix: object to world
Viewing matrix: world to eye / cameraRigid Transformation (rotate/translate)
Invert the camera’s model matrixBuild a “LookAt / LookFrom” matrix
![Page 39: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/39.jpg)
Next Problem: Projection
Convert 3D (eye coordinates) to 2D (screen)A transformation
Types:OrthographicPerspectivesome others we won’t talk much about
![Page 40: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/40.jpg)
Orthographic Projection
Scale X and Y to fit things on screen
Note: we can look in any directionwe are already in camera coodinates!
![Page 41: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/41.jpg)
Orthographic Projections
SimplePreserves Distances
Objects far away same size as closeLooks weird
![Page 42: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/42.jpg)
Perspective Projections
Objects that are far away look smaller
![Page 43: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/43.jpg)
My sample P3 . . .
Orthographic Perspective
![Page 44: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/44.jpg)
Drawing in Perspective
![Page 45: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/45.jpg)
![Page 46: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/46.jpg)
![Page 47: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/47.jpg)
A draughtsman drawing a portrait, Albrecht Dürer, 1532. E.44-‐1894http://www.vam.ac.uk/content/articles/d/drawing-‐techniques/
![Page 48: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/48.jpg)
http://hans.wyrdweb.eu/about-‐perspective/
![Page 49: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/49.jpg)
Perspective Imaging
Eye Pointa.k.a.
Focal Point
ImagePlane
![Page 50: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/50.jpg)
Perspective Assumptions
There is a single focal point
Simplifying Assumptions: (not required)Image plane orthogonal to view directionImage plane centered on view direction
![Page 51: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/51.jpg)
Image plane in front of eyeImage plane behind eye
d d
d is the focal length
![Page 52: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/52.jpg)
Pinhole Camera
d
![Page 53: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/53.jpg)
Perspective math
![Page 54: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/54.jpg)
Perspective math 𝑦" =𝑑𝑧 𝑦
![Page 55: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/55.jpg)
Perspective Projection
This is linear in homogeneous coordinates
Rotate so w=z, the divide by w does the jobDetails in the book (or next class)
𝑦" =𝑑𝑧 𝑦𝑥" =
𝑑𝑧 𝑥
![Page 56: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/56.jpg)
Homogeneous Coordinates
What does this w axis do?
So far, it’s always been:1 (for points)0 (for vectors)
![Page 57: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/57.jpg)
Projective Equivalence
In homogeneous coordinates, points correspond to rays through the origin.
In 3D…The point x,y,z
Has a set of homogeneous coordinates:[x,y,z,1] [2x, 2y, 2z, 2], …
![Page 58: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/58.jpg)
The divide by w
For a 3D point x,y,zIt can be anything of the form:
[ α x, α y, α z, α ]
We consider the “hyperplane” [w=1] to be our “regular” 3D space. So we can convert:
[ '(
, )(
, *(
, 1 ] - divide by w
![Page 59: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/59.jpg)
Projective coodinates for 1D
1D (x) becomes (x,w)
x
w
![Page 60: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/60.jpg)
Simplest Projective Transform
𝑑 00 𝑑
0 00 0
0 00 0
0 11 0
𝑥𝑦𝑧1
𝑑𝑥𝑑𝑦1𝑧
=
After the divide by w…Note that this is dx/z, dy/z (as we want)Note that z’ is 1/z (we can’t keep Z)
Fancier forms scale things correctly
![Page 61: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/61.jpg)
All the coordinate systemsWindow (Screen) – in pixels
Normalized Device – [-1 1]
Camera / Eye
World
Object . . .
Local
![Page 62: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/62.jpg)
Transformations between eachWindow (Screen) – in pixels
Normalized Device – [-1 1]
Camera / Eye
World
Object . . .
Local
Viewport Trans
Projection
Viewing
Modeling
Modeling
![Page 63: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/63.jpg)
Program 3 Hints
All the transforms (even projection) are matrices.
The matrix library has them implementedYou don’t have to implement them yourself
but it’s important to understand them
TWGL’s “screen” coordinates are [-1 , 1]You have to convert to Canvas Pixels
![Page 64: Drawing in 3D - UW Graphics Groupgraphics.cs.wisc.edu/WP/cs559-fall2015/files/2015/09/06-3D.pdfDrawing in 3D (viewing, projection, and the rest of the pipeline) ... Implement primitive-based](https://reader030.fdocuments.in/reader030/viewer/2022041207/5d62504f88c993284d8bda49/html5/thumbnails/64.jpg)
Demos