# SLIM's CORE FUNCTIONS

## The Core Set of Functions

 The core set of functions provided by Slim can be used to generate a wide range of shaders which utilize many different special features of Slim. These core functions generally serve one particular purpose, like creating a simple noise or a pattern. The functions by themselves are not always useful and must be connected to other functions to obtain a meaningful result, but the atomic nature of functions affords a great deal of flexibility when it comes to assembling shading networks.

## DISPLACEMENTS

A displacement function's primary responsiblity is to perturb either the surface normals or the surface points.  The former is called bump mapping while the latter is known as displacement mapping.  Displacement functions usually provide the option to bump or displace as well as one or more parameters where you'll connect pattern generators for your displacement.

 Combine Add multiple displacements together. Simple Best for when multiple displacements aren't needed.

### SimpleDisplacement

Description: The canonical simple displacement shader.

Displacement Bound
This number represents the maximum displacement in shaderspace that your surface will undergo.  Be very careful with this parameter as it can dramatically influence rendering times.  In particular, make SURE to set this to 0 (zero) if you aren't performing any displacement.

Do Displacement
When enabled surface will be displaced. When disabled the surface will bump.

When a displacement map is used, this shader calls calculatenormal().  This causes polygonal data to appear faceted.  This parameter causes the original shading normal offset to be added to the calculated normal, generally re-smoothing polygonal data.

Kb
A multiplier for the displacement.

Displacement
Connect a float to modulate the displacement.

### CombineDisplacements

Description: Combines an arbitrary number of displacements.

Displacement Bound
This number represents the maximum displacement in shaderspace that your surface will undergo.  Be very careful with this parameter as it can dramatically influence rendering times.  In particular, make SURE to set this to 0 (zero) if you aren't performing any displacement.

Do Displacement
When enabled surface will be displaced. When disabled the surface will bump.

When a displacement map is used, this shader calls calculatenormal().  This causes polygonal data to appear faceted.  This parameter causes the original shading normal offset to be added to the calculated normal, generally re-smoothing polygonal data.

Kb
A multiplier for the displacement.

## LIGHTS

A light function's role is to provide the outer hull of a lightsource shader.  This means that it controls the form of light — whether it's local or infinitely distant or  whether it emits environment light.  Usually light functions provide connection points for coloration, intensity, etc.  When connecting pattern generator functions you must make sure that they operate on the Surface Point Light manifold.  For example, you can create a slide projector by connecting the light color to an Image File node operating on a Surface Point Light manifold via a Perspective Z Projection.

 Distant A distant light. Environment A light for creating environment effects. Indirect Illumination Introduce indirect illumination globally to your scene. Point A point light. Pseudo Area A ray tracing pseudo area light Spot A spot light.

### Distant

Description
Create lighting composed of parallel rays emitting from a direction. The "barn door" effect casts the light within a finite area, a box, which can be defined by a MTOR coordinate system grouped under the light. If the barn door is disabled then the light is cast throughout the entire scene.

Shader Space  Name the MTOR coordinate system here (using its shape name) which defines the constraints of the "barn door," controlling the area that the light will illuminate.

LightColor
The color of your the light. You can connect a pattern generator here or simply use a constant color.  Two common choices are an image map or a spline which varies with distance.

Kl
Scalar multiplier for light color.

Falloff
Normally light intensity diminished with distance. This control governs the degree to which this effect is in play.  Linear falls off more than None, Squared more than Linear, etc.  For more precise control, try connecting the Kl or LightColor parameter to a spline whose pattern is a distance function.

Disable Barn Door
Allows you to turn off the barn door effect, when you desire light to be cast through the entire scene.  You may still tightly focus your shadowmaps, as defined by the bounding box of shadow casting objects.

Penumbra
Controls how sharp an edge the barn door makes.

The color of the shadow. Values other than black can simulate the effect of semi-transparent shadowing.

### Environment

Description: This is used to create an Environment for use in
Reflection and Refraction.

Environment

Connect a false environment. The default is blobby.

Intensity
The brightness of the Environment.

### Indirect Illumination

Description: Introduces indirect illumination into your scene. First create a spot light in your scene and attach this appearance. If you wish to tweak the indirect lighting controls, create a connection to a new instance of the Indirect Light template. Otherwise you'll get default behavior. Usually you'll want to open the cone angle of the light to 180 degrees which will result in all surfaces receiving global illumination. For effect, you can narrow the cone angle and thereby limit the global illumination effects to the region within the cone.

The coordinate system in which a shader is defined. Most shaders perform important calculations relative to this space and so transforming it affects their appearance. If empty, the shader space is the object space associated with the attached primitive. Place the name of a coordinate system object here to set the shader space for the shader. If you're using file referencing, use the "coordsys" function to translate the name of the coordinate system (e.g.: [coordsys mtorCoordSysShape10]).

Indirect Enabled
Turn the indirect illumination calculations on and off.

Indirect Illumination
Plug in a function to compute the indirect illumination here.

Indirect Tint
Filter the result

Indirect Multiplier
Increase or decrease the intensity of the effect.

ConeAngle
The cone angle in of the spotlight, measured in degrees.  You can cause this cone angle to match that of your modeler with an expression like: deg(\$CONEANGLE)

PenumbraAngle
The softly lit area at the edge of the spotlight, measured in degrees.  You can cause this angle to match that of your modeler with an expression like: deg(\$PENUMBRAANGLE)

### Point

LightColor
The color of your the light. You can connect a pattern generator here or simply use a constant color.  Two common choices are an image map or a spline which varies with distance.

Kl
Scalar multiplier for light color.

