Practical and theoretical implementation discussion.
sajis997
Posts: 27
Joined: Thu Jul 12, 2012 11:59 pm

Hello forum,

The rendering equation is recursive in nature, i believe . The basic rendering equation is follows:

Code: Select all

`Outgoing Radiance = BRDF * incoming Rdiance * Incident angle;`

All radiance values incident at surface point x are themselves outgoing
radiance values. We have to trace back the path they arrive from. This
means tracing a ray from x in the direction of the incoming radiance. This
results in some surface point, and the incoming radiance along the original
direction now simply equals the outgoing radiance at this new point.

If i have to put it into code, it becomes something as follows:

Code: Select all

`Color trace(const Ray &ray){    Intersection is;   bool hit = scene->intersect(ray,intersection);............................................. if(hit) {    ................    .................   float pdf;   Vector d = sampleCosine(is,pdf);   Setup ray r in direction d   out = (trace(r) * brdf  * incident angle)/ (pdf); } return out;}`

When it comes to photon , i believe that we have to reformulate the rendering equation as follows:

Code: Select all

`Flux spread into the single direction = (BRDF * incident flux * incident angle)/pdf;`

And i am confused about putting into the code. I believe the immediate above tells us how much of the flux that spreads to a single direction. I tried as follows:

Code: Select all

`Color trace(const Ray &ray, const Color &photonFlux){...................................... if(hit) {    ................    .................   float pdf;   Vector d = sampleCosine(is,pdf);   Setup ray r in direction d   out = (trace(r, photonFlux) * brdf  * incident angle)/ (pdf); } return out;}`

In the above snippet the photon flux is not changing after the diffuse scatter. Should it not be altered ? I m lost here. And the generated image is far from the accepted the result

Some hint/reference/discussion will be of great help.

Thanks