Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Max_Payne

Photon mapping questions

This topic is 5407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to ask some questions about photon mapping. I can''t find many resources about it on the internet (and I won''t buy jensen''s book). Ok so, photon mapping is a two pass algorithm: 1. Photon map generation pass (view independent) 2. Image rendering pass (most often raytracing) My questions: 1. How does photon mapping figure out the color at a specific point during image rendering, does it only consider the photon map, or does it also perform an estimate of the direct illumination? 2. How are photons gathered from the photon map for a "radiance estimate", does it only gather the nearest photon that hit the object the point lies on, or does it gather the closest ones without regard to the object the photons are on? 3. Jensen uses a photon structure with photon incident angles as phi and theta, this seems slow, any reason not to use a 3D vector, besides the potential (and irrelevant) memory use? 4. How is a separate "caustic map" generated... how are those different from regular photons?

Looking for a serious game project?
www.xgameproject.com

Share this post


Link to post
Share on other sites
Advertisement
>>1. How does photon mapping figure out the color at a
>>specific point during image rendering, does it only consider
>>the photon map, or does it also perform an estimate of the
>>direct illumination?

Two versions for computing "color" (radiance) are used: an accurate and an approximate. In the accurate version monte carlo raytracing is used (for example, on the first bounce). In the approximate version the estimate is taken directly from the photon map.

This of course varies a bit for (mostly) diffuse, (mostly) specular surfaces (and participating media, if you wish).

>>2. How are photons gathered from the photon map for a
>>"radiance estimate", does it only gather the nearest
>>photon that hit the object the point lies on, or does it
>>gather the closest ones without regard to the object
>>the photons are on?

Only the closest ones. Like Jensen writes, the important aspect of the photon map is that it''s separated from the geometry, that is no information is stored about what object the photon has hit. This makes the technique very general (easy to encapsulate in an object-oriented code), usable even for complex geometries, and memory efficient.

It is be possible to do some additional analysis to make the radiance estimates better, but as Jensen concludes, finding just the nearest photons has a nice compromise of easiness/speed/accuracy.

>>3. Jensen uses a photon structure with photon incident
>>angles as phi and theta, this seems slow, any reason not
>>to use a 3D vector, besides the potential
>>(and irrelevant) memory use?

No, the only reason is that storing the phi and theta is more memory efficient. If you store phi and theta as bytes, the representation takes only two bytes, whereas storing the direction as three floats takes 12 bytes. It isn''t really even that slow, because the "real" cartesian direction can be computed from phi&theta using two simple 256-byte lookup tables.

And it''s not all that irrelevant once you start having millions of photons... 12 bytes times million is "only" 12 megs, but note that your photon has other things wasting the memory (power of the photon, position of the photon, possible pointers if you use an unbalanced tree etc.) Personally I use the cartesian version.

>>4. How is a separate "caustic map" generated... how are
>>those different from regular photons?

They are in no way different. The caustic photon map only stores photons that, after coming from the light source, hit specular surfaces and finally hit a diffuse surface. Then the photon is stopped at the diffuse surface and it''s stored there.

>>(and I won''t buy jensen''s book)

And you assume people are willing to practically copypaste you the book for free? Sorry, this might have been my last post to you for a moment. Call me an asshole if you wish, but I suggest you to think twice.

- Mikko Kauppila

Share this post


Link to post
Share on other sites
Replace ''won''t buy'' with ''not able to buy'' and things would be different. I''m also wondering why he wrote that. To make folks mad?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
do you already own it?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
do you already own it?


No, I just thought I might as well get a vague explanation from you guys rather than a vague explanation from an expensive book The fact is, even if I read it, I would still be asking questions.

quote:
Two versions for computing "color" (radiance) are used: an accurate and an approximate. In the accurate version monte carlo raytracing is used (for example, on the first bounce). In the approximate version the estimate is taken directly from the photon map.


How is monte carlo raytracing involved in photon mapping, its part of the algorithm??? Please be clearer.

quote:
Only the closest ones. Like Jensen writes, the important aspect of the photon map is that it''s separated from the geometry, that is no information is stored about what object the photon has hit.


On one of the papers I read, the guy said it was needed to sum all of the n closest photons and divide the total values by the circular (planar) radius in which they are found. Is that true? How does it fit with photons not being attached to objects?

And finally: How do you approximate the final radiance? Average the color? Average the incident direction vector?



Looking for a serious game project?
www.xgameproject.com

Share this post


Link to post
Share on other sites
get the book and you would not ask those questions.

and its not _THAT_ expensive. seen much more expensive ones.

actually, after reading the book, you would not ask any questions anymore.




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net

Share this post


Link to post
Share on other sites
>>you would not ask any questions anymore

Asking questions on small details is OK. But trying to get a firm grasp of complete rendering algorithms through a forum is not, especially if you admit that you''re just using people instead of being willing to pay a little extra.

>>How is monte carlo raytracing involved in photon mapping,
>>its part of the algorithm??? Please be clearer.

It''s not used when you trace the photons from the light to the scene ("photon tracing"). It''s only used after the creation of the photon map, when you do the final rendering.

As you know, monte carlo raytracing is in essence a sort-of recursive process (you trace a ray through several reflections ie. bounces in the scene). Photon map can help you to cut down this recursion by offering a radiance estimate: when your ray has gone a sufficient amount of recursions (usually even one bounce is enough), you can approximate the radiance on the last bounce using the photon map.

This saves a great deal of time, and often decreases the amount of noise alot (because the latter bounces are not computed using the noisy monte carlo raytracing algorithm). This only holds for diffuse surfaces, keep in mind.

Also, caustics are fast to visualize using the photon map. Monte carlo ray tracing is never used for caustics - that takes far too many samples as thus far too much rendering time.

For glossy (mostly specular) surfaces Jensen''s book suggest to always use monte carlo raytracing, because monte carlo raytracing is quite efficient for glossy surfaces.

Btw, Henrik Wann Jensen''s 1996 paper on photon mapping is available on his homepage.

Doh! I already broke my promise! OK, I''ll stop here.

- Mikko

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!