042 · OSL
Open Shading Language · quid sit, non quomodo
Project Lavos · The Stack
PLATE XLII · ANATOMY OF A CLOSURE

Quid sit, non quomodo.

— WHAT IT IS, NOT HOW —

the closure.

Larry Gritz  ·  Sony Pictures Imageworks · 2010  ·  ASWF · 2018

SHADER LANGUAGE · CLOSURE-RETURNING · DEFERRED EVALUATION · PRODUCTION-PROVEN

GLSL computes pixels. OSL describes surfaces. An OSL shader does not return a color — it returns a closure, a recipe of BSDF lobes the renderer can interrogate three ways: sample a direction, evaluate at a direction, return the pdf of that direction. The shader specifies what the surface is. The renderer decides how to ask. Cycles, Arnold, RenderMan, V-Ray, Karma, Mantra — all consume the same .oso bytecode and answer their own integration strategy.

brushed_metal.osl · OSL 1.13 · production shader the shader as recipe, not result
// Anisotropic brushed copper with thin clearcoat.
// Returns a closure, not a color — the renderer decides
// how to evaluate (path trace, BDPT, MLT, photon map).

shader brushed_copper (
    color  base_color   = color(0.95, 0.62, 0.34),
    float  roughness_u  = 0.42,                  // along brush direction
    float  roughness_v  = 0.18,                  // perpendicular
    float  coat_weight  = 0.04,
    vector brush_dir    = vector(1, 0, 0),
    output closure color BSDF = 0
)
{
    vector T = normalize(cross(N, brush_dir));

    // Each line is a BSDF lobe. + composes them.
    // The renderer never sees a color — it sees this:
    BSDF =  base_color * microfacet("ggx", N, T, roughness_u, roughness_v, 1.5, 0)
         +  coat_weight * microfacet("ggx", N, 0.05, 1.5, 0) ;
}
← amber = closure expressions · the renderer's three questions can address each compiles to .oso bytecode · loads anywhere
— Plate XLII · The closure, interrogated · BSDF cross-section — after Gritz, SIGGRAPH 2010
— Fig. I · the closure as object · the renderer's three questions — N ωi · light in PEAK brush axis · T SAMPLE() → ω, weight EVAL(ω) → BRDF value PDF(ω) → probability surface · brushed copper microfacet · GGX CLOSURE microfacet × 2 · sum SHADER brushed_copper.osl QUESTIONS SAMPLE · EVAL · PDF 3
— Closure — microfacet × 2 · sum
— Output type — closure color · not color
— Questions — 3 · sample, eval, pdf
— Renders on — 6+ · same .oso
— The Three Questions · the renderer's interface to a closure — each integrator picks the question it needs
SAMPLE
sample.importance-driven
closure.sample(ωo)
→ (ωi, weight, pdf)
Pick a likely incoming direction. The closure's lobe shape determines the distribution. Path tracing depends on this.
EVAL
eval.spot-check
closure.eval(ωi, ωo)
→ BRDF value
Given a specific incoming direction, what is the lobe value here? Light tracing and connection-based estimators depend on this.
PDF
pdf.density-only
closure.pdf(ωi, ωo)
→ probability density
For multiple-importance-sampling: what was the probability of choosing this direction? MIS combinations depend on this.
— Six Renderers · One .oso — same closure, six integrators, six images that converge to the same pixel
Cycles
2011
CPU OSL · GPU compiled at runtime
Arnold
2012
native OSL since 5.0 · film standard
RenderMan
2014
replaced RSL · RIS engine
V-Ray
2015
full OSL closure support
Karma
2020
USD-native · OSL via MaterialX
Mantra
2013
VEX + OSL hybrid

The trick is the inversion. The shader doesn't compute — it returns a closure, a deferred specification of what kind of surface this is. The renderer decides how to evaluate.

This is what lets one .oso work in path tracing, light tracing, bidirectional path tracing, photon mapping, and Metropolis. The shader doesn't know the integration strategy. It doesn't need to.

Authorship & Provenance colophon — Sony Pictures Imageworks
Authorship
Larry Gritz
Sony Pictures Imageworks · 2008–2010
open-sourced 2010 (BSD)
github.com/AcademySoftwareFoundation/OpenShadingLanguage
Architecture
C-like · closure-returning
compiles to .oso bytecode
LLVM JIT to native at load time
~150 standard closures · spec ~1.13
Governance
Academy Software Foundation
Linux Foundation · 2018
Sony · Pixar · DreamWorks · Autodesk · SideFX
aswf.io

— Lineage · the closure becomes the standard —

2008Larry Gritz at Sony Imageworks begins designing OSL — production renderers needed a shading language that could survive cross-integrator use.
2010OSL 1.0 released open-source · Apache → BSD · adopted internally for Cloudy with a Chance of Meatballs 2, the Smurfs sequels.
2011Cycles 0.4 ships OSL support. Blender becomes the first open-source renderer to consume Imageworks' shader language natively.
2012Arnold 4.x adopts OSL. Sony switches their internal renderer from RenderMan-RSL shaders to OSL.
2014RenderMan replaces RSL with OSL in the new RIS engine. Pixar standardizes on it.
2017OSL 1.10 — full closure-based BSDF taxonomy. Spider-Man: Into the Spider-Verse ships on it.
2018OSL joins the Academy Software Foundation. Linux Foundation governance.
2024OSL 1.13 — first-class GPU support via Cycles' OptiX backend. Closures now JIT to PTX.
The renderer decides. Same .oso, every production path tracer, the same surface.

the renderer decides.

The shader specifies what the surface is. The renderer decides how to ask. One closure, three questions, every integrator gets its answer.

— § II · Shading · Closures / Production —
Plate XLII · MMXXVI
projectlavos-bauhaus · 042