Game Engines 2021W Lecture 19: Difference between revisions
Created page with "==Resources== * Sarah Abraham's [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures.html Computer Graphics lecture notes], especially her notes on [https://www.cs.ut..." |
|||
Line 1: | Line 1: | ||
==Resources== | ==Resources== | ||
* Sarah Abraham's [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures.html Computer Graphics lecture notes], especially her notes on [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures/cs354-4.pdf ray tracing] and [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures/cs354-raytracing_pseudocode.pdf ray tracing pseudocode]. | * Sarah Abraham's [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures.html Computer Graphics lecture notes], especially her notes on [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures/cs354-4.pdf basic ray tracing] and [https://www.cs.utexas.edu/~theshark/courses/cs354/lectures/cs354-raytracing_pseudocode.pdf ray tracing pseudocode]. | ||
* Scratapixel's [https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/how-does-it-work introduction to ray tracing]. | * Scratapixel's [https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/how-does-it-work introduction to ray tracing] and [https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/implementing-the-raytracing-algorithm implementing ray tracing]. | ||
* [http://www.pbr-book.org/3ed-2018/Introduction/Photorealistic_Rendering_and_the_Ray-Tracing_Algorithm.html Photorealistic rendering and the ray tracing algorithm] from [http://www.pbr-book.org/3ed-2018/contents.html Physically Based Rendering: From Theory To Implementation] by Matt Pharr, Wenzel Jakob, and Greg Humphreys. | |||
* [https://cs.stanford.edu/people/eroberts/courses/soco/projects/1997-98/ray-tracin | |||
g/implementation.html Exercise on ray tracing] from | |||
http://advances.realtimerendering.com/s2015/DynamicOcclusionWithSignedDistanceFields.pdf | http://advances.realtimerendering.com/s2015/DynamicOcclusionWithSignedDistanceFields.pdf | ||
Line 20: | Line 24: | ||
Other graphics resources | Other graphics resources | ||
Ray tracing exercise | Ray tracing exercise |
Revision as of 21:34, 23 March 2021
Resources
- Sarah Abraham's Computer Graphics lecture notes, especially her notes on basic ray tracing and ray tracing pseudocode.
- Scratapixel's introduction to ray tracing and implementing ray tracing.
- Photorealistic rendering and the ray tracing algorithm from Physically Based Rendering: From Theory To Implementation by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
- [https://cs.stanford.edu/people/eroberts/courses/soco/projects/1997-98/ray-tracin
g/implementation.html Exercise on ray tracing] from
http://advances.realtimerendering.com/s2015/DynamicOcclusionWithSignedDistanceFields.pdf
Godot doesn't do ray tracing. But it is gaining support for some more advanced lighting techniques:
https://godotengine.org/article/godot-40-gets-sdf-based-real-time-global-illumination http://jamie-wong.com/2016/07/15/ray-marching-signed-distance-functions/
More on SDF
https://deepai.org/publication/signed-distance-fields-dynamic-diffuse-global-illumination
Other graphics resources
Ray tracing exercise
https://cs.stanford.edu/people/eroberts/courses/soco/projects/1997-98/ray-tracin
g/implementation.html
Notes
Ray Tracing
Key questions: - how does it work? - why is it so slow? How does light work, really? "Ground truth" for how light works is Quantum Electrodynamics - i.e., quantum mechanics for electromagnetism QED - you have photons, and you have electrons - photons are absorbed by electrons, and then they are emitted by electrons - when absorbed, electrons go to "higher" orbitals (higher energy) - when an electron moves to a lower energy orbital, it emits a photon so, to model light, ultimately we're modeling how electrons and photons interact Where does color come in? - frequency, i.e. energy, of photons - have to be in a specific frequency band to be visible light photons So, for rendering, why does this matter? - how things look is determined by how photons bounce around - their energy, hence their color, changes as they bounce around - brightness is how many photons you get Light is painful to model entirely because - there are LOTS of photons - they bounce EVERYWHERE - and this all affects how things look Perceived color is contextual - you don't know the color of anything until you know what its surroundings look like - human color perception is all about correcting for this physicists will say that photons have specific colors, i.e., their frequency - but actually, we perceive light based on the color of objects Something that is "red" will not emit red light (unless it is a light source). Instead, our brains model the scene and figure out it is red based on context - because different energy (color) photons will be emitted depending on lighting conditions Dim light, different color light (indoor vs sunlight), all affect the "energy" of photons but we can tell the difference, we see the same color. So even a pure physics-based model isn't enough, have to take into account human perception This is all to say that ray tracing has its benefits, but is far from a completely general solution - we'll discuss this more Ray tracing, we start with a received "photon", and we trace back its path to a light source - optimization, as we don't care about light that can't be perceived rays won't follow a direct path - interesting lighting effects come from how the rays bounce around - have to account for much (but not all) of this bouncing Part of the complexity is the recursive nature of the ray tracing algorithm The other part is how rays interact with surfaces - they are diffracted and reflected Earlier CGI tends to focus on reflections - think Terminator 2 - a fully reflective surface is "easiest", i.e., liquid metal - because we just have to model the surface as rays bouncing off at angles defined by the surface The real world is filled with surfaces that "capture" photons - they bounce around inside the object before releasing the photons Movies use ray tracing with complex material models But then, how are we doing "real time" ray tracing? - we're fast enough to do a lot of this recursion and support non-trivial surface models Regular lighting algorithms are not recursive at all - We at most consider one bounce - we often model surfaces as "self lighting" Godot does not support ray tracing currently - but this isn't that much of a disadvantage now, since it is rarely used in practice, and only in limited ways