[Bf-committers] Path Tracer status (Farsthary)

echelon at infomail.upr.edu.cu echelon at infomail.upr.edu.cu
Fri Feb 6 17:39:31 CET 2009

Hi all!

  I want to specially thanks Yves,Bretch and Matt for your incredible
  Here's the statust of the pathtracer:
  I have rewritten it to a more flexbile architecture and currently
keepeing it as simple as possible.
  I have opted for the black box model (modular approach) and that allows
me now to support arbitary BSDF functions.

  the main functions are:

  float BSDF(....)
  that return the ratio between outgoing radiance an incoming radiance.
its value (if is physically based, although users could experiment with
non physical also) will be always lower or equal to 1.0  and its actual
implementation will depend on the chosen model, there's a lot of
analythical models out there, some fastest than others , some more 
accurate than others, it is relatively easy to add new models to it but
for the shake of simplicity currently I will implement one or two.
  This design will also allow to keep independent the main core from the
  actual material implementation and will allow me to add easily in the
future spectral rendering :).
  Also in the future, if is plausible, could be extended to support
dataset BSDF/BRDFs models.

  I have to say something regarding the discussion of an accurate
physically based rendering: you do nothing with have a very accurate
BSDF function if you loose accuracy on other parts of the render
pipeline, it simply will make render times longer without gainig too
  For the first iteration of this implementation I plan a moderate accuracy.
  keeping small goals ensure the success of a task :)

  float sample_BSDF(...,float *vout)
  its responsibilities are to return the outgoing direction with a
probability proportional to the BSDF value at that point.(with a
roussian roulette) for example a perfect diffuse material have a
constant BRDF value, so the scattering probability will be equal in all
directions and thus the sample_BSDF() function will return with equal
probability all ray directions (provided sufficient samples).
 A perfect specular material will have a Dirac-like BRDF function so the
scatter directions will tend to one only.

  void sample_path(...)
  this is the recursive path tracer itself, that keeps tracing until the
sample_BSDF() dictates it must stop (light absorbed).
  here several stop criteria could be implemented, like depth recursion
limitation and so.

  void integrator()
  this function handle the actual integration task, whether its spectral
based or trisitimulus based (RGB), or any other integrand type.
   (currently I have implemented RGB only but should not be difficult to
extend to a spectral sampling)

  void path_trace(struct ShadeInput *shi,ShadeResult *shr)
  this is the main caller function plugged to the shade_material_loop(),
  in the render pippeline, that will allow to implement independently
physically based material models and smooth integration with the rest of
the pippeline :) (like volumetrics and future photon map GI do)

  So basically the path tracer is pretty independent of the actual
material implementation and the BSDF function used, so we could improve
independently the path tracer and the shader properties!

Off course, not everything is pink color :(
 as I said before I have some troubles now with the orientation of vectors
(normals), and that the system not seems to use smoothed normals (all are
flat faces) because I have used the ray tracing code from the previous
Matt's photon map code (any solutions?)
   (perhaps I should trace back the code of the full Blender raytracer to
see what I could reuse from that, but I then have the risk of have lots
of redundant/not important code)

  After the next week (remember I will be in an event in Havana) I will
retake this and if I could solve to some extents the orientation and
normal issues then I will make the first don't-make-high-expectations

                             Cheers to all and thanks for your support :)

More information about the Bf-committers mailing list