cs130 : computer graphicsshinar/courses/cs130-fall-2015/lectures/lecture10.pdfperspective correct...
TRANSCRIPT
![Page 1: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/1.jpg)
CS130 : Computer Graphics Lecture 10: Texture Mapping (cont.)
Tamar ShinarComputer Science & Engineering
UC Riverside
![Page 2: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/2.jpg)
Perspective correct interpolation
![Page 3: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/3.jpg)
Perspective correct interpolation
• In assignment 1, we found barycentric coordinates in 2D screen space
• but not the correct object space barycentric coords
• these coordinates were okay for z-buffer test
![Page 4: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/4.jpg)
screenspace
objectspace
![Page 5: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/5.jpg)
screenspace
objectspace
Issue: to shade a fragment which is part of a textured trianglewe need the barycentric coordinates of the fragment These will be the weights for the weighted average of the vertex texture coordinates.However, after a perspective transformation, the relative distances inside the triangle have been distorted due to foreshortening.I need to get my weights based on object or world space coordinates.
![Page 6: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/6.jpg)
screenspace
objectspace
correct distorted
Interpolation with screen
space weights is incorrect
![Page 7: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/7.jpg)
Perspective correct interpolation
Using screen space weights looks wrong for textures
[Heckbert and Morton, 1990]
http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness
![Page 8: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/8.jpg)
Do we need to transform back to
object space?screenspace
objectspace
![Page 9: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/9.jpg)
NO!
Do we need to transform back to
object space?screenspace
objectspace
<whiteboard>
![Page 10: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/10.jpg)
Environment mapping
![Page 11: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/11.jpg)
Environment MappingUse a texture for the distant environment
simulate the effect of ray tracing more cheaply
Wikimedia Commons
![Page 12: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/12.jpg)
•Project objects in the environment onto sphere centered at eye•unwrap and store as texture•use reflection direction to lookup texture value
Sphere Mapping
How is environment mapping different from ray tracing? - typically only the direction of the reflection vector is used to look up the texture value- this doesn’t reproduce the true intersection of the reflected ray and the object it hits- Note: realism of environment map degrades as model is displaced from where the textures were generated
![Page 13: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/13.jpg)
Cube Mapping
•Compute six projections, one for each wall•store as texture•use reflection direction to lookup texture value
![Page 14: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/14.jpg)
Different environment maps
www.reindelsoftware.com
OpenGL spherical mapping
Blinn/Newell latitude mapping Cube mapping
![Page 15: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/15.jpg)
Environment Mapping
Create the effect of a mirror with two-pass rendering
1. First pass: render the scene from the perspective of the mirror2. Second pass: render from original pov; use the first image as a texture for the mirror
![Page 16: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/16.jpg)
Shadow Mapping
1. render scene from pov of light and store z-buffer in a texture
2. when rendering scene from desired pov, also render from light pov and test pixel against stored texture
first pass from light’s perspective
Wikimedia Commons
![Page 17: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/17.jpg)
[DirectX
Tutorial.com]
Bump Mapping
perturb normal vectors
doesn’t affect
silhouette
![Page 18: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/18.jpg)
http://www.lg.clanhost.cz
http://www.paulsprojects.net/tutorials/simplebump/simplebump.html
![Page 19: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/19.jpg)
Wikimedia Commons
bump mapping geometric detail
![Page 20: CS130 : Computer Graphicsshinar/courses/cs130-fall-2015/lectures/Lecture10.pdfPerspective correct interpolation •In assignment 1, we found barycentric coordinates in 2D screen space](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611f88612d4f016a643b90ae/html5/thumbnails/20.jpg)
Normal Mapping
Wikim
edia Com
mons