Each ray tracing toolkit does this a little differently. But they all have the same pattern:
color = BRDF(random direction) * cosine / pdf(random direction)
The complications are:
0. That formula comes from Monte Carlo integration, which is a bit to wrap your mind around.
2. pdf() is a function of direction and is somewhat arbitrary, through you get noise if it is kind of like the BDRF in shape.
3. Even once you know what pdf() is for a given BRDF, you need to be able to generate random_direction so that it is distributed like pdf
Those 4 together are a bit overwhelming. So if you are in this for the long haul, I think you just need to really grind through it all. #0 is best absorbed in 1D first, then 2D, then graduate to the sphere.
3 comments:
Pete,
It is even more complicated than that, right? It might even depend on the exact parameterization you use for the hemisphere. That might give you an additional sin term, or something else.
Phil, kind of. Generally speaking, that particular complexity is part of the "BRDF" factor.
The BRDF is a function of the incoming and outgoing directions, but only when those directions are expressed in a local coordinate system. It's that "local coordinates" aspect that is responsible for a lot of the complexity in real BRDFs.
I would like to appreciate your work and would like to tell to my friends.
Graphiste Grenoble
Post a Comment