Documentation/SL Functions - PixieWiki
Keywords: Documentation/SL Functions,Documentation/Baking 3D Textures,Documentation/Global illumination,Documentation/Raytracing in SL,Documentation/Global Illumination

# Documentation/SL Functions

### From PixieWiki

< Documentation

# [edit] Sl function Index

Deriv Du Dv abs acos ambient area asin atan attribute bake3d calculatenormal ceil cellnoise checkers clamp clearlighting colormap comp concat cos ctransform degrees depth determinant diffuse | displacement distance environment exp faceforward filterstep floor format fresnel gather illuminate illuminance incident indirectdiffuse inversqrt length lightsource log match max min mix mod noise normalize | ntransform occlusion opposite option phong photonmap pnoise pow printf ptlined radians random raydepth rayinfo raylabel reflect refract rendererinfo rotate round scale setcomp setxcomp setycomp setzcomp | shadername shadow sign sin smoothstep solar specular specularbrdf spline sqrt step surface tan texture texture3d textureinfo trace transform translate transmission urandom visibility vtransform xcomp ycomp zcomp

NB: UNDER CONSTRUCTION, expect to see more detailed documentation here over time

# [edit] SL Function Reference

## [edit] Math Functions

### [edit] abs

    float abs(float f)

return the absolute value of the argument (negative numbers become positive)

### [edit] acos

    float acos(float f)

Returns the arc cosine of the argument (in radians)

### [edit] asin

    float asin(float)

Returns the arc sine of the argument (in radians)

### [edit] atan

    float atan(float f)
    float atan(float y,float x)

Returns the arc tangent of the argument (in radians). The second form of the function returns an answer covering -180 to 180 degrees using the signs of `y` and `x` to cover the full range.

### [edit] ceil

    float ceil(float f)

Returns the next highest integer for a float f.

### [edit] clamp

    color clamp(color c, float cmin, float cmax)
    float clamp(float f, float fmin, float fmax)
    normal clamp(normal n, normal nmin, normal nmax)
    point clamp(point p, normal pmin, normal pmax)
    vector clamp(vecotr v, vector vmin, vector vmax)

Clamps the first argument to the second two (inclusive)

### [edit] comp

    float comp(color c, float comp)
    float comp(matrix m, float row, float column)
    float comp(normal n, float c)
    float comp(point p, float c)
    float comp(vector v, float c)

Returns the numbered component from a color, point, normal or vector. The components are numbered x:0, y:1, z:2. The matrix form of the shadeop takes two arguments for the row and column, also numbered from 0.

### [edit] cos

    float cos(float f)

Returns the cosine of the argument (in radians)

### [edit] degrees

    float degrees(float f)

Converts the argument (in degrees) into radians

### [edit] Deriv

    float Deriv(float n,float den)
    color Deriv(color c,float den)
    normal Deriv(normal n,float den)
    vector Deriv(point p,float den)
    vector Deriv(vector v,float den)

Returns the derivative of the first argument with respect to the second. This is done using the chain rule, such that

    Deriv(n,den) = Du(n)/Du(den) + Dv(n)/Dv(den);

### [edit] determinant

    float determinant(matrix m)

Returns the determinant of the matrix m. This is zero if the matrix is singular.

### [edit] Du

    float Du(float f)
    color Du(color c)
    normal Du(normal n)
    point Du(point p)
    vector Du(vector v)

Compute the derivative of the argument with respect to `u`

### [edit] Dv

    float Dv(float f)
    color Dv(color c)
    normal Dv(normal n)
    point Dv(point p)
    vector Dv(vector v)

Compute the derivative of the argument with respect to `v`

### [edit] distance

    float distance(point p1, float p2)

Returns the distance between the points `p1` and `p2`

### [edit] exp

    float exp(float f)

Returns e to the power of `x`

### [edit] floor

    float floor(float f)

Returns the next lowest integer for the float f

### [edit] inversqrt

    float inversesqrt(float f)

