Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Ray Tracing: Shadows, Specular Reflections, and Refractive Transmission, Study notes of Computer Graphics

The concepts of shadows, specular reflections, and refractive transmission in the context of ray tracing. It covers the phong illumination model, the importance of recursively tracing rays, and the calculation of refracted directions. The document also discusses the limitations of opengl's support for transparency and the importance of snell's law in refraction.

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-1b0-3
koofers-user-1b0-3 🇺🇸

10 documents

1 / 6

Toggle sidebar

Partial preview of the text

Download Understanding Ray Tracing: Shadows, Specular Reflections, and Refractive Transmission and more Study notes Computer Graphics in PDF only on Docsity! Looking at the Shading Model Recall our current Phong illumination model • sums contributions from all lights • plus the global ambient glow We’ll add three important new components • shadows, specular reflections, and specular transmission • our general strategy: recursively trace rays to evaluate shading • hence we call the method (recursive) ray tracing diffuse reflection all lights specular highlight ( ) ( )nL d L s L I I k I k= ⋅ + ⋅∑ n L r v L n θ v r φ Refractive Transparency OpenGL supports limited transparency • enable alpha blending • render objects back to front Doesn’t account for refraction • light rays bent at material boundaries • accounts for lenses among other Can account for refraction like reflection • when shading a given point • trace a transmitted ray into the material • need to compute refracted direction Air Glass Air Refraction of Light Rays transitioning between materials are bent around normal • every material has an index of refraction Angles with surface normal obey Snell’s Law where are indices of refractionsin sin i t ti t i θ η η η θ η = = n iθ tθ T I Material Index of Refraction vacuum 1.0 ice 1.309 water 1.333 ethyl alcohol 1.36 glass 1.5–1.6 diamond 2.417 Refraction of Light Refractive indices determine amount of bending • going from low index to higher index – ray is bent towards the normal – for example: air to glass • going from high index to lower index – ray is bent away from the normal – for example: glass to water Technically, this is a function of wavelength • that’s why prisms work (and why you see rainbows) • but for our purposes here, we’ll ignore this detail Computing the Transmitted Ray Angles of the incoming & transmitted rays obey Snell’s Law • this isn’t terribly convenient • need transmitted direction vector With a little math, we can derive the transmitted direction sin sin i t ti t i θ η η θ η = = n iθ tθ T I ( ) where and ( ) cos ii t c c c η η η η θ η η 2 2= + − 1+ −1 = = − ⋅ = T I n n I One Last Refractive Detail When entering material of lower index • ray bends outward from normal • what if the angle is more than 90°? – ray is actually reflected off the boundary – this is called total internal reflection – and it’s why fiber optics work Total internal reflection occurs when • just need to check for this critical angle • if above it, use specular reflection for “transmission” • if we’re exactly at the critical angle, things are a little weird iθ tθ critical critical where sin ti i η θ θ θ η −1> = Classification of Rays We’ve now seen four kinds of rays in the world • eye rays that leave the eye through a pixel • reflected rays that bounce off surfaces • transmitted rays that travel through them • shadow rays which test for occluders Every surface intersection spawns • 1 reflected ray • 1 transmitted ray • 1 shadow ray per light eye ray reflected ray shadow ray transmitted ray Ray Recursion Recursive ray tracing spawns a whole tree of rays • when eye ray hits a surface, we spawn reflected & transmission rays • when either of them hits a surface, they spawn 2 more • typically impose maximum recursion limit We will wind up tracing a lot of rays Recall the Structure of Shading Procedure rgbColor shade(surface s, ray r, double t)point x = r(t)rgbColor color = black for each light source Lif( closest_hit(shadow_ray(x, L)) >= distance(L) )color += shade_phong(s, x) color += k_specular * trace(reflected_ray(s,r,x)) color += k_transmit * trace(transmitted_ray(s,r,x)) return color What does this simulate? • Phong illumination+shadows (direct lighting of plastic) • perfect specular reflection (mirrors, chrome) • perfect specular transmission (glass, crystal) Distributed Ray Tracing A powerful method for extending classical ray tracing • also known as distribution ray tracing & stochastic ray tracing • has nothing to do with parallel computation over a network Simulate phenomena by distributing multiple rays • …over a pixel for spatial antialiasing • …over time for temporal antialiasing • …over a light source to simulate soft shadows • …over a cone of directions for glossy reflections • …over a lens for depth of field To get good results we must do this with care • select a good method for distributing rays • don’t want number of rays traced to expand out of control From the First Distributed Ray Tracer Note the various phenomena • glossy reflections • soft shadows • motion blur – including of reflections • antialiasing is implicit • used 16 samples/pixel Robert L. Cook and Thomas Porter and Loren Carpenter. Distributed Ray Tracing. SIGGRAPH 84. Glossy Reflections Our current method simulates perfect specular reflection • is only really true for perfect mirrors • simulates metals like chrome fairly well Most surfaces are imperfect specular reflectors • reflect rays in cone around perfect reflection direction • glossy reflections rather than mirror images • Phong model tries to fake this kind of thing We can directly simulate real glossy reflection • for an incoming ray direction – instead of always shooting ray in perfect reflected direction – stochastically sample rays within cone of reflected directions • strength of reflection drops off rapidly from mirror direction • probability of sampling that direction should fall off similarly The Structure of Soft Shadows Area Light Source Occluder or Blocker Umbra (complete shadow) Penumbra (partial shadow) Penumbra (partial shadow) Soft Shadows Our previous shadow method • for the point we’re shading • cast a ray towards point light • hit surface before light = shadow • otherwise no shadow Extends directly to area lights • sample multiple spots on light • look at fraction hitting surfaces • indicates level of shadow – none hit = full illumination – all hit = full shadow – some hit = partial shadow
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved