8
Introduction to Open Shading Language Prabindh Sundareson

Open Shading Language (OSL)

Embed Size (px)

Citation preview

Page 1: Open Shading Language (OSL)

Introduction to Open Shading Language

Prabindh Sundareson

Page 2: Open Shading Language (OSL)

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.

Page 3: Open Shading Language (OSL)

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

Page 4: Open Shading Language (OSL)

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

Page 5: Open Shading Language (OSL)

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"

Page 6: Open Shading Language (OSL)

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;

}

Page 7: Open Shading Language (OSL)

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

Page 8: Open Shading Language (OSL)

Source Code and More Details

● The source code for OSL is provided under a liberal New BSD license, at,

● https://github.com/imageworks/OpenShadingLanguage