Advanced image synthesis - Romain Vergne

Light: electromagnetic transverse wave. Read Siggraph 2014 course by Naty ... Visible light: between 400 and 700 nm ... Energy of the light (a color). ▫ Times the ...
1MB taille 1 téléchargements 343 vues
Romain Vergne

 Light: electromagnetic transverse wave

Read Siggraph 2014 course by Naty Hoffman – almost everything from there!! And images from « Real-time rendering » 3rd edition (A K Peters - 2008)

 Visible light: between 400 and 700 nm

 3 Modes of light / matter interaction

 3 Modes of light / matter interaction

 What about surfaces?

 Case of (optically) flat surface: Snell Descartes laws

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

In practice: use GLSL functions

Reflect(normal,light) Refract(normal,light,index)

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

Refraction is wavelet dependent

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

How rainbows work: • Refraction + internal reflection + refraction • Max for angle around 42 deg

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

 The amount of reflection vs refraction  Controlled with Fresnel law (electromagnetic wave)

 Case of (optically) flat surface: Snell Descartes laws  Incident ray is reflected…  … and refracted

 The amount of reflection vs refraction  Controlled with Fresnel law (electromagnetic wave)

 Why do surfaces appear that way?

 Incoming energy  Energy of the light (a color)  Times the scalar product between light direction and surface normal

 Incoming energy  Energy of the light (a color)  Times the scalar product between light direction and surface normal

 Outgoing energy?  Incoming energy  Times the response of the surface

 Reflected radiance equation equation (for a single light):

Output color

Material

Light color

Surface orientation

 Reflected radiance equation equation (for a single light):

Output color

 For multiple lights

Material

Light color

Surface orientation

 Reflected radiance equation equation (for a single light):

Output color

Material

Light color

 For multiple lights

?

Surface orientation

 Microgeometry bumps  Bigger than light wavelength  But too small to be visible!  Agregate of all response

~Mirror

~Rough

 Microgeometry bumps  Bigger than light wavelength  But too small to be visible!  Agregate of all response

 Microgeometry bumps  Bigger than light wavelength  But too small to be visible!  Agregate of all response

 Bidirectionnal  Reflectance

 Distribution  Function

 Bidirectionnal  Reflectance

 Distribution  Function Ideal diffuse surface

=?

 Bidirectionnal  Reflectance

 Distribution

Why does color change?

 Function Ideal diffuse surface

=?

 Bidirectionnal  Reflectance

 Distribution  Function Ideal specular surface

=?

 Bidirectionnal  Reflectance

 Distribution  Function Glossy surfaces

=?

 Bidirectionnal  Reflectance

 Distribution  Function Glossy surfaces

=?

 Decompose BRDF into diffuse and specular parts

Glossy surfaces

=?

 Reflection depends on the angle between the ideal reflection and the

view vectors

Specular lobe

 Reflection depends on the angle between the ideal reflection and the

view vectors  + ideal diffuse reflection

 Reflection depends on the angle between the ideal reflection and the

view vectors  + ideal diffuse reflection

 + ambient term

 Reflection depends on the angle between the ideal reflection and the

view vectors  + ideal diffuse reflection

 + ambient term

 Reflection depends on the angle between the ideal reflection and the

view vectors  + ideal diffuse reflection

 + ambient term

 Problems:  Does not conserve energy (may reflect more than it receives)  Not conform to BRDF model (cosine)

 Ambient is a total hack

 Problems:  Does not conserve energy (may reflect more than it receives)  Not conform to BRDF model (cosine)

 Ambient is a total hack  Remember the true equation:  BUT  Good results  Fast  Easy to control  Nice for artists and real-time applications!

•Plenty of BRDFs (they are specialized for certain kinds of materials) • • • • • • • • • •

Lambertian Phong Blinn-Phong Torrance-Sparrow Cook-Terrance Ward Oren-Nayar Ashikhmin-Shirley Lafortune etc...

•And also SVBRDF (for spatially varying BRDF) • material parameters change over the surface (usually using textures)

•And also BSSRDF (for Bidirectionnal Subsurface Scatering Distribution Function) • specific for translucent materials •More generally: BXDF for Bidirectionnal X Distribution Function

 In a vertex shader (Gouraud shading)

 In a fragment shader (Phong shading)  Phong did a lot of things!  Phong shading is not the same as the Phong model!

 In a vertex shader (Gouraud shading)

 Read this Siggraph course if your are interested in which kind of shading

is used in most recent games:

http://blog.selfshadow.com/publications/s2014-shading-course/