Falloff
Normally light intensity diminished with distance. This control governs the degree to which this effect is in play.  Linear falls off more than None, Squared more than Linear, etc.  For more precise control, try connecting the Kl or LightColor parameter to a spline whose pattern is a distance function.

The color of the shadow. Values other than black can simulate the effect of semi-transparent shadowing.

Double-click to open sub-menu. Add the name of the shadow map here if you want to cast shadows from this light source. To refer to a shadow that's computed via TORAttributes, you should use an expression like \[shdmap \\$OBJNAME \$i\]

Samples
Higher settings result in a higher quality shadow. Lower settings are faster.

Blur

Bias
shadow algorithm. Set the bias to 0 if you want
to use the default shadow bias.

### Pseudo Area

Description: Simulates the soft lighting associated with area lights. In order to get arealight-like soft shadows you should connect the shadows parameter to the ray traced shadows function and enable ray tracing.

Light Color
The color of your the light. You can connect a pattern generator here or simply use a constant color. Two common choices are an image map or a spline which varies with distance.

Ki
Scalar multiplier for light color.

Falloff
Normally light intensity diminishes with distance. This control governs the degree to which this effect is in play. Linear falls off more than None, Squared more than Linear, etc. For more precise control, try connecting the Kl or LightColor parameter to a spline whose pattern is a distance function.

Shape
The type of area light primitive: disk, line, cylinder, sphere, or rectangle.

Length
Controls the length of the pseudo arealight. For Line, Cylinder and Rectangle, the length increases along the light's x axis. For Sphere and Disk, Length is ignored.

Controls the radius or height of the pseudo arealight. For Sphere, Disk and Cylinder this value determines the radius of the shape. For Rectangle, the height increases along the light's y axis. This parameter is ignored by Line.

Samples
Amount of ray samples cast by the light

Connect a shadow function here. Be sure to use the pointlight version of shadow mapping.

The color of the shadow. Values other than black can simulate the effect of semi-transparent shadowing.

Diffuse Coloration
Controls the amount this light contributes to the diffuse portion of a surface's shadingmodel.

### Spot

Emits Photons
This attribute determines whether a light should take part in photon map generation. Light sources that don't emit real illumination (like indirect) should NOT take part in photon map generation since their purpose is to collect illuminance information in other contexts.

LightColor
The color of your the light. You
can connect a pattern generator here or simply use a constant color.  Two common choices are an image map or a spline which varies with distance.

Kl
Scalar multiplier for light color.

ConeAngle
The cone angle in of the spotlight, measured in degrees.  You can cause this cone angle to match that of your modeler with an expression like: deg(\$CONEANGLE)

PenumbraAngle
The softly lit area at the edge of the spotlight, measured in degrees.  You can cause this angle to match that of your modeler with an expression like: deg(\$PENUMBRAANGLE)

Falloff
Normally light intensity diminished with distance. This control governs the degree to which this effect is in play.  Linear falls off more than None, Squared more than Linear, etc.  For more precise control, try connecting the Kl or LightColor parameter to a spline whose pattern is a distance function.

The color of the shadow. Values other than black can simulate the effect of semi-transparent shadowing.

Connect a shadow function here if you want to cast a shadow from this light source.

Specular Contribution
Controls the amount this light contributes to the specular portion of a surface's shadingmodel.

Diffuse Contribution
Controls the amount this light contributes to the diffuse portion of a surface's shadingmodel.

Caustic Effects
These controls govern the calculation and use of photon maps for the purposes of simulating caustics. Caustics appear in the diffuse component of recipient surfaces and only come about when you've enabled ray tracing. First create and position a spotlight to represent the photon emitter. Next, make sure the photon emission attribute is enabled on that light. Note that photons will be emitted from all photon emitting lights. Finally, pick a photon shading model for all interacting surfaces. Currently, photon scattering assumes physically based 1 over distance squared light falloff. It therefore might be easiest to set the direct illumination falloff to Squared. If this isn't desirable, you can use the Photon Multiplier to independently account for this difference.

Caustics

Connect this parameter to the PhotonMapCaustic template and specify controls there.

Caustic Multiplier

Increase or decrease the caustic effect.

Caustic Tint

Filter the caustic through a color or connection.

## VOLUMES

A volume function's role is to provide the outer hull of a volume shader.  Pixar's PhotoRealistic RenderMan supports volume shaders for atmospheric effects and you can attach volumes to individual objects or to the entire scene.
 Fog Volumetric fog.

### Fog

Description: Produces a foggy or hazy atmosphere with light source variation within the atmosphere; so shadows and light will cast appropriately through the fog.

Color
The Color of the fog or haze.

Density
The overall Density of the the fog. This scales the density Variation function value.

Variation
The Variation in the density of the fog. The connected function's manifold should be connected to \"World Point\" to get a consistent pattern across all surfaces. Leave this a constant to get a uniformly hazy atmosphere.

Back Scatter
This affects the way light is scattered by the fog. Larger values will make the fog brighter in light shining toward the camera than smaller ones. This is related to the size of the fog particles: larger particles like dust will have more back scatter than smaller particles like air molecules.

Sampling Increment
Sets the step size used to integrate the fog effect along the view ray. Larger values will
cause aliasing in the light variations within the fog, but smaller values will require more compute time. The best value depends on the scene. If set to 0, then no sampling is done and only the light value at the surface is used, so no light variation will be visible within the fog.

Sampling Increment
Sets the step size used to integrate the fog effect along the view ray. Larger values will
cause aliasing in the light variations within the fog, but smaller values will require more compute time. The best value will be scene dependent. If set to 0, then no sampling is done and only the light value at the surface is used, so no light variation will be visible within the fog.

Important:
When using fog globally within a scene, be sure to name the appearance "world" as this special case name will cause the fog to permeate the entire scene.