cs361 Software Engineering I - Carnegie Mellon School of ...
CS361
description
Transcript of CS361
![Page 1: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/1.jpg)
CS361Week 9 - Friday
![Page 2: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/2.jpg)
Last time
What did we talk about last time? Area lighting Environment mapping
Blinn and Newell's method Sphere mapping Cubic environmental mapping
![Page 3: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/3.jpg)
Questions?
![Page 4: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/4.jpg)
Project 3
![Page 5: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/5.jpg)
Assignment 4
![Page 6: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/6.jpg)
Student Lecture:Global Illumination
![Page 7: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/7.jpg)
Global Illumination
![Page 8: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/8.jpg)
The true rendering equation The reflectance equation we
have been studying is:
The full rendering equation is:
The difference is the Lo(r(p,l),-l) term which means that the incoming light to our point is the outgoing light from some other point
Unfortunately, this is all recursive (and can go on nearly forever)
iioo ωdθrLfL Ω
cos)),,((),(),( llpvlvp
iiio ωdθLfL Ω
cos),(),(),( lpvlvp
![Page 9: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/9.jpg)
Local lighting
Real-time rendering uses local (non-recursive) lighting whenever possible
Global illumination causes all of our problems (unbounded object-object interaction) Transparency Reflections Shadows
![Page 10: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/10.jpg)
Light paths
We can describe a path that light L makes to the eye E using the following notation
Operator
Description
Example
Explanation
* Zero or more S* Zero or more
specular bounces
+ One or more D+ One or more diffuse bounces
? Zero or one S? Zero or one specular bounces
| Either/or D|SSEither a diffuse or
two specular bounces
() Group (D|S)* Zero or more of diffuse or specular
![Page 11: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/11.jpg)
Shadows
![Page 12: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/12.jpg)
Which ball is closer?
![Page 13: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/13.jpg)
The blue one!
![Page 14: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/14.jpg)
No, wait…
![Page 15: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/15.jpg)
Shadows Shadow terminology:
Occluder: object that blocks the light
Receiver: object the shadow is cast onto
Point lights cast hard shadows (regions are completely shadows or not)
Area lights cast soft shadows Umbra is the fully shadowed part Penumbra is the partially
shadowed part
![Page 16: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/16.jpg)
Projection shadows A planar shadow occurs when an object casts a shadow
on a flat surface Projection shadows are a technique for making planar
shadows: Render the object normally Project the entire object onto the surface Render the object a second time with all its polygons set to
black The book gives the projection matrix for arbitrary
planes
![Page 17: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/17.jpg)
Problems with projection shadows We need to bias (offset) the
plane just a little bit Otherwise, we get z fighting and
the shadows can be below the surface
Shadows can be draw larger than the plane The stencil buffer can be used to
fix this Only opaque shadows work
Partially transparent shadows will make some parts too dark
Z-buffer and stencil buffer tricks can help with this too
Hard to see example from Shogo: MAD
![Page 18: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/18.jpg)
Other projection shadow issues Another fix for projection shadows is rendering
them to a texture, then rendering the texture Effects like blurring the texture can soften shadows
softer If the light source is between the occluder and the
receiver, an antishadow is generated
![Page 19: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/19.jpg)
Soft shadows True soft shadows occur due to area lights We can simulate area lights with a number of point lights
For each point light, we draw a shadow in an accumulation buffer We use the accumulation buffer as a texture drawn on the surface
Alternatively, we can move the receiver up and down slightly and average those results
Both methods can require many passes to get good results
![Page 20: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/20.jpg)
Convolution (blurring) You can just blur based on the amount of distance
from the occluder to the receiver It doesn't always look right if the occluder touches the
receiver Haines's method is to paint the silhouette of the
hard shadow with gradients The width is proportional to the height of the silhouette
edge casting the shadow
![Page 21: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/21.jpg)
Projection Shadows in SharpDX
![Page 22: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/22.jpg)
Upcoming
![Page 23: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/23.jpg)
Next time…
More on shadows Ambient occlusion
![Page 24: CS361](https://reader036.fdocuments.us/reader036/viewer/2022081520/56816103550346895dd047b4/html5/thumbnails/24.jpg)
Reminders
Keep working on Project 3 Finish Assignment 4!
Due tonight by midnight! Keep reading Chapter 9