Jump to content
  • Advertisement
Sign in to follow this  
Max_Payne

Matching direct and indirect illumination power

This topic is 4876 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 am in the process of separating direct and indirect illumination. I will only store indirect illumination in the photon map. So far everything seems simple: Just sum the indirect illumination from the photon map to the direct illumination evaluated through distributed raytracing. There is one important thing I am unsure about, however, and that is the lighting power. For example, in photon mapping, if there is a light with a power of 40 watts, and we emit 1 million photons, we simply divide the 40 watts among the million photons, and each photons will carry 40 microwatts of energy. At the surface we then divide the total energy of the photons within a certain radius by that radius to obtain the energy per square unit. This constitutes the irradiance estimate. But what about direct lighting? Simply doing DirectIrradiance = LightColor * LightPower does not give the right intensity at all. The direct illumination is much too strong. How would I go about computing the *right* intensity, so that it would be just as intense as if the direct illumination were computed through photon mapping?

Share this post


Link to post
Share on other sites
Advertisement
I don't really know what exactly you do with your photons, but know that general idea is to somehow measure their density (per area, e.g. in photons/m^2) in point to get illumination power. For direct illumination, you can compute this density analitically.

For omni-directional pointlight, ideal photon density is
-dot_product(surface_normal,light_direction)*N/(4*pi*r^2)
where r is distance from light. (4*pi*r^2 is area of sphere)
Power density (power per area, e.g. w/m^2) will be
-dot_product(surface_normal,light_direction)*power/(4*pi*r^2)
So, if you compute power density from photons density, for direct illumination you should just compute power density analitically instead of using photons.

**************************************************
For convience, it could be better not to work with power, but to work with energy. Real camera doesn't measure lightning power, it roughly measures amount of energy that came to point while shutter was open.
Say, light pulled out 1 joule during this time. With million photons, each will carry 1 microjoule of energy.

Share this post


Link to post
Share on other sites
What would be a good approximation for an arbitrary shaped light then? It seems something like this would be extremely diffucult to solve for any n-gon light... And why is the dot product involved in there, is that radiance or irradiance?

Share this post


Link to post
Share on other sites
In general case, power of light in some direction will be equal to probability density function [of your photon distribution] in that direction. (For omnidirectional light, it'll be 1/(4*pi))

Speaking of dot product, it's flux through surface with normal n. let you have photons falling as that

| | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | |
___________________________________________

or as that
/ / / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / /
___________________________________________


, assuming distance between lines is same, in second casem flux through surface is smaller.

Share this post


Link to post
Share on other sites
But why do you include the dot product in there:

Power density (power per area, e.g. w/m^2) will be
-dot_product(surface_normal,light_direction)*power/(4*pi*r^2)

Is that meant to estimate radiance or irradiance?

Share this post


Link to post
Share on other sites
you do realize that direct illumination IS orders of magnitude bigger than indirect?

also, light energy is not conserved in a typical scene, so your reasoning for indirect light doesnt hold i believe.

as for direct illumination: youd need the radiation transfer factor between a circle with correct gathering radius and normal, and the pixel on the film of your imaginary camera. calculating that exactly is pretty damned hard i believe.

if your interested i could look up the formula for two facing circles, it would be a reasonable approximation i think.

Share this post


Link to post
Share on other sites
Quote:
Original post by Max_Payne
But why do you include the dot product in there:

Power density (power per area, e.g. w/m^2) will be
-dot_product(surface_normal,light_direction)*power/(4*pi*r^2)

Is that meant to estimate radiance or irradiance?

what you mean by radiance or irradiance?

I edited post above. Idea is to analitically compute how dense photons would deposit if there would be infinitely many of them. It depends to angle between surface them deposit on and light direction.

Share this post


Link to post
Share on other sites
Quote:
Original post by Eelco
you do realize that direct illumination IS orders of magnitude bigger than indirect?


Of course. My problem is that using photon mapping for indirect illumination, I was getting a decent lighting level, but when I switched to separate direct illumination, it looked like the scene was aside a nuclear explosion.

Quote:
also, light energy is not conserved in a typical scene, so your reasoning for indirect light doesnt hold i believe.


I already have that working fine through photon mapping.

Quote:
as for direct illumination: youd need the radiation transfer factor between a circle with correct gathering radius and normal, and the pixel on the film of your imaginary camera. calculating that exactly is pretty damned hard i believe.

if your interested i could look up the formula for two facing circles, it would be a reasonable approximation i think.


I think Dmytry is on the right track... He's just not quite explaining it precisely enough for my taste.

Share this post


Link to post
Share on other sites
"DirectIrradiance = LightColor * LightPower" is not the correct formula. The light's power (energy transferred per unit time) is a total in all directions. For a point light, the power is equally distributed over a sphere surrounding the light.

At any given point, when you want to estimate the radiance at that point, you need to estimate the irradiance of each individual light source. However, a ray strikes at a discrete point; it makes no sense to talk about the irradiance only for a certain point. Instead, you estimate the irradiance for the local region around that point. For instance, say you choose the estimation area of A units^2. For an estimation area R units from a point light source, the energy received is: ((Total light energy) / (4 * pi * R^2)) * A. This will give you an energy value which you can feed into the BRDF for the surface at the incident point to find the radiance.

Note that there is only one real variable in the energy equation: R. Rearrange the equation a tiny bit: ((Total light energy * A) / (4 * pi)) / R^2. Now, the numerator of this is a constant. We can simply take this constant and store it as the "direct illumination strength" factor for the point light. A common trick is to let this factor be "fudged" a little bit (independently of the power used for photon generation) in the scene data to get better looking results.

Share this post


Link to post
Share on other sites
point lights are kindof impossible in a photonmapper, unless you trace them from the light to your camera. in any case they are not desirable.

Quote:
Original post by Max_Payne
What would be a good approximation for an arbitrary shaped light then? It seems something like this would be extremely diffucult to solve for any n-gon light... And why is the dot product involved in there, is that radiance or irradiance?


its not any harder than getting a non-aliased picture. remember a single pixel on your screen is only exposed to a small part of the light. it only gathers photons from a certain frustrum. just cast the ray through the middle of this frustrum, and use an appropriate gathering radius and normal, just like you would for indirect light. only now the amount of w/m^2 is determined by dividing the wattage of your light by its surface area.

btw, if youre going to divide rendering over multiple computers anyway, you could easily assign each machine a different sector of the frustrum, slap a lens in front of it, and have real depth of field and anti aliasing all at the same time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!