The stdrsl Library

The stdrsl Library

Introduction

The stdrsl shader library is intended to be a true resource for writing production shaders. The files can be found in $RMANTREE/lib/rsl/include/stdrsl/. The shader compiler is aware of this special location, so clients should refer to stdrsl components like so:

#include <stdrsl/SphericalHarmonics.h>

Header Files

Currently we include the following header files:

AreaSampler.h

Implements methods for generating points on a selection of common shapes. Primarily used by pseudo area lights to both distribute samples across simple geometric shapes and to trace rays against them. Because of the common use case, we rely on RadianceSample for data exchange. Generated samples write to the lightPdf field a worldpsace measure of the solidangle associated with the sample. We always write non-zero PDF values for generated samples. We also squirrel into the radiance field shape-specific parametric coordinates to uniquely identfy the sample. evaluateSamples is the inverse operation and obeys the same conventions as generateSamples.

BSDFComponent.h

This file provides a pure-virtual base class characterizing the standard interface of a BSDF component "by" the build-in integrators.

Colors.h

Serves as a central repository for common color manipulation functions.

Fresnel.h

Provides encapsulation of different techniques for approximating Fresnel refraction effects. Currently we support two approxations:

  1. init - uses the default Fresnel shading function.
  2. initSchlick - uses the faster Schlick's approximation.

Hair.h

Provides physically plausible components for hair. It includes a diffuse component based on Dan B. Goldman's Fake Fur Rendering, models three specular transport paths:

R (reflection),
TRT (Transmission/Reflection/Transmission)
TT (Transmission/Transmission)

based on Light Scattering from Human Hair Fibers, by Stephen R. Marschner, Henrik Wann Jensen, Mike Cammarano, Steve Worley, and Pat Hanrahan, and was simplified according to An Artist Friendly Hair Shading System, by Iman Sadeghi, Heather Pritchett, Henrik Wann Jensen, and Rasmus Tamstorf.

HenyeyGreenstein.h

A simple BSDFComponent: an anisotropic scattering volumetric specular component parameterized by a color and a scattering parameter "g", which is the mean cosine of scattering interactions. g is between -1 and 1. A value of g > 0 indicates the volume is primarily forward-scattering while g < 0 indicates the volume is backwards-scattering. g = 0 means the volume is isotropic.

IsotropicVolume.h

A simple BSDFComponent: an isotropic scattering volumetric diffuse component parameterized by a diffuse color. Users may wish to separate the color into two terms in the calling environment - Kd and diffuseColor - but should combine these before invoking init.

Lambert.h

The simplest of BSDFComponents - a Lambertian diffuse component parameterized by a diffuse color. Users may wish to separate the color into two terms in the calling environment - Kd and diffuseColor - but should combine the two before invoking init.

Logger.h

A simple object that can be used to log error messages.

Math.h

Provides a central repository for common mathematical constants and useful functions.

OrenNayar.h

Provides a microfacet diffuse component parameterized by a diffuse color and roughness. As with other components, users may wish to separate the color into two terms in the calling environment - Kd and diffuseColor - but should combine the two before invoking init.

RadianceSample.h

__radiancesample is the basic unit of communication between lights and surfaces and is explicitly managed by the renderer's built-in directlighting and indirectspecular integrators. The __radiancesample struct is unique inasmuch as it is built into the renderer and therefore "non-negotiable".

SampleMgr.h

This component manages sample reduction up various ray trees.

SampleMgrPathTrace.h

This component manages sample reduction up various ray trees with provisions for sample reduction when the raytrace hider is in path tracing mode.

ShadingContext.h

ShadingContext.h provides a container for geometric and other contexts relevant to BSDFs.

SpecularAS.h

This lobe provides the Ashikhmin-Shirley anisotropic specular model and is intended to be used with a separate diffuse component.

SpecularDBRDF.h

This lobe models the single-scatter specular term, and is intended to be used with a separate diffuse component. The key advantage of the DBRDF formulation is that it does not restrict the distribution to any particular shape. This implementation allows the use of the Beckmann and Phong distributions.

SpecularMicrofacet.h

This component can be used in three ways, as governed by the mode parameter:

"refl+refr"

combined component - distributing samples across both refraction and reflection components

"refl"

single specular component - standard non-refraction usage case

"refr"

single refraction component - only useful if a ggx transmission component is to be combined with non-ggx speculars

From Walter, Marschner, Li, and Torrance's Microfacet Models for Refraction through Rough Surfaces; Eurographics Symposium on Rendering 2007.

SpecularMicrofacetDriver.h

This file provides shared code for invoking per-distribution implementation of SpecularMicrofacet.h, above.

SphericalHarmonics.h

This file provides functions for creating, evaluating, convolving, and rotating spherical harmonics. Example usage can be found in the Image-Based Relighting application note.