CS361
description
Transcript of CS361
![Page 1: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/1.jpg)
CS361Week 10 - Wednesday
![Page 2: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/2.jpg)
Last time
What did we talk about last time? Shadow volumes and shadow
mapping Ambient occlusion
![Page 3: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/3.jpg)
Corrections
I said that shadow maps couldn't be used with point lights, only directional lights
That was incorrect! The "view" from a point light should
be modeled with a perspective projection while a directional light should be modeled with an orthographic projection
![Page 4: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/4.jpg)
Questions?
![Page 5: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/5.jpg)
Project 3
![Page 6: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/6.jpg)
Assignment 4
![Page 7: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/7.jpg)
Student Lecture:Reflections
![Page 8: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/8.jpg)
Reflections
![Page 9: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/9.jpg)
Environment mapping
We already talked about reflections!
Environment mapping was our solution
But it only works for distant objects
![Page 10: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/10.jpg)
Planar reflections The simplest reflections to deal with are planar
reflections Reflections off of a flat surface like a mirror
An ideal reflector follows the law of reflection Angle of incidence is the angle of reflection Reputedly discovered by Hero of Alexandria between
10 and 70 AD Vector form: where is the reflected vector, is the
incoming vector, is the surface normal
angle ofincidence
viewer
n
angle of reflectionreflector
![Page 11: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/11.jpg)
Reflection rendering The reflected
object can be copied, moved to reflection space and rendered there
Lighting must also be reflected
Or the viewpoint can be reflected
![Page 12: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/12.jpg)
Transparency Reflector must be partially transparent so that the reflected
scene can be viewed The degree of transparency acts simulates the reflectivity
factor Care must be taken when setting up back face culling for
the reflection pass Also, the scene may be rendered where there is no reflector
![Page 13: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/13.jpg)
Hiding incorrect reflections
This problem can by solved by using the stencil buffer
The stencil buffer is set to areas where a reflector is present
Then the reflector scene is rendered with stenciling on
![Page 14: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/14.jpg)
Hiding things behind the mirror Objects behind the mirror should not
be rendered A user defined clipping plane can
solve this problem Create a clipping plane and place it
on the same plane as the mirror
![Page 15: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/15.jpg)
Visual improvements
Reflections can be enhanced by blurring them or fading them to black as the viewer moves away
Objects can be rendered to a texture with a Z-buffer
The Z-buffer can be used to blur or darken objects that are further away
Frosted glass can also be created by blurring
![Page 16: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/16.jpg)
Curved Reflections Ray tracing can be
used to create general reflections
Environment mapping can be used for recursive reflections in curved surfaces
To do so, render the scene repeatedly in 6 directions for each reflective object
![Page 17: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/17.jpg)
Transmittance
![Page 18: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/18.jpg)
Transmittance
How much light gets through your material?
That's transmittance
If your samples are of equal thickness, you can apply a color filter
![Page 19: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/19.jpg)
Beer-Lambert Law
The Beer-Lambert law says how much light gets through an object of varying thickness
Transmittance is:
where is the absorption coefficient, c is the concentration of the material and d is the thickness d
![Page 20: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/20.jpg)
Refractions
![Page 21: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/21.jpg)
What is refraction?
It's a property of waves (not just light)
Describes the way the path of waves is bent when it changes medium
![Page 22: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/22.jpg)
What causes refraction?
Refraction and diffraction results of the Huygens–Fresnel principle
Each point of a medium disturbed by a wave becomes a point of propagation for the disturbance
![Page 23: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/23.jpg)
Principle of Least Time
Another way of looking at refraction is through the Fermat's Principle of Least Time
The path taken between two points by a ray of light is the path that can be traversed in the smallest amount of time
The light actually bends to spend less time in a slower material
![Page 24: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/24.jpg)
Snell's Law
Snell's Law allows us to calculate the amount of refraction
![Page 25: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/25.jpg)
Total internal reflection
If the angle of refraction is greater than the critical angle, the light will be reflected back into the initial medium
![Page 26: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/26.jpg)
Exotic effects If the material has different
refractive indices for different polarizations, two images will appear offset from each other Birefringence
The delta between the refractive indices of different polarizations determines how much the light will be offset
Modern metamaterials exist with a negative refractive index
In those cases, light is refracted on the same side of the normal as the incidence
![Page 27: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/27.jpg)
XNA Reflection and Refraction Examples
![Page 28: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/28.jpg)
Caustics
![Page 29: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/29.jpg)
It’s burning!
Light is focused by reflective or refractive surfaces A caustic is the curve or surface of concentrated light The name comes from the Greek for burning
Reflective:
Refractive:
![Page 30: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/30.jpg)
Image space rendering First:
The scene is rendered from the view of light
Track the diversion of light and see which locations are hit
Store the result in an image with Z-buffer values called a photon buffer
Second: Treat each location that received light as
a point object called a splat Transform these to eye viewpoint and
render them to a caustic map Third:
Project the map onto the screen and combine with the shadow map
![Page 31: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/31.jpg)
Object Space Rendering Look at each generator triangle
Those that are specular or refractive Each vertex on each generator triangle has a normal Create a caustic volume like a shadow volume except
that the sides are warped by either reflection or refraction
For receiver pixels in the volume, intensity is computed
![Page 32: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/32.jpg)
Some other examples
![Page 33: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/33.jpg)
Global Subsurface Scattering
![Page 34: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/34.jpg)
Subsurface scattering Subsurface scattering occurs when light
enters an object, bounces around, and exits at a different point
If the exit point is close to the entrance point (in the same pixel), we can use a BRDF
If it spans a larger distance, we need an algorithm to track photon propagation
![Page 35: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/35.jpg)
Subsurface scattering Examples
Pearlescent paint Human skin▪ Which matters
Causes Foreign Particles (pearls) Discontinuities (air bubbles) Density variations Structural changes
We need to know how long light has traveled through the object
Tracking individual photons is impossible, so all algorithms will be statistical
![Page 36: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/36.jpg)
Blurring normals and lighting Subsurface scattering does not affect specular reflection We often use normal maps to add detail to specular reflection
characteristics Some work suggests that this same normal map should be ignored
for diffuse terms Or the normals can be blurred further since surface direction appears
to change slowly if light from other directions is exiting diffusely More complex models render the diffuse lighting onto a texture and
then selectively blur R, G, and B components for more realism
This texture space diffusion technique was
used in The Matrix Reloaded
for rendering skin
![Page 37: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/37.jpg)
Depth map techniques We could cast rays into objects to see where they
come out, but it's expensive An alternative is to use depth maps to record how
far the light travels through the object which determines how colored by the object it is Refraction when the light enters the object is usually
ignored Only exiting refraction is computed
![Page 38: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/38.jpg)
Quiz
![Page 39: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/39.jpg)
Upcoming
![Page 40: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/40.jpg)
Next time…
Radiosity Ray Tracing Precomputed lighting Precomputed occlusion Precomputed radiance transfer
![Page 41: CS361](https://reader035.fdocuments.net/reader035/viewer/2022062814/56816739550346895ddbed23/html5/thumbnails/41.jpg)
Reminders
Keep working on Project 3 Due next Thursday by midnight
Keep reading Chapter 9