Download - Ray Tracing News
![Page 1: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/1.jpg)
![Page 2: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/2.jpg)
Ray Tracing News
• http://www.raytracingnews.org/• RTNv19n1: September 30, 2006
– Introduction– Ray Tracing Roundup– Notes on Efficient Ray Tracing– Ray-Box Sorting– BVHs and Memory Coherence– “So long and thanks for all the fish...”– Ray/Box Intersection Optimization– SIGGRAPH 2006 Report
![Page 3: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/3.jpg)
Ray Tracingen
Global Illuminationpraktische inleiding
over beschikbare software
![Page 4: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/4.jpg)
Ray Tracer from scratch
• practicum CG1
• leerrijk, maar tijdrovend
• matrix, vector, kleur, afbeelding, camera, straal, puntlicht, driehoek, ...
• ontwerpkeuzes
![Page 5: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/5.jpg)
Beschikbare renderers
• “standing on the shoulders of giants”
• doel– hobby ray tracer met beperkte fysische basis
• bv. POV-Ray
– academische, fysisch gebaseerde global illumination renderer
• bv. PBRT, RenderPark, Radiance, …
• basisimplementatie– meer mogelijkheden dan je zelf zou schrijven
• uitbreidbaarheid
![Page 6: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/6.jpg)
Overzicht
• Ray Tracing– korte herhaling van CG1– voorbeeld: POV-Ray
• Global Illumination– korte herhaling van CG1, meer info: zie CG2– voorbeeld: PBRT
![Page 7: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/7.jpg)
Ray Tracing herhaling
• camera
• pixelrooster
• scènecamera
pixelrooster
scène
![Page 8: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/8.jpg)
Ray Tracing herhaling
• primaire straal
![Page 9: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/9.jpg)
Ray Tracing herhaling
• primaire straal
• raakpunt
• schaduw en shading…
![Page 10: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/10.jpg)
Ray Tracing herhaling
• schaduw
• schaduwstraal van raakpunt naar lichtbron
• raakt ander object?raakpunt niet belicht
![Page 11: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/11.jpg)
• diffuus• cosinus (N.L)
Ray Tracing herhaling
• speculair• spiegeling
(N.V) = (N.R)
• recursie
• Phong (glans)• cosinus (R.V) of (N.H)
• exponent n
![Page 12: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/12.jpg)
Ray Tracing herhaling
• recursie– reflectie– refractie
• wet van Snellius
lucht (n=1) glas (n=1,5)
oppe
rvla
k
normaal = buiten
![Page 13: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/13.jpg)
Ray Tracing herhaling
• ray tracingà la Whitted 1980
• uitbreidingen– oppervlaktelichtbron
(zachte schaduwen)– participerende media
• hacks– ambiënt licht
![Page 14: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/14.jpg)
POV-Ray (www.povray.org)
• hobby, artistiek, andere terminologie
• brede basisimplementatie
• uitbreidbaarheid is geen doel
• praktische documentatie en tutorials
• standaard ray tracing
![Page 15: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/15.jpg)
POV-Ray
• fotorealisme mogelijk door te tweaken– Internet Ray Tracing
Competition (www.irtc.org)
• niet fysisch gebaseerd, geen global illumination– radiosity, photon map
uitbreidingen
![Page 16: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/16.jpg)
POV-Ray syntax
camera {
perspective
location <0.0, 0.5,-8.0>
look_at <0.0, 0.0, 0.0>
up <0.0, 1.0, 0.0>
angle 50
}
![Page 17: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/17.jpg)
POV-Ray syntaxlight_source { <-30,30,-30> // positie color rgb <1.0, 1.0, 1.0> pointlight}light_source { <-30,30,-30> // positie color rgb <1.0, 1.0, 1.0> area_light <8, 0, 0> <0, 0, 8> // afmetingen 8, 8 // stratificatie jitter}
![Page 18: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/18.jpg)
POV-Ray syntaxplane { y, -1 // vlak y=-1}box { <-3,-1,-1> <-1, 1, 1> // hoekpunten}sphere { <0.0, 0.0, 0.0>, 1 // center, straal}cone { <2,1,0>, 0.0, // punt op as, straal 0 <2,-1,0>, 1.0 // punt op as, straal 1}
![Page 19: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/19.jpg)
POV-Ray syntaxmesh { triangle { <0,0,0>, <0,1,0>, <1,1,0> // hoeken uv_vectors <0,0>, <0,1>, <1,1> // textuurcoordinaten } smooth_triangle { <0,0,0>, <0,0,1>, // hoek, normaal <1,0,0>, <0,1,1>, // hoek, normaal <1,1,0>, <1,1,1> // hoek, normaal uv_vectors <0,0>, <0,1>, <1,1> // textuurcoordinaten }}
![Page 20: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/20.jpg)
POV-Ray syntax
texture { // materiaal pigment { // basiskleur // ... } normal { // bump map // ... } finish { // glans // ... }}
![Page 21: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/21.jpg)
POV-Ray syntax
pigment { color rgb <1.0,0.0,0.0>}
pigment { image_map { jpeg "filename.jpg" }}
![Page 22: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/22.jpg)
POV-Ray syntax
normal { bumps 0.5 // proceduraal}
normal { bump_map { gif "filename.gif" }}
![Page 23: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/23.jpg)
POV-Ray syntaxfinish { phong 0.9 phong_size 60 // 1 - 250 // of specular 0.9 roughness 0.02 // 0.0005 – 1
reflection 0.8
// modifiers metallic // kleur highlight conserve_energy}
![Page 24: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/24.jpg)
POV-Ray
![Page 25: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/25.jpg)
POV-Ray
• uitbreidbaarheid?• C++• redelijk leesbare code• weinig structuur• code aanpassen• functionaliteit toevoegen?
![Page 26: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/26.jpg)
Overzicht
• Ray Tracing– korte herhaling van CG1– voorbeeld: POV-Ray
• Global Illumination– korte herhaling van CG1, meer info: zie CG2– voorbeeld: PBRT
![Page 27: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/27.jpg)
Global Illumination
• diffuse interreflecties
![Page 28: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/28.jpg)
Global Illumination
• diffuse interreflecties
• glossy reflecties
![Page 29: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/29.jpg)
Global Illumination
• diffuse interreflecties
• glossy reflecties
• caustics
![Page 30: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/30.jpg)
Global Illumination
• diffuse interreflecties
• glossy reflecties
• caustics
• fysisch correct
![Page 31: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/31.jpg)
Global Illumination
• diffuse interreflecties
• glossy reflecties
• caustics
• fysisch correct
radiosity +stochastic ray tracing radiosity
ray tracing foto
![Page 32: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/32.jpg)
Global Illumination herhaling
![Page 33: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/33.jpg)
Global Illumination herhaling
![Page 34: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/34.jpg)
Global Illumination herhaling
• directe/indirecte belichting samen
![Page 35: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/35.jpg)
Global Illumination herhaling
• directe/indirecte belichting apart
![Page 36: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/36.jpg)
Global Illumination herhaling
• path tracing
![Page 37: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/37.jpg)
Global Illumination herhaling
• path tracing
• L = ...
![Page 38: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/38.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie
![Page 39: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/39.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting
![Page 40: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/40.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
komt van overal
![Page 41: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/41.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
uit 1 richting
![Page 42: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/42.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
komt van ergens
![Page 43: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/43.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief
![Page 44: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/44.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief
![Page 45: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/45.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief
![Page 46: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/46.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief
![Page 47: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/47.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief
![Page 48: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/48.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief
![Page 49: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/49.jpg)
Global Illumination herhaling
• path tracing
• L = ...– emissie– directe belichting– indirecte belichting
recursief– aantal keer
per pixel
![Page 50: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/50.jpg)
Global Illumination herhaling
• path tracing
• in principe volledig• maar soms traag
– bv. caustics
![Page 51: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/51.jpg)
Global Illumination herhaling
• photon mapping
• pass 1: store
![Page 52: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/52.jpg)
Global Illumination herhaling
• photon mapping
• pass 1: store– positie (x, y, z)– inkomende richting– vermogen (r, g, b)
![Page 53: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/53.jpg)
Global Illumination herhaling
• photon mapping
• pass 1: store– positie (x, y, z)– inkomende richting– vermogen (r, g, b)
– in kd-tree
![Page 54: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/54.jpg)
Global Illumination herhaling
• photon mapping
• pass 1: store– positie (x, y, z)– inkomende richting– vermogen (r, g, b)
– in kd-tree– los van geometrie
![Page 55: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/55.jpg)
Global Illumination herhaling
• photon mapping
• pass 1: store– globale map– caustic map
![Page 56: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/56.jpg)
Global Illumination herhaling
• photon mapping
• pass 1: store• pass 2: gather
– soort stochasticray tracing:
emissiedirecte belichtingcaustic mapindirecte belichtingglobale map
![Page 57: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/57.jpg)
PBRT (www.pbrt.org)
• academisch• beperkte basisimplementatie
– moderne, leesbare algoritmes– performant, maar geen micro-optimalisaties
• extreem uitbreidbaar– bijna alles in plugins
• documentatie– directe overeenkomst theorie en implementatie– gekende terminologie
![Page 58: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/58.jpg)
PBRT
• boek: Physically Based Rendering: From Theory to Implementation– M. Pharr, G. Humphreys. 2004.– incl. CD met bin, src v1.0 en prentjes
• site: www.pbrt.org– source code v1.02
• Windows (Visual Studio, Cygwin)• Linux / MacOS X
– plugins– errata & bugtracking
![Page 59: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/59.jpg)
PBRT
• globale belichting, fysisch gebaseerd
• fotorealisme als je realistische invoer geeft
![Page 60: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/60.jpg)
PBRT
• globale belichting, fysisch gebaseerd
• fotorealisme als je realistische invoer geeft
![Page 61: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/61.jpg)
PBRT
• globale belichting, fysisch gebaseerd
• fotorealisme als je realistische invoer geeft
![Page 62: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/62.jpg)
PBRT plugins
• accelerators: kdtree, grid• camera’s: perspective, environment,
orthographic• filters: mitchell, box, gaussian, sinc,
triangle• integrators: directlighting, irradiancecache,
path, photonmap, whitted, ...• samplers: lowdiscrepancy, stratified, ...
![Page 63: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/63.jpg)
PBRT
• lights: area, distant, infinite, point, projection, spot, ...
• materials: matte, glass, mirror, plastic, shinymetal, translucent, uber, ...
• shapes: cone, cylinder, disk, loopsubdiv, nurbs, sphere, trianglemesh, ...
• textures: checkerboard, constant, dots, fbm, imagemap, marble, windy, wrinkled, ...
![Page 64: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/64.jpg)
PBRT syntax
Identifier “class” (“type name” [value])*
Film “image” “string filename” [“foo”]Sampler “stratified” “bool jitter” [“true”]LightSource “spot” “float coneangle” [30]Shape “trianglemesh” “point P” [0 0 0 0 1 0 1 0 0] “normal N” [0 0 1 0 1 1 1 0 1] “vector S” [1 1 0 1 0 0 0 1 0] “integer indices” [0 1 2 ...]
Texture “green” “color” “constant” “color value” [0 1 0]Material “matte” “texture Kd” [“green”]Material “matte” “color Kd” [0 1 0]
![Page 65: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/65.jpg)
PBRT syntax
LookAt 0 10 100 0 -1 0 0 1 0 # camera punt lookat punt up vector
Camera “perspective” “float fov” [30]
SurfaceIntegrator “path”
Accelerator “kdtree”
![Page 66: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/66.jpg)
PBRT syntax
PixelFilter “box” “float xwidth” [.5] “float ywidth” [.5]
Sampler “stratified” “integer xsamples” [2] “integer ysamples” [2] “bool jitter” [“true”]
Film “image” “string filename” [“name.exr”] “integer xresolution” [800] “integer yresolution” [600]
![Page 67: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/67.jpg)
PBRT
• OpenEXR (www.openexr.com)– Industrial Light & Magic (Lucasfilm)– high dynamic range– in postproces exposure aanpassen
![Page 68: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/68.jpg)
PBRT syntax
WorldBegin
LightSource “point” “point from” [0 1 0]
AttributeBegin Translate 0 2 0 Rotate 135 1 0 0 # hoek en as Material “matte” “color Kd” [1 0 0] Shape “sphere” “float radius” [2] # altijd center [0 0 0], dus Translate AttributeEnd
WorldEnd
![Page 69: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/69.jpg)
PBRT plugins
#include “shape.h”class Sphere: public Shape {public: Sphere(...);
BBox ObjectBound() const;
bool Intersect(const Ray &ray, float *tHit, ...) const; bool IntersectP(const Ray &ray) const;
float Area() const;
Point Sample(float u1, float u2, ...) const; float Pdf(...) const;};
![Page 70: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/70.jpg)
PBRT plugins
Shape *CreateShape(...) { float radius = params.FindOneFloat("radius", 1.0f); return new Sphere(radius, ...);}
Shape “sphere” “float radius” [2]
![Page 71: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/71.jpg)
![Page 72: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/72.jpg)
![Page 73: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/73.jpg)
![Page 74: Ray Tracing News](https://reader035.vdocument.in/reader035/viewer/2022062409/56814689550346895db3abcd/html5/thumbnails/74.jpg)
Praktische rendering
• Eigen PC• Graphics “aquarium”
– Athlon 64 X2 (dual core)– uitbreiding
• PC-klas– 40-tal Pentium IV
• Cluster (www.vic.cc.kuleuven.be)– 400-tal Opteron250 cores– binnenkort 480-tal extra