I am trying to implement the [glTF 2.0 material system][1] in my (monte carlo) path tracer. I am stuck on a few details, and need assistance:
- In the specification, the vectors
LandVare used which typically refer to the vector from the intersection point towards a light source and the vector from the intersection point towards the camera respectively.
I do not have direct illumination implemented yet, thus there are no dedicated light sources in my scenes. The only "light source" is a background color which could be seen as "ambient lighting". Thus, I have chosen to interpret L as wi in my implementation where wi is the sampled bounce ray. My motivation for this is that I am bouncing in that direction in order to find out what the light contribution from that angle is. Thus, in some way L and wi are the same thing(ish). I do not know if this is a correct thing to do.
Furthermore, since there are many rays bouncing around there isn't a "given viewing direction"; rather, I am choosing to interpret V as wo where wo is the incoming ray direction. Again, I do not know if this is a correct thing to do.
- Figuring out how to sample a new bounce direction in
SpecularBRDF::sample, as well as what the PDF is.
The specification uses a microfacet BRDF that uses some complicated functions. Evaluating the BRDF is easy enough; however, it is not trivial to figure out how to sample a new direction as well as what the PDF is. At least not for me.
- Figuring out how to sample a new bounce direction in
Dielectric::sample, as well as what the PDF is.
Similar problem as with 2. above. A Dielectric material has a SpecularBRDF and a DiffuseBRDF. I have no clue how I am supposed to take into account both of them when wanting to sample a new direction as well as defining the PDF.