<<

WELCOME! TODAYS TOPICS:

SOFT SHADOWS GP1 – Tracing

Recap

In 3D, light falls Angle also plays a role: off with distance:

2 Iin = IL / r Iin *= dot(L,N)

And finally, material color. GP1 –

Homework GP1 – Ray Tracing GP1 – Ray Tracing

Caustic(?) Dielectric(?) Shadow Sphere Plane N Quadratic falloff

Reflection

B T

P∙T - O∙T = fx u . scale P∙B - O∙B = fy v . shift P = O + fx * T + fy * B . modulo GP1 – Ray Tracing

Dielectrics: reflect and transmit

1. : RR = Reflect( D, N );

2. Transmittance: RT = ?

3. Ratio between the two: return ? * Trace(RR) + ? * Trace(RT) nt = index/1, nnt = 1 / index, ddn = D∙N cos2t = 1 – nnt2 * (1 – ddn2)  cos2t <= 0 ? TIR Snell 2 RT = normalize( D * nnt – N * (ddn * nnt * sqrt( cos t )) ); v = (nt - 1)2/(nt + 1)2 Fresnel 5 WT = v + (1 - v) * (1 + ddn) , WR = 1 – WT Schlick N GP1 – Ray Tracing

Christopher Schlick Willebrord Snel Augustin-Jean Fresnel GP1 – Ray Tracing

SO SHA FT DOW GP1 – Ray Tracing GP1 – Ray Tracing

25% 33.3% GP1 – Ray Tracing GP1 – Ray Tracing GP1 – Ray Tracing GP1 – Ray Tracing

Soft shadows:

. Approximated using N random rays . That means we get noise . More rays, less noise . Reduce variance: stratification . Reduce variance: converging GP1 – Ray Tracing

Other applications of randomness:

Anti-aliasing: send rays to random position on pixel fx = x / SCRWIDTH  fx = (x + rand()) / SCRWIDTH

Depth of field: send rays from random position on O += float3( rand() – 0.5f, rand() – 0.5f, rand() – 0.5f )

Motion blur: send rays to object at random time t = frameTime + rand()

Dispersion: randomly pick wavelength for primary ray λ = rand()

Use a high-quality random generator to prevent patterns: MERSENNE TWISTER GP1 – Ray Tracing

Other applications of randomness:

Homework

Implement glass

1. Make sure your reflections are working 2. Make sure you have N dot L and 1/r^2 shading 3. Modify Renderer::Trace

Next week: DEPTH OF FIELD ACCELERATION STRUCTURE