PDA

View Full Version : Photon Mapping in C++?


assembler-robot
08-17-2002, 09:25 AM
Anyone know where I can find information on this? I'm making a 3D graphics renderer, and I want to include global illumination as a feature. However, I can't find much info on the topic

grady
08-28-2002, 12:18 AM
I never heard of photon mapping but i did a google search and found a book on it. http://graphics.stanford.edu/~henrik/papers/book/

Can you achieve the same thing with ray tracing? there might be more information on that.

sans-hubris
08-28-2002, 03:29 AM
What makes this different from ray-tracing?

kmj
08-28-2002, 11:18 AM
ray-tracing traces the rays from the eye back through the 3D scene to see what objects it intersects.. it's a "global illumination" method, meaning (I'm pretty sure) that there's no specific light source emitting the rays..

photon mapping works the other way: You need to start with a light source, determine what "photons" that source emits, what objects they bounce off of or shine through (and how they do), etc, until the photons hit the "camera".


So ray-tracing starts with the eye and moves back into the image, creating global illumiation, whereas photon mapping starts at each light source, bounces around the room, and eventually reaches the eye.

assembler-robot
08-28-2002, 01:36 PM
photon-mapping is a type of raytracing. It's called forward raytracing, where like kmj said, the rays are traced from the source to the camera. Backwards raytracing, now the predominant type of algorithm, traces rays from the camera back to the light source. I've set up a renderer with photon-mapping, using recursively linked lists to determine which rays eventually hit the camera. However, my renderer takes inordinate amounts of time to render even simple scenes, hence my need to find good information on the subject.

EDIT:
Also, raytracing is not GI. GI is secondary illumination provided by rays that do not hit the camera directly, instead bouncing off of several objects before hitting the camera. Accurate GI takes into account the fact that an object that is black will absorb all light, reflecting none of it, while a white light will absorb none of the light, reflecting the entire ray. Hence, a totally green object will absorb the red and blue portions of a photon of light, and transmit, or reflect only the green portion. This green portion is averaged with the other rays that converge at the same location on the screen, determining the color of the pixel at that location.

EDIT EDIT:
This absorption of light which makes objects reflect rays of their own color, leads to radiosity, which is a slightly different subject.

Sorry for rambling, but as you can tell, light fascinates me

assembler-robot
08-28-2002, 01:53 PM
On a side note, I have ordered that book. Thank you for the link. I'm not going to be able to sleep until it gets here. And to answer your question about whether the same thing can be done with raytracing, see above.

kmj had a slight error. Raytracing doesn't provide GI automatically. That depends on the depth of raytracing. Raytracing involves tracing the path of three kinds of rays, shadow rays, reflection rays, and transparency rays. The more of each kind of ray you have, the more realistic the image. It depends on the number of rays that converge on each pixel what color value it will have. If you have 6 shadow rays, all colored blue, 3 reflection rays, colored grey, and 0 transparency rays converging on the same pixel, then the pixel will take the average color of the rays and use that as a color value for the pixel. GI is done by firing a greater amount of rays in different directions, and tracing them back to the light source. Thus the light source appears to light more of the image, providing more defined shadows and reflections. And I'm rambling incoherently again. I'll shut up