Returns 1/sqrt(f)

### [edit] length

    float length(vector v)

Returns the length of the vector v

### [edit] log

    float log(float f)
    float log(float f,float b)

Returns log(f), the second form returns log base b of f.

### [edit] max

    float max(float f1,....)
    float max(vector v1,...)

Returns the maximum of the arguments given. The second form returns the maximum (component wise) of each component of the arguments, which can be a color, point, normal or vector.

### [edit] min

    float min(float f1,....)
    float min(vector v1,...)

Returns the minimum of the arguments given. The second form returns the minimum (component wise) of each component of the arguments, which can be a color, point, normal or vector.

### [edit] mix

    color mix(color a, color b, color alpha)
    color mix(color a, color b, float alpha)
    float mix(float a, float b, float alpha)
    normal mix(normal a, normal b, float alpha)
    normal mix(normal a, normal b, normal alpha)
    point mix(point a, point b, float f)
    point mix(point a, point b, point alpha)
    vector mix(vector a, vector b, float alpha)
    vector mix(vector a, vector b, vector alpha)

Mixes the first two arguments in the form:

    (1-alpha)(a) + (alpha)(b)

This is done per component in the non-float versions of the function.

### [edit] mod

    mod(float a, float b)

Returns the remainder of a divided by b

### [edit] normalize

    color normalize(color c)
    normal normalize(normal n)
    point normalize(point p)
    vector normalize(vector v)

Returns the the normalized version argument. If the argument has zero length, a zero-length result will occur, otherwise the result is unit length.

### [edit] pow

    pow(float a, float b)

Returns a raised to the power b

### [edit] ptlined

    float ptlined(point p1, point p2, point q)

Returns the minimum perpendicular distance between the finite line passing through p1,p2 and the point q. If the shortest perpendicular distance between the point q and the infinite line between p1 and p2 is past the end of the finite line, then the distance between the nearest end of the line is returned.

### [edit] radians

    float radians(float f)

Returns the argument (in degrees) converted into radians

### [edit] sign

    sign(float f)

Returns 1 if the number is positive or zero, or -1 otherwise

### [edit] sin

    float sin(float f)

Returns the sine of the argument in radians

### [edit] sqrt

    float sqrt(float f)

Returns the square root of the argument

### [edit] spline

    float spline([string basis],float value,float f1,float f2,float f3,float f4....)
    float spline([string basis],float value,float fvals[])
    color spline([string basis],float value,color c1,color c2,color c3,color c4....)
    color spline([string basis],float value,color fvals[])
    point spline([string basis],float value,point p1,point p2,point p3,point p4....)
    point spline([string basis],float value,point pvals[])
    normal spline([string basis],float value,normal n1,normal n2,normal n3,normal n4....)
    normal spline([string basis],float value,normal nvals[])
    vector spline([string basis],float value,vector v1,vector v2,vector v3,vector v4....)
    vector spline([string basis],float value,vector vvals[])

Produces a spline interpolation of the provided values (either as an array or as inline arguments), based on the value `value`. The interpolation basis can be optionally specified, and defaults to `catmull-rom`. It can be one of "catmull-rom", "bezier", "bspline", "hermite". The number of required data points is

`catmull-rom` | any >= 4
`bezier` | 4n+3
`hermite` | 4n+2
`bspline` | any >= 4

### [edit] round

    float round(float f)

Rounds the argument to the nearest integer.

### [edit] setcomp

    setcomp(color c,float comp,float v)
    setcomp(matrix m,float row,float column,float v)
    setcomp(normal n,float comp,float v)
    setcomp(point p,float comp,float v)
    setcomp(vector v,float comp,float v)

Sets the specified component of the first argument to the value v. The matrix form takes two arguments, specifying row and column. Components are indexed from 0.

### [edit] setxcomp

    setxcomp(normal n, float v)
    setxcomp(point p,float v)
    setxcomp(vector v,float v)

