This document provides an introduction to Open Shading Language (OSL), including:
- OSL was developed at Sony Imageworks to describe shaders for use in rendering pipelines for movies. It uses the LLVM infrastructure.
- OSL allows accurately replicating measured surface properties like BRDFs to flexibly represent surface properties in rendered scenes.
- In OSL, shaders define functions that return surface, displacement, volume properties or new shaders, rather than directly calculating pixel colors. Reflectance and transmittance are modeled as functions called "closures".
- OSL closures compute an explicit symbolic description of how surfaces or volumes scatter light, which can be evaluated, sampled
2. Introduction
●OSL was developed at Sony Imageworks, for use
in its rendering pipelines for movies.
●It is a shader description language, built out of
LLVM infrastructure.
3. Why OSL
● To be able to replicate the behaviour of pre-recorded
BRDF using instruments like the Gonioreflectometer.
● Once recorded, these BRDFs can be replicated almost
accurately in the rendered scene
● More flexible representation of properties of surfaces
4. The OSL shader
● In OSL, shaders do not calculate color output per pixel, but
define a function that returns a surface, displacement,
volume or define a new generic shader
● Reflectance and Transmittance of surfaces are modelled
as functions, or "Closures"
● These shaders are evaluated during the rendering phase
5. Open Shading Language
● OSL's surface and volume shaders compute an explicit
symbolic description, called a "closure", of the way a
surface or volume scatters light, in units of radiance
● These radiance closures may be evaluated in particular
directions, sampled to find important directions, or saved
for later evaluation and re-evaluation (by component
blocks called as "Integrators")
– From "Larry Gritz, OSL_Introduction"
6. Example Surface Shader
● A sample surface shader looks like below:
surface
test (string noisename = "gabor", float freq = 5, output color Cout =
0)
{
point p = P*freq * (1.0+10*v*v) * (1.0+10*u*u);
float n = noise(noisename, p[0], p[1]);
cout = n * 0.5 + 0.5;
}
7. Sample Scenes built out of OSL
● Some examples are to be found in chocofur.com
(http://store.chocofur.com/exterior-scene-01), that look
amazingly realistic
8. Source Code and More Details
● The source code for OSL is provided under a liberal New
BSD license, at,
● https://github.com/imageworks/OpenShadingLangua
ge