ray-tracing photorealism reflection, refraction bump maps
Post on 21-Dec-2015
225 views
TRANSCRIPT
![Page 1: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/1.jpg)
Ray-tracing
PhotorealismReflection, Refraction
Bump maps
![Page 2: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/2.jpg)
Overview
• Textures review• Lighting re-visited• Photorealism + Global Illumination
– Reflection– Refraction
• Bump Maps / Normal maps• Lab
![Page 3: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/3.jpg)
© Gilles Tran
![Page 4: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/4.jpg)
The Phong Illumination algorithm cannot generate images like these
![Page 5: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/5.jpg)
The Rendering Equation
• I(x, x’) = intensity of light passing from x to x’ – (two point transport)
• g(x, x’) =
– (geometry factor)• (x, x’) = intensity of light emitted by x and passing to x’ • ρ (x, x’, x”) = bi-directional reflectance scaling factor for
light passing from x” to x by reflecting off x’• S = all surfaces in the scene
s
dxxxIxxxxxxxgxxI ]")",'()",',()',()[',()',(
0 if x and x’ are not mutually visible
1/r2 where 'xxr
[Kajiya 1986]
Attenuation (distance from x to x’)
A physicists representation of light transport in the scene, describing the amount of light going from any point x to another point x’:
![Page 6: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/6.jpg)
• Light_transport_from B to A:– Emmitance of B– Visibility of B from A– Distance to B from A
• Also:– Reflectance of B– Light_transport_fro
m Ci to B• Emmitance of C• Visibility of C from B• Distance to C from B
A
B
C1
C2
C3
D1
![Page 7: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/7.jpg)
Assumptions• I on both sides of the equation suggests an
infinitely recursive path of light transfer.– We need to make some simplifying assumptions in order
to solve this equation
• Local Illumination algorithms assume light only “bounces” once travelling from light source to a point in the scene and then to the eye
• Global Illumination algorithms account for light transport between several points on the scene before reaching the eye (several bounces)– Thus can account for refraction, shadows, reflections etc.
More expensive, usually used in off-line rendering
Less realistic, usually used in real-time rendering
![Page 8: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/8.jpg)
Local vs. Global Illumination
LocalLocal GlobalGlobal
Illumination depends on local object &light sources only
Illumination at a point can dependon any other point in the scene
![Page 9: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/9.jpg)
Ray Tracing• A photo-realistic
rendering algorithm
• Current ray tracing methods are attributed to Turner Whitted (Bell Labs. 1980) Whitted Illumination Model
• First implementation of ray tracing in computer graphics = Appel (IBM 1968)
• Recursive Raytracing, 1979• Recorded in “An Improved
Illumination Model for Shaded Display” (Bell Labs, 1980).
![Page 10: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/10.jpg)
Ray-tracing based on ideas employed since early Renaissance artists e.g. daVinci & Dürer
Albrecht Dürer (1471-1528)
![Page 11: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/11.jpg)
Ray Tracing
• The Direct Diffuse Term Ilocal is calculated empirically (using Phong illumination)
• In the global ray-traced terms, diffusion of light due to surface imperfections is totally ignored.
I(P) = Ilocal(P) + krgI(Pr) + ktgI(Pt)Local term
(as in Phong)Reflected Transmitted
![Page 12: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/12.jpg)
Ray Tracing from Eye
Traditional ray-tracing
Tracing from light source
Starting at the light position traces many rays that never reach the eye. Thus the traditional ray-tracing method is to start at the eye and trace rays back-wards to the source.
![Page 13: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/13.jpg)
Eye Ray and Object Intersection
Cast a ray from camera position through each pixel into the scene.
Calculate where this intersects with objects in the scene. Get the first intersection.
![Page 14: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/14.jpg)
Diffuse Term
• Extend a “Shadow Feeler” (or light ray) and see if it is occluded by an object in the scene
• If so the object is in shadow from this light source • Otherwise solve the phong model to calculate the
contribution of this point to the colour of the pixel.• If object is diffuse stop here.
![Page 15: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/15.jpg)
Reflection
• For this new ray, we will again check whether…– it intersects an object, – if so is this object in shadow– what is the contribution of this object to the colour of the
pixel?
• Each ray contributes to the colour of the pixel it originated from
• If object is specular THEN create a ray in the direction of perfect specular reflection.
![Page 16: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/16.jpg)
Refraction
• Similarly if the object is transmissive (not-opaque) then generate a transmitted (or refracted) ray and repeat…
![Page 17: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/17.jpg)
The Angle of Refraction
• When light passes from a material of one optical density to another it changes direction.
• The amount by which the direction changes is determined by the optical densities of the two media.
• Optical density (and thus the amount of bending is related to a value we call the refractive index of the material.
45i
32r 28r 17r
Diamond
Air
Glass
Air
Water
Air
45i 45i
![Page 18: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/18.jpg)
Index of Refraction (ior)Material Index of Refraction
Vacuum 1.0000 <--lowest optical density
Air 1.0003
Ice 1.31
Water 1.333
Ethyl Alcohol 1.36
Plexiglas 1.51
Crown Glass 1.52
Light Flint Glass 1.58
Dense Flint Glass 1.66
Zircon 1.923
Diamond 2.417
Rutile 2.907
Gallium phosphide 3.50 <--highest optical density
You can try these refracted index values in POVRay.
![Page 19: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/19.jpg)
Ray Tracing Summary
![Page 20: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/20.jpg)
Ray Tracing Issues
1) Cast a ray2) Determine Intersections3) For closest Intersection:
– Extend light(shadow feeler) ray + calculate local term
– Spawn Transmitted Ray (step 1)– Spawn Reflected Ray (step 1)
I(P) = Ilocal(P) + krgI(Pr) + ktgI(Pt)
![Page 21: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/21.jpg)
Ray Tree
The spawning of reflected and refracted rays can be represented in tree structure.
![Page 22: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/22.jpg)
Terminating Recursion
• All of the spawned rays contribute to the pixel that the tree originated from.
• However each new ray contributes less and less to the pixel.
• Unlike in the real-world, we can’t keep bouncing around for ever so we stop the recursion at some stage recursion clipping.– Stop after a set number of bounces.– Or stop when the contribution becomes less
than a certain value.
![Page 23: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/23.jpg)
Recursion Clipping
max level = 1max level = 1 max level = 2max level = 2
max level = 4max level = 4max level = 3max level = 3Very high maximum recursion level
![Page 24: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/24.jpg)
Object Intersection
• Intersection testing is solved mathematically. But is an inherently expensive geometrical problem. (out of the scope of current lecture)
Where does ray intersect object?
Where does ray intersect scene?
![Page 25: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/25.jpg)
for each pixel in viewport{ determine eye ray for pixel intersection = trace(ray, objects) colour = shade(ray, intersection)}
Intersection trace(ray, objects){ for each object in scene intersect(ray, object) sort intersections return closest intersection}
The Ray Tracing Algorithm
![Page 26: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/26.jpg)
colour shade(ray, intersection){ if no intersection return background colour
for each light source if(visible) colour += Phong contribution
if(recursion level < maxlevel) { ray = reflected ray intersection = trace(ray, objects) colour += refl*shade(ray, intersection) ray = transmitted ray intersection = trace(ray, objects) colour += trans* shade(ray, intersection) } return colour}
The Ray Tracing Algorithm
![Page 27: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/27.jpg)
Reflection
finish{
reflection 0.5//phong etc…
}
![Page 28: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/28.jpg)
Translucency
texture { pigment { rgbf <1, 1, 1, .8> } }
Filter value of 0 is fully opaque, 1 is fully transparent.
![Page 29: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/29.jpg)
Refraction texture { pigment { rgbf <1, 1, 1, .8> } } interior { ior 3 }
![Page 30: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/30.jpg)
Caustics texture { pigment { rgbf <1, 1, 1, .8> } } interior { ior 3 caustics 1 }
![Page 31: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/31.jpg)
Bump Mapping
A “real” bump distorts the directions of the normals (this effects calculations of light reflectance)
“Fake” bumps created by distorting the normals although the geometry is still flat.
A bump-map texture applied to a flat polygon.
![Page 32: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/32.jpg)
![Page 33: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/33.jpg)
![Page 34: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/34.jpg)
Normal Maps
• We can add bumps, dents, wrinkles, ripples and waves to our objects.
Sample Scene (no normal maps)
box{ < -4, -.25, -4 > < 4, .25, 4 > pigment { White } finish { reflection .4 } normal { //add normal pattern here **** } }
![Page 35: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/35.jpg)
Bumps
normal { bumps 1 }
![Page 36: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/36.jpg)
Dents
normal { dents 1 }
![Page 37: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/37.jpg)
Wrinkles
normal { wrinkles 1 }
![Page 38: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/38.jpg)
Ripples
normal { ripples 1 }
![Page 39: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/39.jpg)
Waves
normal { waves 1 }
![Page 40: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/40.jpg)
Bump Map
normal { bump_map { gif "bumpmap.gif" } rotate 90*<1, 0, 0> scale 8 }
![Page 41: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/41.jpg)
Lab
1. Reflection in POV-Ray: use the reflection parameter in the finish statement to generate photorealistic reflective surfaces
2. Refraction in POV-Ray: use the interior definition and ior values to generate photorealistic refraction
3. Use a bump map/ normal map to generate some of the following effects:
![Page 42: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/42.jpg)
Normal Maps
dents
bumps ripples
wrinkles
![Page 43: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/43.jpg)
Bump Map
Bump Map image file https://www.cs.tcd.ie/John.Dingliana/bumpmap.gif
(or use your own)
![Page 44: Ray-tracing Photorealism Reflection, Refraction Bump maps](https://reader037.vdocument.in/reader037/viewer/2022103005/56649d5a5503460f94a3a6ec/html5/thumbnails/44.jpg)
POV-Ray Objects
• If you want to create more interesting scenes with real world objects, you can find POV-Ray objects on several sites including:
• http://objects.povworld.org/cat/