Alienizer, on 19 April 2012 - 01:44 AM, said:
ok, me again, hard headed at understanding how it works for raytracing this time, not photons.
No problem! It's not easy to get it right.
Alienizer, on 19 April 2012 - 01:44 AM, said:
dist = get distance to light
(...)
return vec3(60,60,50) / (dist*dist);
Nope! Since you have an area light you should not care about the distace. Each ray (photon) has still the same brightness, no matter how far they travel. The distance squared is just a hack to make pointlights dimmer by distance. With han area light, you will automatically get the right brightness depending on the distance, since the light source will appear smaller at a larget distance, and thus get hit by fewer (global illumination) rays.
You could emulate a true area light by splitting it into a grid of pointlights. Then your distance formula is correct, but it isn't clear from your code sample how you have implemented it.
Alienizer, on 19 April 2012 - 01:44 AM, said:
Hmm. This sounds like you work with a point light. All area lights have a penumbra, so you can't just check if it's in the shadow or not. Again, you could sample a number of pointlights spread over the surface of the area light, but you'd have to average a number of samples.
You need to decide if you are going to work with the area light as an actual area, or emulate it with a number of point lights.