Science is either physics or stamp collecting Rutherford

  • Slides: 20
Download presentation
Science is either physics or stamp collecting. Rutherford Physics fundamentals of 3 D rendering

Science is either physics or stamp collecting. Rutherford Physics fundamentals of 3 D rendering Szirmay-Kalos László

3 D rendering pixel Tone mapping Virtual world color Real world

3 D rendering pixel Tone mapping Virtual world color Real world

Color perception: Monochromatic light 1 unit r, g, b color perception: r, g, b

Color perception: Monochromatic light 1 unit r, g, b color perception: r, g, b b g 444 526 r nm 645 2 1 400 b( ) g( ) 500 r( ) 600 700

Color perception: Polychromatic light F ( ) R = F ( ) r (

Color perception: Polychromatic light F ( ) R = F ( ) r ( ) d G = F ( ) g ( ) d B = F ( ) b ( ) d Color perception is linear (Grassmann’s laws) • Two times the spectrum = Two times r, g, b • Sum of two spectra = Sum of corresponding r, g, b values

Spectral versus RGB rendering model Rendering on many wavelengths R, G, B model Rendering

Spectral versus RGB rendering model Rendering on many wavelengths R, G, B model Rendering on 3 wavelengths Visible spectrum R, G, B Color matching R, G, B image

Radiance: L(r, V) F L(r, V) V F w A cos Power emitted by

Radiance: L(r, V) F L(r, V) V F w A cos Power emitted by a unit visible area surface into a unit solid angle [Watt/sr/m 2] F L(r, V) = A cos w r A F =L(r, V) A cos w

Wavelenths are independent e- e- • Relativistic mass is small: m=E/c 2 = hf/c

Wavelenths are independent e- e- • Relativistic mass is small: m=E/c 2 = hf/c 2 • Photon energy (frequency) does not change in elastic scattering

Smooth surfaces: Fresnel equation Lin in in in sin n= sin Lin F „Smooth”

Smooth surfaces: Fresnel equation Lin in in in sin n= sin Lin F „Smooth” = surface visible in a single pixel is a plane Lin (1 -F) F F 0 + (1 -F 0) (1 -cos in)5, F 0 = (n -1)2 + 2 (n+1)2 + 2

Fresnel function F ( , in) F( , in) in gold silver in

Fresnel function F ( , in) F( , in) in gold silver in

Reflection direction N v + N cosa v unit vector N cosa R a

Reflection direction N v + N cosa v unit vector N cosa R a a r cos a = - (v·N) R = v + 2 N cos a vec 3 reflect(vec 3 in. Dir, vec 3 normal) { return in. Dir - normal * dot(normal, in. Dir) * 2. 0 f; }; vec 3 Fresnel(vec 3 in. Dir, vec 3 normal) { (n -1)2 + 2 float cosa = -dot(in. Dir, normal); (n+1)2 + 2 vec 3 one(1, 1, 1); vec 3 F 0 = ((n–one)*(n–one) + kappa*kappa) / ((n+one)*(n+one) + kappa*kappa); return F 0 + (one – F 0) * pow(1 -cosa, 5); }

v + Ncosa v a Snell’s law sin a n= sin b Refraction direction

v + Ncosa v a Snell’s law sin a n= sin b Refraction direction N N sinb b T -Ncosb N v +Ncosa N = sina T = N sinb - Ncosb T = v /n + N(cosa/n- cosb) cosb = 1 -sin 2 a/n 2 T = v/n + N (cosa/n - 1 -(1 -cos 2 a)/n 2 ) vec 3 refract(vec 3 in. Dir, vec 3 normal, float ns) { float cosa = -dot(in. Dir, normal); float disc = 1 - (1 - cosa * cosa) / ns; if (disc < 0) return vec 3(0, 0, 0); return in. Dir/ns + normal * (cosa/ns - sqrt(disc)); }

Microscopic model: Rough surfaces in Surface visible in a pixel Black-box model

Microscopic model: Rough surfaces in Surface visible in a pixel Black-box model

Light-matter interaction Radiance = Irradiance BRDF L(r, V) = Lin(r, L) cos in fr

Light-matter interaction Radiance = Irradiance BRDF L(r, V) = Lin(r, L) cos in fr (L, r, V) def L (r, V) fr (L, r, V) = I(r, L) Helmholtz law: fr (L, r, V) = fr (V, r, L) V in L Lin ’ r

Diffuse reflection V N L in Radiance = Irradiance BRDF is independent of the

Diffuse reflection V N L in Radiance = Irradiance BRDF is independent of the viewing direction r l BRDF is independent of the viewing direction l Helmholtz: BRDF is independent of the illumination direction fr (L, r, V) = kd(r, ) l BRDF is constant: l l Diffuse reflection = very rough surfaces – Multiple light-matter interaction – colorful!

Lambert’s law BRDF is constant, BUT the reflected radiance does depend on the illumination

Lambert’s law BRDF is constant, BUT the reflected radiance does depend on the illumination direction Lref = Lin kd cos+ in cos in = N·L N in L

Specular (glossy) reflection (Phong-Blinn model) Halfway vektor H R in V Lref = diffuse

Specular (glossy) reflection (Phong-Blinn model) Halfway vektor H R in V Lref = diffuse + ks(cos+d)shine d N in V = Lin cos+ in + kd Lin ks (cos+d)shine H = (L+V)/|L+V| cosd = N·H L

Diffuse+glossy materials Multiple light-matter interaction ”own color” diffuse Single light-matter Interaction glossy Wavelength independent

Diffuse+glossy materials Multiple light-matter interaction ”own color” diffuse Single light-matter Interaction glossy Wavelength independent for nonmetals diffuse + glossy shininess = 5 10 20 50

Rough. Material // unit N unit V unit L vec 3 shade( vec 3

Rough. Material // unit N unit V unit L vec 3 shade( vec 3 normal, vec 3 view. Dir, vec 3 light. Dir, vec 3 in. Rad) { float cos. Theta = dot(normal, light. Dir); // unit vecs if(cos. Theta < 0) return vec 3(0, 0, 0); // self shadow vec 3 out. Rad = in. Rad * kd * cos. Theta; // diffuse vec 3 halfway = normalize(view. Dir + light. Dir); float cos. Delta = dot(normal, halfway); if(cos. Delta < 0) return out. Rad; return out. Rad + in. Rad * ks * pow(cos. Delta, shine); }

Light sources l Geometry + emitter radiance: l Abstract light sources: Le(r, V, )

Light sources l Geometry + emitter radiance: l Abstract light sources: Le(r, V, ) r V – Directional: rays are parallel, intensity is constant – Positional: rays connect the light source to the shaded point, intensity decrases with the square of the distance d Directional Positional

Rendering pixel Local illumination Recursive ray-tracing Global illumination

Rendering pixel Local illumination Recursive ray-tracing Global illumination