Reflection and Transmission Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center.

Slides:



Advertisements
Similar presentations
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Advertisements

CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 6.
Electromagnetic Waves Physics 202 Professor Vogel (Professor Carkner’s notes, ed) Lecture 12.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
Ray Tracing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of.
3/23/2005 © Dr. Zachary Wartell 1 Illumination Models and Surface- Rendering Methods.
Shading in OpenGL Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Reflection & Refraction of Light Reflection: specular (mirror) vs diffuse angle of incidence = angle of reflection Refraction: Snell’s Law n 1 sin 
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2006 Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Environmental Maps Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
University of New Mexico
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Sampling and Aliasing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Simple Improvements to LI: Shadows Image Based Lighting László Szécsi.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Shading Surface can either (both) 1.Emit light. E.g. light bult 2.Reflect light. E.g. Mirror.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
RAY TRACING WITH DISPERSION CSS552 – Topics in Rendering Winter 2011 Final Project by: Kohei Ueda Shivani Srikanteshwara Mary Ann Chiramattel Kunjachan.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Reflection and Refraction. Reflection Two laws of reflection Angle of incidence = angle of reflection The angle of incidence, angle of reflection and.
Reflections Specular reflection is the perfect reflection of light from a surface. The law a reflection states that the direction of the incoming ray and.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Radisoity Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Material Representation K. H. Ko School of Mechatronics Gwangju Institute.
CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
Chapter 22 Reflection and Refraction of Light. The Particle Nature of Light “Particles” of light are called photons Each photon has a particular energy.
Optics Reflection, Refraction & Snell’s Law Lesson 2
Introduction to Computer Graphics with WebGL
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Bump Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Light. Intensity calculation = wavelength I( ) = wavelength intensity of light reaching eye I( ) = I diff ( ) + I spec ( ) + I refl ( ) + I trans ( )
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Reflectance Models CS 319 Advanced Topics in Computer Graphics John C. Hart.
Computer Graphics: Illumination
University of New Mexico
Introduction to Computer Graphics with WebGL
Programmable Pipelines
Unit-7 Lighting and Shading
Shading II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Angel: Interactive Computer.
Models and Architectures
Reflection and Transmission
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Fundamentals of Computer Graphics Part 6 Shading
Reflection and Transmission
Presentation transcript:

Reflection and Transmission Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico

2 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction Interactions between light and materials Phong model ­Absorbtion ­Diffuse and specular reflections ­Puerely local Reflection: Translucent surfaces ­Refraction ­Frensel effect ­Chromatic dispersion

3 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Global vs Local Most of these effects can only be computed in a global renderer such as a ray tracer

4 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Ray Tracing Ray tracers can make use of all these effects in a global calculation by tracing rays R N -N L T

5 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Environmental Map Can use all these effects Implement in Cg with vertex and fragment programs

6 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Refraction With pure refraction, all the light is transmitted but the angle of refraction is determined by Snell’s law ή l sin θ l = ή t sin θ t where ή l and ή t are the speed of light relative to the speed of light in a vacuum Let ή = ή l / ή t

7 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Computing T ή 2 sin 2 θ l = ή 2 (1- cos 2 θ l )= sin 2 θ t = 1-cos 2 θ t Solving for cos θ t Assuming normalized vectors cos θ t = T·N = (1- ή 2 (1-cos 2 θ l )) 1/2 where cos θ l = T·N T, N, and L must be coplanar T =  L +  N and T·T = 1 Solving T = -1/ ή L – (cos θ t - 1/ ή cos θ l ) N

8 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Notes Critical angle: total internal reflection 1= ή 2 (1-cos 2 θ l ) Snell’s law is a statement that light takes the shortest path (in time) Can apply to reflection maps (see Cg Tutorial) via vertex program

9 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Fresnel Effect Some light is reflected and some transmitted at surface between two materials Amount of light reflected is greatest at shallow angle Approximation: use affine combination of refracted and reflected colors where  =  max (0, min(1, bias + scale  (1 + L·N) power ))

10 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Chromatic Dispersion The refraction coefficient is actually a function of wavelength  N -N L TbTb TgTg TrTr

11 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Chromatic Dispersion with Cg Easy to do with reflection maps Use three values of  Make use of vector operations

12 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Fragment Program void C7E5v_dispersion(float4 position : POSITION, float3 normal : NORMAL, out float4 oPosition : POSITION, out float reflectionFactor : COLOR, out float3 R : TEXCOORD0, out float3 TRed : TEXCOORD1, out float3 TGreen : TEXCOORD2, out float3 TBlue : TEXCOORD3, uniform float fresnelBias, uniform float fresnelScale, uniform float fresnelPower, uniform float3 etaRatio, uniform float3 eyePositionW, uniform float4x4 modelViewProj, uniform float4x4 modelToWorld) {

13 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Fragment Program oPosition = mul(modelViewProj, position); // Compute position and normal in world space float3 positionW = mul(modelToWorld, position).xyz; float3 N = mul((float3x3)modelToWorld, normal); N = normalize(N); // Compute the incident, reflected, and refracted vectors float3 I = positionW - eyePositionW; R = reflect(I, N); I = normalize(I); TRed = refract(I, N, etaRatio.x); TGreen = refract(I, N, etaRatio.y); TBlue = refract(I, N, etaRatio.z); // Compute the reflection factor reflectionFactor = fresnelBias + fresnelScale * pow(1 + dot(I, N), fresnelPower ); }

14 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Fragment Program void C7E6f_dispersion(float reflectionFactor : COLOR, float3 R : TEXCOORD0, float3 TRed : TEXCOORD1, float3 TGreen : TEXCOORD2, float3 TBlue : TEXCOORD3, out float4 color : COLOR, uniform samplerCUBE environmentMap0, uniform samplerCUBE environmentMap1, uniform samplerCUBE environmentMap2, uniform samplerCUBE environmentMap3) {

15 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Fragment Program // Fetch the reflected environment color float4 reflectedColor = texCUBE(environmentMap0, R); // Compute the refracted environment color float4 refractedColor; refractedColor.x = texCUBE(environmentMap1, TRed).x; refractedColor.y = texCUBE(environmentMap2, TGreen).y; refractedColor.z = texCUBE(environmentMap3, TBlue).z; refractedColor.w = 1; // Compute the final color color = lerp(refractedColor, reflectedColor, reflectionFactor); }