Matching direct and indirect illumination power

Started by
20 comments, last by Max_Payne 18 years, 10 months ago
Quote:Original post by Max_Payne
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.


yeah, its fine relative to itself, but is it fine compared to direct illumination?
Advertisement
Quote:Original post by Max_Payne
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.


that could be your tonemapping messing things up aswell, no?
Quote:Original post by Eelco
***


I think he mean that when he uses photon mapping for both direct and indirect illumination, he gets wastly different results from what he get using normal rendering for direct and photons for indirect. Which could be incorrect implementation of direct illumination lightness.
Quote:yeah, its fine relative to itself, but is it fine compared to direct illumination?


Well, photon mapping is supposed to be physically accurate... So provided that its coded right, its a very good approximation of "the solution". Provided that direct illumination is computed properly, it should look the same, no matter the method you use.

Quote:Original post by Eelco
Quote:Original post by Max_Payne
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.


that could be your tonemapping messing things up aswell, no?


No, I was just computing it wrong... My theory of graphics is still limited. I should be able to get it to work fine tonight, thanks to everyone's explanations ;) Plus, my tone mapping is just an exponential function.


Quote:I think he mean that when he uses photon mapping for both direct and indirect illumination, he gets wastly different results from what he get using normal rendering for direct and photons for indirect.


That is indeed what I mean. Mapping the energy on a sphere/hemisphere with the right probabilities should fix that. It should be much closer to the photon mapping result... I will spend some time tonight implementing proper lighting algorithms for basic primitives. Minimally a polygonal light, for my cornell box... Although, a disc light might be nice as well ;)

Looking for a serious game project?
www.xgameproject.com
Quote:Original post by Dmytry
Quote:Original post by Eelco
***


I think he mean that when he uses photon mapping for both direct and indirect illumination, he gets wastly different results from what he get using normal rendering for direct and photons for indirect.


no surprise, since the formula he said he used in his OP is flawed. just treat direct light the same as you do indirect, only the way you calculate irradiance should differ, but thats trivial really.
Quote:Original post by Max_Payne
Quote:yeah, its fine relative to itself, but is it fine compared to direct illumination?


Well, photon mapping is supposed to be physically accurate... So provided that its coded right, its a very good approximation of "the solution". Provided that direct illumination is computed properly, it should look the same, no matter the method you use.


well, that is again assuming your photon mapping is correct, which cant really be the case if you state yourself all the energy in the photon map should equal the totall emitted energy, which simply isnt true afaik.
^^^^^^^^^^^^^ for case only indirect illumination photons are really deposited, you are correct, Eelco . But for case all photons shot come to map, it must be equal. In either case, mistakes there could only increase brightness of indirect light.

Amount of power hitting area dA are
dA*(-dot_product(normal,light_direction))*k/r^2
so power density (e.g. in w/m^2) will be
dA*(-dot_product(normal,light_direction))*k/r^2/dA = (-dot_product(normal,light_direction))*k/r^2
where k is watts per steradian for this direction. For omnidirectional light, k is power/(4*pi)

Generally, it's equal to [total power]*[probability density of what you use to shoot photons]
Quote:Original post by Dmytry
^^^^^^^^^^^^^ for case only indirect illumination photons are really deposited, you are correct, Eelco . But for case all photons shot come to map, it must be equal. In either case, mistakes there could only increase brightness of indirect light.

true, but if its not physically correct anyway, trying to do direct light correctly is a waste of effort. they still wouldnt match up.

Quote:
Amount of power hitting area dA are
dA*(-dot_product(normal,light_direction))*k/r^2
so power density (e.g. in w/m^2) will be
dA*(-dot_product(normal,light_direction))*k/r^2/dA = (-dot_product(normal,light_direction))*k/r^2
where k is watts per steradian for this direction. For omnidirectional light, k is power/(4*pi)

yeah, but what youre really interested in is that intergrated over the area recieving the light. you could just multiply with the recieving area instead of integrating over it, which is so small an approximation i bet youll never notice in any sane situation, but if you want the total amount of joule each pixel recieved during exposure, its not something you can ignore. since hes already ignoring that for indirect illumination, it shouldnt mess with the relative results though.
Quote:Original post by Max_Payne
Plus, my tone mapping is just an exponential function.


that doesnt mean it couldnt be causing you trouble (though its not the only thing)

your lights seemed to have color (255,255,255) in all your renders. so when you say it looks like a nuclear explosion in your new renders, i assume you refer to the rest of the scene getting darker, right? this must be the result of some form of scaling based on either average or max brightness. maybe that is whats borked?
I recommend you purchase the book "Physically Based Rendering: From Theory to Implementation" by Matt Pharr and Greg Humphreys. It has fairly rigorous derivations of proper lighting equations for a number of different types of lights. If you take the time to work through the calculus/geometry of figuring out projected solid angles for various light shapes, it will significantly enhance your understanding of light transfer.

This topic is closed to new replies.

Advertisement