Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer graphics & visualization Photon Mapping.

Similar presentations


Presentation on theme: "Computer graphics & visualization Photon Mapping."— Presentation transcript:

1 computer graphics & visualization Photon Mapping

2 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Motivation “Today ray tracing is one of the most popular and powerful techniques in the image synthesis repertoire: it is simple, elegant, and easily implemented. [However] there are some aspects of the real world that ray tracing doesn’t handle very well (or at all!) as of this writing. Perhaps the most important omissions are diffuse inter-reflections (e.g. the ‘bleeding’ of colored light from a dull red file cabinet onto a white carpet, giving the carpet a pink tint), and caustics (focused light, like the shimmering waves at the bottom of a swimming pool).” Andrew Glassner 1989

3 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Overview Generating a Photon Mapped Image: Two pass approach 1.Generate Photon Map “from the light source into the scene” 2.Render Image; e.g. with ray tracing “from the eye into the scene”

4 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Ray tracing The basic ray-tracing method The basic ray-tracing method – Recursive search for paths to the light source Interaction with matter Interaction with matter Point-wise evaluation of an illumination model Point-wise evaluation of an illumination model Shadows, reflection, transparency Shadows, reflection, transparency Viewpoint Point light source R2R2 R1R1 R3R3 N2N2 N1N1 N3N3 T1T1 T2T2 L2L2 L1L1 L3L3 N: surface normals R: reflected rays L: shadow rays T: transmitted rays

5 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Light sources Types of light sources Point Spherical Area General

6 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group From light source into the scene Point light source R2R2 R1R1 R3R3 N2N2 N1N1 N3N3 T1T1 T2T2 L3L3 Photon Map entries

7 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Excursion: Path tracing So far „recursive Raytracing“ EyeReflection Refraction ReflectionRefraction Reflection Refraction ReflectionRefraction “wastes most computations on little contribution”

8 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group New idea: „Path Tracing“ Consider only a single path through the tree at a time... and use Russian roulette to compute multiple paths EyeReflection Refraction ReflectionRefraction Reflection Refraction ReflectionRefraction

9 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Back to Photons N1N1 N1N1 N1N1

10 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Why path-tracing for photons? Constant photon energy Well defined number of Photons in map Problem: Aliasing

11 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Aliasing/Noise

12 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group What to store in the photon map? struct photon { float x,y,z; // position char phi, theta; // incident direction char p[4]; // color } // phi = 255 * (atan2(dy,dx)+PI) / (2*PI); // theta = 255 * acos(dx) / PI;

13 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group How to store photons? in a list / an array – simple – search operations O(n) in a grid – memory intense – search operations O(1) in a tree / kd-Tree – memory efficient – search operations O(log n)

14 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group A “balanced” kd-Tree pointList = [(2,3), (5,4), (9,6), (4,7), (8,1), (7,2)] tree = kdtree(pointList)

15 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group KD-Tree Example

16 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Pass 1 Shooting: Summary For every light source – For a given number of photons Choose random position (not for point lights) Choose random direction Start path tracing from light source Stop in diffuse or absorbtion cases – If diffuse: store position and direction in list Convert list to kd-tree

17 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Pass 2 Rendering Photon Map per se can not be rendered

18 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Gathering

19 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Radiance Estimate

20 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Splitting up the RE Direct illumination from LS Specular from caustics and diffuse illumination Diffuse from caustics illumination Diffuse from diffuse incoming illumination

21 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Splitting up the RE Raytracing: Shadow Caster Direct illumination from LS Specular from caustics and diffuse illumination Diffuse from caustics illumination Diffuse from diffuse incoming illumination

22 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Splitting up the RE Raytracing: Shadow Caster Raytracing: Monte-Carlo Raytracing Direct illumination from LS Specular from caustics and diffuse illumination Diffuse from caustics illumination Diffuse from diffuse incoming illumination

23 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Splitting up the RE Raytracing: Shadow Caster Raytracing: Monte-Carlo Raytracing Photon Map: Direct Radiance Estimate Direct illumination from LS Specular from caustics and diffuse illumination Diffuse from caustics illumination Diffuse from diffuse incoming illumination

24 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Splitting up the RE Raytracing: Shadow Caster Raytracing: Monte-Carlo Raytracing Photon Map: Direct Radiance Estimate Photon Map: Indirect Radiance Estimate Direct illumination from LS Specular from caustics and diffuse illumination Diffuse from caustics illumination Diffuse from diffuse incoming illumination

25 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Irradiance Cache Instead of computing the Indirect Radiance Estimate, compute the irradiance of a given pixel from the irradiance values of its neighbors; „if possible“.

26 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Results

27 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Problems

28 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Disc Sampling

29 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group More Images 1 000 000 Photons, 100 Photons for radiance estimate, 11 Minutes

30 computer graphics & visualization Image Synthesis – WS 07/08 Dr. Jens Krüger – Computer Graphics and Visualization Group Realtime Photon tracing on GPUs 0.05 Seconds http://wwwcg.in.tum.de/Research/Publications/Photons/


Download ppt "Computer graphics & visualization Photon Mapping."

Similar presentations


Ads by Google