Sets the x component of the first argument to the specified value.

### [edit] setycomp

    setycomp(normal n,float v)
    setycomp(point p,float v)
    setycomp(vector v,float v)

Sets the y component of the first argument to the specified value.

### [edit] setzcomp

    setzcomp(normal n, float v)
    setzcomp(point p, float v)
    setzcomp(vector v, float f)

Sets the z component of the first argument to the specified value.

### [edit] tan

    tan(float f)

Returns the tangent of the argument in radians.

### [edit] xcomp

    float xcomp(normal n)
    float xcomp(point p)
    float xcomp(vector v)

Returns the x component of the argument.

### [edit] ycomp

    float ycomp(normal n)
    float ycomp(point p)
    float ycomp(vector v)

Returns the y component of the argument.

### [edit] zcomp

    float zcomp(normal n)
    float zcomp(point p)
    float zcomp(vector v)

Returns the z component of the argument.

## [edit] Lighting

### [edit] ambient

    color ambient()

Returns the ambient lighting contribution. Ambient lights are those which do not include a `solar` or `illuminate` shadeop.

### [edit] diffuse

    color diffuse(normal n)
    color diffuse(point p,normal n,float angle)

The first form returns the diffuse contribution given the surface normal `n`. It is equivalent to:

    color diffuse(normal n) {
    	extern point P;
    	color C = 0;
    	illuminance( P, n, PI/2 )
    	    C += Cl * normalize(L).n;
    	return C;
    }

The second form allows the position, and angle to be specified. It is equivalent to:

    color diffuse( normal N, normal p, float angle ) {
    	color C = 0;
    	illuminance(p,n,angle)
    	    C += Cl * normalize(L).n;
    	return C;
    }

### [edit] phong

    color phong(normal n,vector I,float size)

### [edit] specular

    color specular(normal n,vector I,float roughnes)

### [edit] specularbrdf

    color specularbrdf(vector L,normal n,vector I,float roughnes)

### [edit] illuminate

    illuminate(point position) {
    	// statements
    }
    illuminate(point position,vector axis,float angle) {
    	// statements
    }

The first form casts light from the specified `position` in all directions. The second form casts directional light from the specified position, along the specified `axis` with angular spread `angle` in radians.

Inside the loop `L` is the distance from `Ps` to the specified point `position`. Statements inside the loop set the lightingt contribution by setting `Cl`.

### [edit] illuminance

    illuminance([string category], point position ){
    	// statement
    }
    illuminance([string category], point position, vector axis, float angle ) {
    	// statement
    }

Illuminance loops over lights (optionally specifying a lighting category to control which lights to include). The first form includes lights contributions from the entire sphere. The second form gathers lighting at the specified `position` in the cone specified by `axis` and `angle`. Inside the loop, statements have access to `L` - the light direction, and `Cl` the light color at the current shading point.

The optional `category`, if specified can include lights using `"name"` or exclude lights using `"-name"`, where `name` is one of the named categories in a light's `__category` parameter. If `category` is not specified or is `""` then all lights are considered.

### [edit] solar

    solar() {
    	// statements
    }
    solar(vector axis,float angle) {
    	// statements
    }

The solar loop emits light from a distant / infinite point. The first form emits light in all directions. The second form restricts light to a cone specified by `axis` and `angle`. Distant directional lightsources are typically specified with `solar(dir,0)`. Inside the loop (as for illuminate), `L` is the direction of the surface element currently being shaded, and `Cl` is set to be the emitted light amount.

### [edit] clearlighting

    clearlighting()

Internally, Pixie caches lighting, so subsequent calls to diffuse() illuminance() and so on do not need to re-execute the lights. The positions,normals,distribution angles are used to determine when the saved lighting can be reused. The `clearlighting()` shadeop forces Pixie to recalculate lights. You should not need to call this.

### [edit] photonmap

    color photonmap(string mapname,point p,...)
    color photonmap(string mapname,point p,normal n,...)

