The main feature in this release is the integration of the Open Shading Language. There have been a lot of pondering and a few false starts (hence the 6 months hiatus with the previous post) but here it is. Well, sort of …

While trying to establish a road map for next XRT features, I discussed the pros and cons of OSL here: great features but really tailored to a path tracer (no light shaders, hard-coded lighting models (aka closures)). Losing the flexibility brought by the RenderMan Shading Language was really making me uneasy.

Therefore, I first considered implementing RSL on top of OSL machinery: RSL 1.0 and OSL are quite similar, there were only a few global variables and shade-ops missing from OSL to bring back the needed functionalities. Confidently, I started an implementation: I wrote a parser that compiled RSL into .oso intermediate representations and … I gave up because I realized it was a dead end even if it was progressing nicely.

There are several technical reasons for this:

  • the latest RSL 2.0 is really different from OSL and would have required a much extensive effort.
  • most of RSL derivative shade-ops work in the surface parametric space whereas OSL shade-ops work on the surface tangent plane. Some shaders would have required a rewrite to perform properly.

But the main reason is that Pixar is going to drop RSL in favor of OSL (see this discussion on OSL Google group or this announcement from Pixar). Of course, RSL is not going to disappear tomorrow but will surely get deprecated in the future.

Therefore, I have settled for an easier path: tailor OSL. XRT shaders follow strictly OSL syntax but there are significant differences:

  • light shaders are back. A specific statement emit is used to define how light is emitted. Only light shaders write to global variables Cl (light color) and L (light direction).
  • closures are gone. Surface and volume shaders write to global variables C (surface color) and opacity (surface opacity) and gather light with a lights loop statement which has access to all lights in the scene. Only a lights loop can read current light Cl and L.
  • a number of ray-tracing shade-ops have been added to trace rays, compute shadows, occlusion and diffuse-diffuse illumination.

More details can be found in XRT Technical Reference manual.1

Although much more work is needed to finalize this porting effort, there are already a few benefits to notice:

  • because the LLVM infrastructure is bundled into XRT distribution, there is no need anymore to install Microsoft Visual C++ compiler (which was a rather heavy requirement for people eager to try out XRT).
  • XRT is faster. The speedup is not huge but noticeable.

All XRT examples have been checked against this release and run OK (although some renders differs quite a bit from their RenderMan based counterpart) and a number of shaders have been ported to OSL. Over the next months, I intend to re-render, recheck (and extend) the whole gallery.