Presentation is loading. Please wait.

Presentation is loading. Please wait.

Global Illumination (3) Photon Mapping (1). Overview Light Transport Notation Path Tracing Photon Mapping –Photon Tracing –The Photon Map.

Similar presentations


Presentation on theme: "Global Illumination (3) Photon Mapping (1). Overview Light Transport Notation Path Tracing Photon Mapping –Photon Tracing –The Photon Map."— Presentation transcript:

1 Global Illumination (3) Photon Mapping (1)

2 Overview Light Transport Notation Path Tracing Photon Mapping –Photon Tracing –The Photon Map

3 Photon Mapping Photon mapping is a a technique for simulating global illumination. There are combined radiosity/ray tracing approaches to global illumination, as well as stochastic techniques (e.g. path tracing)…

4 Hybrid Methods Ray tracing extended with Monte Carlo techniques: –Very time consuming. –Noisy results. Radiosity extended with directional capabilities: –Requires too much storage. –Doesn’t handle specular reflections correctly.

5

6

7 Photon Mapping Can simulate all global illumination effects –color bleed, caustics, participating media, etc. Arbitrary geometry (no finite elements) –radiosity, a finite element method, requires meshing of all geometry Low memory consumption –versus the big meshes and linear systems of radiosity Result is correct except for variance (seen as noise) –expected value is correct, so solution will converge

8 Photon Mapping: Idea Photons are emitted from light sources. Each photon is traced through the scene using path tracing. Every time a photon hits a surface it is stored in the photon map. Photons are either absorbed or reflected. Reflected photon directions are computed using the BRDF of the surface. After the photon map is created, the scene is ray traced. The photon map information is used by the ray tracer.

9 About Photon Mapping A global illumination algorithm A Monte Carlo forward ray-tracing technique An efficient alternative to pure Monte Carlo approaches such as Path Tracing –faster and not as noisy

10 Algorithm Overview Photon Tracing forward ray-traces from the lights in the model and stores intersections in a cache, the photon map. Rendering renders the model using the photon map to provide illumination information.

11 Photon mapping Preprocess: cast rays from light sources Store photons

12 Photon mapping Preprocess: cast rays from light sources Store photons (position + light power + incoming direction)

13 Photon map Efficiently store photons for fast access Use hierarchical spatial structure (kd-tree)

14 Photon Mapping: Rendering Cast primary rays For secondary rays –reconstruct irradiance using adjacent stored photon –Take the k closest photons Combine with irradiance caching and a number of other techniques

15 Cast primary rays For secondary rays –reconstruct irradiance using adjacent stored photon –Take the k closest photons Combine with irradiance caching and a number of other techniques

16 Photon map results

17 Photon mapping - caustics Special photon map for specular reflection and refraction

18 Path Tracing: 1000 paths/pixel

19 Photon Mapping

20 Photon Tracing Photons emitted from light sources –light sources can have arbitrary geometry Mirror surfaces (specular reflection) reflect photons Diffuse surfaces store photons in photon map –photon is reflected at random on hemisphere Arbitrary BRDFs may be used for scattering Traces L(S|D)*D paths

21 Russian Roulette (Suicidal Photons) Stochastic technique to remove “unimportant” photons so computation focuses on “important” ones Intuition: –shoot 1000 photons of power p at a surface with reflectivity.5 –we can reflect 1000 photons with power p/2... –or reflect 500 photons with power p (less computation)

22 Russian Roulette Reflected flux only a fraction of incident flux After several reflections, spending a lot of time keeping track of very little flux Instead, completely absorb some photons and completely reflect others at full power ?  = 60%

23 Russian Roulette Spend time tracing fewer full power photons Probability of reflectance is the reflectance . Probability of absorption is 1 – . ?  = 60%

24 Mixed Surfaces Surfaces have specular and diffuse components –  d – diffuse reflectance –  s – specular reflectance –  d +  s < 1 (conservation of energy) Let  be a uniform random value from 0 to 1 If  <  d –then reflect diffuse –else if  <  d +  s then reflect specular otherwise absorb  d = 50%  s = 30%

25 Russian Roulette Expected value is the same, but variance increases Main advantages: –photons in photon map have similar power –far less computation

26 Overview Light Transport Notation Path Tracing Photon Tracing The Photon Map

27 Represents illumination stored as points in a global data structure Decouples the representation of illumination from geometry Is view-independent Represents L(S|D)*D paths

28 Photon Mapping: Data Structure struct photon { long energy; // packed energy (RGB) float position[3]; // photon position float theta, phi; // photon direction char normal[3]; // surface normal }

29 1.radiance_estimate(x,v,n) { 2. locate k nearest photons 3. r = distance to kth nearest photon 4. flux = 0 5. for each photon p { 6. pd = direction of p 7. phi = power of p 8. flux += brdf(x, v, pd)*phi; 9. } 10. return flux/(2*pi*r^2) 11.}  A =  r 2

30 Acceleration Structure Need n-nearest neighbors Usually use a k-d tree

31 Photon Mapping: Data Structure struct photon { long energy; // packed energy (RGB) float position[3]; // photon position float theta, phi; // photon direction char normal[3]; // surface normal short flag; // used by KD-tree // (stores which plane to split) }

32 How Many Photons? How big is the disk radius r? Large enough that the disk surrounds the n nearest photons. The number of photons used for a radiance estimate n is usually between 50 and 500. Radiance estimate using 50 photons Radiance estimate using 500 photons  A =  r 2

33 Photon Mapping: Example Museum: –5000 polygons and spheres. –1 procedural object. –Two small spherical area light sources. –390,000 caustic photons. –165,000 global photons (9 MB). –298 seconds for 1 st pass, 51 minutes for 2 nd. –Contains: Caustics from glass onto rough surface. Caustics from cylinder to wall. Color bleeding between walls.

34

35

36

37 Photon Mapping

38

39

40 Optimizations Faster final gathering –Pre-computed irradiance stored at photon locations –Only the nearest photon must be found instead of density estimation computation –Reported speedup up to 6 times Photon density control in the map –In bright regions with slowly changing illumination the power of redundant photons is distributed to their neighbors –Photon number reduced 2-4 times for the same image quality Be careful with your choice of random number –drand48() performed slightly better than erand48() and much better than BSD-style random()

41 Industrial Products Brazil Rendering System (www.splutterfish.com) finalRender (www.finalrender.com) Mental Ray (www.mentalray.com) SoftImage|XSI (www.softimage.com) VirtuaLight (www.3dvirtualight.com) VRay (www.vrayrender.com) RenderMan (www.pixar.com)


Download ppt "Global Illumination (3) Photon Mapping (1). Overview Light Transport Notation Path Tracing Photon Mapping –Photon Tracing –The Photon Map."

Similar presentations


Ads by Google