Hi,
currently I am working on a new algorithm for realtime indirect illumination for my master thesis but I am not very versed in the mathematics of it. The goal is not to create stunning photorealistic images but rather the development and performance of the algorithm. Nevertheless I would like to generate images which are heading into the right direction in the sense of the math behind it.
At the moment I use phong shading as the illumination model for direct lighting.
The situation in my algorithm is the following:
I have something like photons in my scene. To gather indirect light for one photon I render the scene from its perspective. Assume only those fragments are rendered which are directly illuminated by a light source. To only account for diffuse indirect illumination I thought I could compute the diffuse color value with the phong model for every rendered fragment. Then all this values are summed up and divided by the number of rendered fragments. The resulting values (for every R,G,B channel one value) will be the indirect diffuse lighting part of the photon at its particular position.
Am I correct so far? Is this mathematically wise a reasonable approximation of the inidirect illumination?
The next question is what to do with this photon? Assume I render the scene from the perspective of my camera and a fragment with such a photon at its position is rendered. How do I incorporate the photon's diffuse color value in the lighting computation when using the phong model? My idea so far is to add the photon's diffuse color to the final color value (result of only direct lighting computation) of the fragment . Maybe with an appropriate weight factor to prevent overexposure.
Best Regards,
Stan