where `mapname` is the name of the photon map (e.g. `global.gpm`),`P` is the lookup point and `N` is the lookup normal. The first form does not discriminate based on the normal - meaning it finds photons with all directions. The second form discriminates based on lookup normal, such that only photons travelling in the opposite direction to `n` will be found (those falling on the front side of the surface. The following optional parameters can also be passed:

`uniform float estimator` | The number of photons to use for lookup
`niform float maxRadius` | The maximum lookup radius

See Documentation/Global illumination

### [edit] indirectdiffuse

    color indirectdiffuse(point p,normal n,float samples,...)

See Documentation/Global Illumination

### [edit] occlusion

    float occlusion(point p,normal n,float samples,...)

Documentation/Global_illumination

## [edit] Message Passing / Attributes & Options

### [edit] attribute

    float attribute(string attr,color res)
    float attribute(string attr,float res)
    float attribute(string attr,matrix res)
    float atrribute(string attr,normal res)
    float attribute(string attr,point res)
    float attribute(string attr,string res)
    float attribute(string attr,vector res)

### [edit] displacement

    float displacement(string attr,color res)
    float displacement(string attr,float res)
    float displacement(string attr,matrix res)
    float displacement(string attr,normal res)
    float displacement(string attr,point res)
    float displacement(string attr,string res)
    float displacement(string attr,vector res)

### [edit] lightsource

    float lightsource(string attr,color res)
    float lightsource(string attr,float res)
    float lightsource(string attr,matrix res)
    float lightsource(string attr,normal res)
    float lightsource(string attr,point res)
    float lightsource(string attr,string res)
    float lightsource(string attr,vector res)

### [edit] incident

    float incident(string attr,color res)
    float incident(string attr,float res)
    float incident(string attr,matrix res)
    float incident(string attr,normal res)
    float incident(string attr,point res)
    float incident(string attr,string res)
    float incident(string attr,vector res)

### [edit] option

    float option(string attr,color res)
    float option(string attr,float res)
    float option(string attr,matrix res)
    float option(string attr,normal res)
    float option(string attr,point res)
    float option(string attr,string res)
    float option(string attr,vector res)

### [edit] opposite

    float opposite(string attr,color res)
    float opposite(string attr,float res)
    float opposite(string attr,matrix res)
    float opposite(string attr,normal res)
    float opposite(string attr,point res)
    float opposite(string attr,string res)
    float opposite(string attr,vector res)

### [edit] rendererinfo

    float rendererinfo(string attr,color res)
    float rendererinfo(string attr,float res)
    float rendererinfo(string attr,matrix res)
    float rendererinfo(string attr,normal res)
    float rendererinfo(string attr,point res)
    float rendererinfo(string attr,string res)
    float rendererinfo(string attr,vector res)

### [edit] surface

    float surface(string attr,color res)
    float surface(string attr,float res)
    float surface(string attr,matrix res)
    float surface(string attr,normal res)
    float surface(string attr,point res)
    float surface(string attr,string res)
    float surface(string attr,vector res)

### [edit] shadername

    string shadername()
    string shadername(string shaderType)

## [edit] Baking & 3D Textures

### [edit] bake3d

    bake3d(string filename,string channels,point P,normal N,...,<data>)

Bakes the specified data, which exists at point positions specified by `P` and normal `N` to the named pointcloud file. One channel should be given for each channel specified in the channel specifier string `channels` in the form `"channelname",variable`.

See Documentation/Baking 3D Textures.

### [edit] texture3d

    float texture3d(string filename, point p, normal n,...,<data>)

Reads the specified point cloud or brickmap, and returns the data associated with point `P` and normal `N`.

See Documentation/Baking 3D Textures.

## [edit] Shading

### [edit] area

    float area(point P)
    float area(point P,string measure)

Returns the area of each micropolygon, using the point P as the point whose areas to measure. The second form of the `area` function takes an additional `measure` argument which can be one of `"shading"` or `"dicing"`. If the measure is `"shading"` then the area shadeop works the same as the first version of the function. That is, the smooth derivatives version of the area is returned. If the measure is `"dicing"` then the non-smooth area is returned, which is exactly the area formed by the edge lengths of the grid for the point P.

### [edit] checkers

    float checkers()

Produces a checkerboard pattern in the shading grid, alternate vertices recieve 1 or 0. Used for debugging.

### [edit] calculatenormal

    point calculatenormal(point)

### [edit] depth

    float depth(point p)

Returns the depth of the point p - this matches the depth that would appear in a shadow map for the point p.

FIXME: we should convert to world space

### [edit] faceforward

    vector faceforward(vector N,vector I)
    vector faceforward(vector N,vector I,vector NRef)

Returns a vector such that I points the 'same' way as the normal N. The first form is equivalent to:

    vector faceforward( vector N, vector I) {
    	vector Nres;
    	if (N.Ng > 0) {
    		if (I.Ng > 0) 	Nres = -N;
    		else  		Nres = N;
    	} else {
    		if (I.Ng > 0) 	Nres = N;
    		else  		Nres = -N;
    	}
    	return Nres;
    }

And the second

    vector faceforward( vector N, vector I, vector Nref) {
    	vector Nres;
    	if (N.Nref > 0) {
    		if (I.Nref > 0)	Nres = -N;
    		else  		Nres = N;
    	} else {
    		if (I.Nref > 0)	Nres = N;
    		else  		Nres = -N;
    	}
    	return Nres;
    }

### [edit] filterstep

    float filterstep(float s,float....)
    float filterstep(float s1,float s2,float....)

Produces an antialiased step function. In the first form, the step function is filtered over the area of the current shading element. The second form is filtered inbetween `s1` and `s2`. The optional arguments may also include

`"width"` | a filter area multiplier to allow over or under filtering
`"filter"` | the filter type to use, which may be one of `"gaussian","box","triangle","sinc","catmull-rom","blackman-harris","mitchell"`

### [edit] smoothstep

    float smoothstep(float min, float max, float value)

Produces a smooth s-curve when `value` is between `min` and `max`. If `value` is below `min` 0 is returned, and 1 is returned if `value` is above `max`.

### [edit] step

    float step(float min, float value)

Produces a sharp step at `value=min`. If `value` is below `min` 0 is returned, 1 is returned otherwise.

### [edit] fresnel

    fresnel(vector I,vector n,float eta,output float Kr,output float Kt)
    fresnel(vector I,vector n,float eta,output float Kr,output float Kt,vector R,vector T)

### [edit] reflect

    vector reflect(vector I,vector N)

Returns `I` reflected about the normal `N`. Equivalent to:

    reflect(vector I,vector N) {
    	return I-2*(N.I)*N;
    }

### [edit] refract

    vector refract(vector I,vector N,float eta)

Returns the refracted vector given the incident vector `I`, the normal `N` and the index of refraction `eta`. The value eta should be index of refraction (of the surface to be entered) in the volume containing the ray `I`.

    vector refract( vector I, vector N; float eta ) {
    	float IdotN = I.N;
    	float k = 1 - eta*eta*(1 - IdotN*IdotN);

    	return k < 0 ? 0 : eta*I - (eta*IdotN + sqrt(k))*N;
    }

## [edit] Noise & Random

### [edit] cellnoise

    float|color|point|normal|vector cellnoise(float x)
    float|color|point|normal|vector cellnoise(float x, float y)
    float|color|point|normal|vector cellnoise(point p)
    float|color|point|normal|vector cellnoise(point p, float t)

Returns a pseudorandom result, which depends on the arguments - which can be 1,2,3 or 4 dimentional. The result is constant inbetween integer boundaries of each argument dimention. The result is uniformly distributed between 0 and 1, and can be used to construct vornoi noise or cell structure.

### [edit] urandom

    color|float|normal|point|vector urandom()
    color|float|normal|point|vector random()

Returns a uniformly distributed random number between 0 and 1.

### [edit] noise

    float|color|point|normal|vector noise(float x)
    float|color|point|normal|vector noise(float x, float y)
    float|color|point|normal|vector noise(point p)
    float|color|point|normal|vector noise(point p, float t)

Returns a pseudorandom function of it's arguments which can be 1,2,3 or 4 dimentional. The result is distributed between 0 and 1.

### [edit] pnoise

    float|color|point|normal|vector pnoise(float x,float period)
    float|color|point|normal|vector pnoise(float x, float y, float xperiod, float yperiod)
    float|color|point|normal|vector pnoise(point p, point period)
    float|color|point|normal|vector pnoise(point p, float t, point period, float tperiod)

Produces periodic pseudorandom noise in 1,2,3 or 4 dimentions, with the specified periods. The period must have integer values.

## [edit] String functions

### [edit] concat

    string concat(string s1, string s2...)

Concatenates all the string arguments and returns them.

### [edit] match

    float match(string pat, string val)

### [edit] format

    string format(string format,....)

Much like printf, `format` returns a string which is the result of applying format to the arguments. See printf.

### [edit] printf

    printf(string format,...)

Printf prints the string, plus format specified by `format` to the console. Certain strings in `format` are treated specially, and may require additional arguments to passed to `printf`

`%f`
  prints a float value, which must be specified
`%d`
  prints an integer value, which must be specified
`%c`
  prints a color value, which must be specified
`%n`
  prints a normal value, which must be specified
`%v`
  prints a vector value, which must be specified
`%s`
  prints a string value, which must be specified
`%m`
  prints a matrix value, which must be specified
`%%`
  prints %
`\n`
  prints a newline
`\t`
  prints a tab character

## [edit] Texturing

The texturing functions (`texture`, `environment` and `shadow` all take optional arguments, which are described below:

`"filter"` | Specifies the filter type to be used. Can be one of FIXME
`"blur"` | Specifies the blurring of the texture call. Blurring of 1 means samples can cover the whole texture, 0 is perfectly sharp.
`"width"` | specifies the filterwidth multiplier for s and t
`"swidth"` | specifies the filterwidth multiplier in s
`"twidth"` | specifies the filterwidth multiplier in t
`"fill"` | the value to use for channels not present in the texture
`"samples"` | how many samples to take for antialisaing and smooth blur purposes
`"bias"` | the sample bias for shadows
`"maxdist"` | the maximum distance to shoot rays if the texurename is `"raytrace"`
`"samplecone"` | the angle in radians to shoot rays if the texturename is `"raytrace"`
`"label"` | the ray label if the texturename is `"raytrace"`

### [edit] environment

    color environment(string environmentname,vector R,...)
    float environment(string environmentname,vector R,...)

### [edit] texture

    color texture(string tex....)
    color texture(string tex,float s,float t,...)
    color texture(string tex,float s1,float t1,float s2,float t2,float s3,float t3,float s4,float t4,...)

    float texture(string tex....)
    float texture(string tex,float s,float t,...)
    float texture(string tex,float s1,float t1,float s2,float t2,float s3,float t3,float s4,float t4,...)

### [edit] textureinfo

    float textureinfo(string texname,string property,color res)
    float textureinfo(string texname,string property,float res)
    float textureinfo(string texname,string property,matrix res)
    float textureinfo(string texname,string property,normal res)
    float textureinfo(string texname,string property,point res)
    float textureinfo(string texname,string property,string res)
    float textureinfo(string texname,string property,vector res)

### [edit] shadow

    color shadow(string shdname,point pos,...)
    float shadow(string shdname,point pos,...)

## [edit] transformations

### [edit] rotate

    matrix rotate(matrix m,float angle,vector axis)
    point rotate(point p,float angle,point p1,point p2)

The second form rotates point `p` by `angle` in radians, about the axis that runs through points `p1` and `p2`. The first form returns a matrix which results from concatenating the rotation specified by `angle` and `axis` onto the first matrix argument.

### [edit] transform

    point transform(string fromspace,string tospace,point p)
    point transform(string fromspace,matrix m,point p)
    point transform(string tospace,point p)
    point transform(matrix m,point p)

Transforms the point `p` to another named coordinate space. If `fromspace` is not specified, it is assumed to be `"current"`.

### [edit] translate

    matrix translate(matrix m,point p)

Returns a matrix which results from concatenating the translation specified by `p` onto the first matrix argument.

### [edit] vtransform

    point vtransform(string fromspace,string tospace,point p)
    point vtransform(string fromspace,matrix m,point p)
    point vtransform(string tospace,point p)
    point vtransform(matrix m,point p)

Transforms the vector `v` to another named coordinate space. If `fromspace` is not specified, it is assumed to be `"current"`.

### [edit] scale

    matrix scale(matrix m,point p)

Returns a matrix which results from concatenating the scaling specified by `p` onto the first matrix argument.

### [edit] ntransform

    point ntransform(string fromspace,string tospace,point p)
    point ntransform(string fromspace,matrix m,point p)
    point ntransform(string tospace,point p)
    point ntransform(matrix m,point p)

Transforms the normal `v` to another named coordinate space. If `fromspace` is not specified, it is assumed to be `"current"`.

### [edit] ctransform

    color ctransform(string fromspace,string tospace,color c)
    color ctransform(string tospace,color c)

Transforms a color from one colorspace to another. If `fromspace` is not given, it is assumed to be `"rgb"`. The space may be one of `"rgb","hsl","hsv","xyz","yiq","xyy","cie"`.

## [edit] raytracing

### [edit] gather

    gather([string category],point p,vector dir,float angle,float samples,...) {
    	// statements
    }
    [ else {
    	// statements
    } ]

Fires rays in a cone with apex at point `p` defined by the direction `dir` and the angular spread `angle`. The number of rays per shading point is controlled by `samples`.

`uniform float bias` | The self intersection bias.
`uniform float samplecone` | Specifies the directional coherence of the rays (in radians)
`uniform float blur` | Alternate way to specify the sample cone (1 is full hemisphere blur)
`uniform float maxdist` | The maximum intersection distance
`uniform string distribution` | The sample distribution (`"cosine"` or `"uniform"`)
`uniform string label` | The ray label
`float samplebase` | Jitter the ray origin (1 by default)
`varying type shadertype:variablename` | The query value (output)
`varying float ray:length` | Length of the ray (output)
`varying vector ray:direction` | The ray direction (output)

See Documentation/Raytracing in SL#gather

### [edit] trace

    color trace(point p, vector dir,...)
    float trace(point p, vector dir,...)

See Documentation/Raytracing_in_SL#trace

### [edit] transmission

    color transmission(point p1,point p2,...)

Documentation/Raytracing_in_SL#transmission

### [edit] visibility

    float visibility(point p1,point p2)

Documentation/Raytracing_in_SL#visibility

### [edit] raydepth

    float raydepth()

Returns the depth of the current ray, which is 0 for camera rays, and increases by one at each level of shading when a ray is fired.

### [edit] rayinfo

    float rayinfo(string infotype, output float res)
    float rayinfo(string infotype, output string res)

See Documentation/Raytracing in SL#rayinfo

### [edit] raylabel

    string raylabel()

Returns the current ray label, which may be none (`""`)
Retrieved from "http://www.george-graphics.co.uk/pixiewiki/Documentation/SL_Functions"

Category: Documentation

##### Views

- Article
- Discussion
- Edit
- History

##### Personal tools

- Log in / create account

##### Search

##### Toolbox

- What links here
- Related changes
- Upload file
- Special pages
- Printable version
- Permanent link