# Photon Mapping : Direct Illumination

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

## Recommended Posts

So far I have been doing direct visualisation of the photon map. I am wondering how to go about using it only for indirect illumination. I will be using distributed raytracing to randomly sample light sources with shadow rays for direct illumination. This will give me a value for the direct lighting contribution of each light... But how about indirect illumination? Jensen seems to be suggesting that there are no modifications to make to the photon map. It would seem to me, however, that one would want to store only photons from the second hit and up, to actually filter the direct illumination *out* of the photon map, no? Also, about direct illumination. Supposing I have a rectangular light source, and I sample it at 30 random points. Do I simply take the number X of points that deliver light to the current surface point, and say that the light power received by the surface point is X/30 * LightPower , or do I have to account, for each point, of the probability of emitting a ray in that direction, by multiplying the ray's power by the cosine of the ray direction and light surface normal. If so, is it still necessary to multiply the light power by the cosine of the ray direction and the surface normal (for the lambertian radiance).

##### Share on other sites
If you followed Jensen correctly, you will have three separate photon maps: A direct map, an indirect map, and a caustic map. To use regular whitted style raytracing for direct illumination, simply don't use your direct photon map.

Quote:
 Also, about direct illumination. Supposing I have a rectangular light source, and I sample it at 30 random points. Do I simply take the number X of points that deliver light to the current surface point, and say that the light power received by the surface point is X/30 * LightPower , or do I have to account, for each point, of the probability of emitting a ray in that direction, by multiplying the ray's power by the cosine of the ray direction and light surface normal. If so, is it still necessary to multiply the light power by the cosine of the ray direction and the surface normal (for the lambertian radiance).

I suggest brushing up on the theory of Monte Carlo integration. If your samples are uniformly distributed, then it is simply X/30 * LightPower. If your samples are pulled from a cosine weighted distribution, then you need to account for that in your integration. Here's the best reference I could find doing a quick google run:

Monte Carlo Integration and Importance Sampling

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 34
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015643
×