Shader Data Type
 
 
 

Declaration:

shader <name> ( procedure=<procedure name>, <component list> ) ;

Reference:

<name>

Purpose:

This defines a shader. A shader may only be specified as a variable, thus a name is always required. Any of the following components may be specified between the parentheses. Please note that particle system components are described in the section following the Light Data Type.

Comments:

All components are specified using a keyword=value form. Components are separated by commas. Not all components are optional. The components may be specified in any order. Components that are not specified take on their default value. If any component is specified more than once, the last such specification will be used, and all previous ones ignored. If all are omitted, the defaults will result in a shader with the same properties as the interactive package default shader. Not all components are meaningful in all combinations. In situations where a component is not meaningful, any specification of it will be ignored with no ill effect.

Note that shaders cannot be used as literals.

Example:

shader arrow ( model     = phong,
			specular = (0.853881, 0.853881, 0.853881),
			shinyness = 23.0,
			color = (255.0, 0.0, 33.0)
			);

bump

Syntax:

bump = texture <texture>

Range:

Not meaningful.

Default:

none.

Purpose:

The surface normal is perturbed according to the value given by the texture. Bump mapping makes a surface appear bumpy or rough by affecting the surface normal at a point and not by moving the actual surface. Therefore, the silhouette of the object will appear the same as it did before the bump map was applied. The scale of bumps is set by the amult and aoffset statements.

Comments:

This component may be animated. bump is appropriate for all shading models.

Example:

bump = noisy

color

Syntax:

color = <triple>

or

color = texture <texture>

Range:

Each component of a triple must be in the range 0 to 255.

Default:

( 0.0, 150.0, 255.0 )

Purpose:

If color = <triple>, the three components of the triple are the red, green and blue aspects of the color. If color = texture <texture>, then the texture is mapped onto the surface. A color is appropriate for all shading models. For more information on textures, see Texture Data Type.

Comments:

This component may be animated. Note that the default has been changed to agree with the interactive package.

Example:

color = (255.0, 0.0, 33.0)

diffuse

Syntax:

diffuse = <scalar>

Range:

Not checked; useful range is 0.0 to 1.0. While 0.0 to 1.0 provides a realistic range, numbers greater than 1 can be used: the effect is that more illumination is scattered by the object than was received by it.

Default:

0.8

Purpose:

The scalar determines the amount of illumination reflected by a matte surface, affecting the surface’s brightness. A high diffuse setting produces a broad range of shade on the object. A setting of 0.0 produces virtually no response to lights, while 1.0 produces very abrupt changes in shading, as found on acrylic or Plexiglass.

A diffuse component is appropriate for the lambert, phong, and blinn shading models. It is ignored for the lightsource model.

Comments:

This component may be animated.

Example:

diffuse = 0.99

displacement

Syntax:

displacement = texture <texture>

Range:

Not meaningful.

Default:

none.

Purpose:

The rendered surface is displaced along the surface normal according to the value given by the texture. With displacement maps, the silhouette is consistent with the rest of the surface, unlike bump maps.

Comments:

This component may be animated. displacement is appropriate for all shading models.

Example:

displacement = noisy

eccentricity

Syntax:

eccentricity = <scalar>

Range:

Any value other than 1.0

Default:

0.3

Purpose:

This is used only with the blinn shading model. It sets the size of the object’s highlight in a manner similar to the shinyness statement. This value controls the variance in the angle of the microfacets of the surface.

The eccentricity component should be specified for the blinn shading model. An eccentricity value of 0.0 is acceptable.

Comments:

This component may be animated.

Example:

eccentricity = 0.75

fill_color

Syntax:

fill_color= <triple>

Range:

Each component of a triple must be in the range 0 to 255.

Default:

(255, 255, 255)

Purpose:

Fill_color is only relevant in hidden-line rendering, and when use_fill_color is turned on. The fill color defines the interior color of the surface not covered by the outline of the surface.

Example:

fill_color= (255, 255, 255)

glow_intensity

Syntax:

glow_intensity = <scalar>

Range:

Non-negative

Default:

0.0

Purpose:

This simulates the effect when light intensity exceeds the range of the recording medium (for example film or a retina) causing light to bleed across the medium. Do to the limited contrast range of video and even film. it is impossible for something to appear very bright if it does not have a glowing halo. The glow fools our eyes into believing that the light is brighter than it really is.

Comments:

The glow intensity scales the intensity of a shaded pixel before it is passed into the post process glow pass. This intensity can not be greater than (255,255,255). For very bright glows, the glow and halo color parameters in the ENVIRONMENT Section should be set high. Note that most of the parameters controlling shader glow are on the Environment. Components of shading (such as specular highlights or texture mapped dots) can be made to glow by using the threshold parameter on the Environment.

This component may be animated.

Example:

glow_intensity = .5

glow_rotation

Syntax:

glow_rotation = <scalar> (in degrees)

Range:

-infinity to infinity

Default:

0.0

Purpose:

To rotate the various glow and fog noise and star effects about the location of the shader.

Comments:

Affects glow_star_level, and glow_radial_noise.

Example:

glow_rotation = 45.0

hide_glow_source

Syntax:

hide_glow_source= <boolean>

Range:

ON or OFF.

Default:

OFF

Purpose:

This allows an object to be used as a source of glow without the object appearing in the final render: if this is ON then only the glow effect itself will appear. This is very useful when creating glowing gas like effects.

Comments:

If the glow_intensity is zero, hide_glow_source has no effect.

This component may be animated.

Example:

hide_glow_source = ON

incandescence

Syntax:

incandescence = <triple>

or

incandescence = texture <texture>

Range:

Each component of the triple must be in the range 0 to 255.

Default:

( 0.0, 0.0, 0.0 )

Purpose:

incandescence can be used for surfaces that appear to radiate energy, such as light bulbs and fire, and in moderate amounts for foliage. The value of incandescence is added to the color of the model. The effect is as if the model were glowing or radiating energy. incandescence is appropriate for all shading models.

Comments:

This component may be animated.

Example:

incandescence = (255.0, 0.0, 33.0)

matte_fraction

Syntax:

matte_fraction = <float>

Range:

0 to 1.

Default:

0.0

Purpose:

matte_fraction is only relevant when mask files are written during rendering. For each alpha value, (1-matte_fraction) is multiplied to it to arrive at the actual alpha value written to file. This allows for opaque objects to not register an alpha, or allow an object (after compositing) to slowly become visible as you animate the matte_fraction from 1 to 0.

Comments:

This component may be animated.

Example:

matte_fraction = 0.0

model

Syntax:

Either : model = blinn

or: model = lambert

or: model = lightsource

or: model = phong

Range:

As enumerated above.

Default:

lambert

Purpose:

Sets the shading model used for rendering. The models are listed below in the order of their increasing sophistication and time required to render.

lightsource This is a simple model that only uses the color of the shader, and the color and intensity of all lights illuminating it. It is independent of the camera position and the light positions.Therefore it is appropriate when creating surfaces that should look uniform. Note, however, that it only makes such surfaces appear luminous; they do not, in fact, illuminate anything. If the lightsource shading model is selected, then the rendered color will be the same as the shader color. There is no shading, and lights are ignored.
lambert In this model, matte shading is produced by only using the color and diffusecomponents (to follow). The light positions are used, but not the camera’s position.
phong This model produces shading with highlights. It uses the color, diffuse, shinyness and specular components (to follow). The contribution of each light depends on its position, the surface’s orientation, and the eye’s position.
blinn This model produces shading with larger highlights than those occurring in the phong model, especially when illumination strikes the surface at a grazing angle. This also produces soft highlights that tend to be more realistic than the phong model. It uses the color, diffuse, specular, eccentricity and refractive_index components (to follow).

Comments:

This component may not be animated.

Example:

model = phong

opacity_depth

Syntax:

opacity_depth = <scalar>

Range:

Any floating point number.

Default:

0.0

Purpose:

Opacity depth causes transparency of an object to diminish with the thickness of an object. This is useful when creating hair, fur, and cloud effects. Objects will be fully opaque where their depth is greater than the opacity_depth. Note that when the opacity depth is zero, it has no effect (as opposed to making an object always opaque).

Comments:

The shader must have some transparency to view this effect. When opacity_depth is non-zero then transparency will modulate specularity, reflectivity, and incandescence, which are normally independent of transparency. This makes it easier to create soft fuzzy objects. Also, if you want to transparency map holes in a surface that has specular highlights, set the opacity_depth to a high value, instead of creating a matching specular map.

Transparent objects will cast shadows in the raycaster if their opacity depth is non-zero.

Example:

opacity_depth = 0.2

reflect_background

Syntax:

reflect_background = <scalar>

Range:

0 (OFF) or not 0 (ON).

Default:

OFF.

Purpose:

If the background has an environment map, then reflect_background = ON will reflect this environment.

Comments:

reflect_background overrides reflection mapping on the shader. It also overrides reflected rays in the RayTracer.

Example:

reflect_background = ON

reflection

Syntax:

reflection = texture <texture>

Range:

Not meaningful.

Default:

None (no reflection).

Purpose:

This provides a environment map for the current shader.

Comments:

This component may be animated. A reflection is appropriate for phong and blinn shading models.

Example:

reflection = room

reflection_limit

Syntax:

reflection_limit = <scalar>

Range:

Non-negative. If a negative number is given, zero will be used.

Default:

1

Purpose:

Ray tracing is a recursive process. Each ray bounces off of reflective objects. If the user places two reflective objects parallel to each other and places the eye point between them, then it is easy to imagine a ray bouncing back and forth between these mirrors forever. This is undesirable. The user can control the number of bounces a ray may take on a per shader basis with the reflection_limit component.

Comments:

This component may be animated.

Example:

reflection_limit = 0

Let us assume that an object uses a shader with this component. During the ray tracing process, a primary ray (which has a level of 0 by definition) hits this object. The reflectivity is calculated, and we prepare to trace a ray in the reflected direction. The reflection_limit is compared against the level of the incident ray. The reflected ray will be traced only if the reflection_limit is greater than the incident ray’s level. For the example this is false; the incident ray’s level is 0 and the reflection_limit is also 0. Therefore, no reflected ray is traced.

reflectivity

Syntax:

reflectivity = <scalar>

or

reflectivity = texture <texture>

Range:

unbounded, but meaningful range is 0.0 to 1.0

Default:

1.0

Purpose:

This scale factor is multiplied by the value produced by a reflection map. It allows the user to control the reflection map’s contribution to the final value of the shader. It is ignored if there is no reflection.

The reflectivity component is appropriate for the phong and blinn shading models. It is ignored for lightsource and lambert models. Also note that the reflection will be multiplied by specular, just like a highlight.

Comments:

This component may be animated.

Example:

reflectivity = 0.9

refraction_jitter

Syntax:

refraction_jitter= <scalar>

Range:

Between 0 and 1.

Default:

0

Purpose:

Refraction_jitter is valid for raytracing of transparent surfaces only. It jitters the refraction index for refraction rays. This can produce effects such as frosted glass. However, note that aliasing artifacts may arise when not enough refraction_samples are taken.

Example:

refraction_jitter= 0.1

refraction_limit

Syntax:

refraction_limit = <scalar>

Range:

Non-negative. If a negative number is given, zero will be used.

Default:

1

Purpose:

This controls the propagation of refracted rays through transparent objects. It is similar in intent and behavior to reflection_limit, but for refracted rays. It is only appropriate for RayTracing, and is ignored for all other modes of rendering.

Comments:

This component may be animated.

Example:

refraction_limit = 3

refraction_samples

Syntax:

refraction_samples= <scalar>

Range:

Any value greater than 1.

Default:

0

Purpose:

Refraction_samples defines the number of refraction rays to shoot when transparent surfaces are hit in ray tracing. This can achieve the effect of fuzzy refractions, and will also anti-alias refraction_jitter artifacts. Note that with a larger value specified for this parameter, the longer the ray tracing time.

Example:

refraction_samples= 1.1

refractive_index

Syntax:

refractive_index = <scalar>

Range:

Must be greater than 0.0; no maximum, but practical limit is 3.0.

Default:

1.3

Purpose:

This controls the angles of refracted rays through transparent objects. It is only appropriate for RayTracing, and is ignored for all other modes of rendering.

Example:

refractive_index = 3,

respect_reflection_map

Syntax:

respect_reflection_map = <scalar>

Range:

0 (FALSE) or not 0 (TRUE)

Default:

TRUE

Purpose:

This controls the use of a reflection map. RayTracing will reflect the environment of an object without having to create a cubic or spherical reflection map (see Creating Rendered Cubic Environment Maps for more information on creating cubic reflection maps). There are times, however, that a user may want to use a reflection map rather than trace the reflected rays. For example, reflective pillars behind a complex car model are required to reflect the image of the car. RayTracing the reflections is expensive because of the sheer volume of geometry describing the car. Since the pillars are not the main focus of the rendering, the reflections on the pillars need not be all that accurate. Therefore, a reflection map may be used for the pillars with little quality degradation. Setting respect_reflection_map to TRUE will accomplish that. If this component is true, no reflection rays will be generated and any reflection map will applied. If respect_reflection_map is false and the rendering mode is raytrace, any reflection map will be ignored and reflection rays generated up to the relevant recursion limit. Note that this is only appropriate when RayTracing. Reflection maps are always applied when RayCasting.

Comments:

This component may be animated.

Example:

respect_reflection_map = FALSE

shading_map

Syntax:

shading_map= <triple>

or

shading_map= texture <texture>

Range:

Each component of a triple must be in the range 0 to 255.

Default:

( 0.0, 0.0, 0.0 )

Purpose:

If color = <triple>, the three components of the triple are the red, green and blue aspects of the color. If shading_map= texture <texture>, then u value of the texture is mapped to the shader’s hue, and the v value is mapped to the shader’s intensity. A color is appropriate for all shading models.

Comments:

This component may be animated. Note that the default has been changed to agree with the interactive package.

Example:

shading_map= (255.0, 0.0, 33.0)

shadow_level_limit

Syntax:

shadow_level_limit = <scalar>

Range:

-1 to infinity

Default:

1

Purpose:

This controls the propagation of shadow rays. It is similar in intent and behavior to reflection_limit, but for shadow rays. Shadow rays are generated towards all light sources with shadow = TRUE. Shadow rays are defined to be of the same level as the incident ray. Therefore, setting shadow_level_limit = 1; will cause shadow rays to be traced from intersections generated by level 0 or level 1 rays. If a level 2 (or higher) ray strikes a object, no shadow rays will be traced, and the lighting will be calculated directly without shadowing. The shadow_level_limit component is only appropriate for RayTracing, and is ignored for all other modes of rendering.

Comments:

This component may be animated.

Example:

shadow_level_limit = 20

shinyness

Syntax:

shinyness = <scalar>

Range:

Must be greater than zero. Useful range is 2.0 to 200.0

Default:

20.0

Purpose:

This is used only with the phong shading model. The scalar determines the size of an object’s spot of reflection. The higher the value of the shinyness component, the smoother the surface looks. A shinyness component should be specified for the phong model.

Comments:

This component may be animated.

Example:

shinyness = 8

specular

Syntax:

specular = <triple>

or

specular = texture <texture>

Range:

Not checked; useful range is 0.0 to 1.0 for each of red, green and blue.

Default:

( 0.0, 0.0, 0.0 )

Purpose:

If specular = texture <texture>, the highlights across a surface can be made to vary. This requires a 24-bit map. If an 8-bit map is specified, a 24-bit greyscale map will be generated on the fly. You might use a texture here for such optical effects as gas on water or other iridescent effects. The triple is used as a multiplying factor for the red, green and blue aspects of the specular highlight. The multiplying factor affects the hue and the hotness or brightness of the specular highlight.

A specular component is appropriate for the phong and blinn shading models. It is ignored for lightsource and lambert models.

Comments:

This component may be animated. Note that the specular component affects reflected images (reflection maps) as well as highlights.

Example:

specular = (0.3, 0.4, 0.5)

specular_rolloff

Syntax:

specular_rolloff = <scalar>

Range:

Not checked; useful range is 0.0 to 1.0; absolute range is -infinity to infinity.

Default:

0.3

Purpose:

Controls the effect where some surfaces are more reflective at oblique angles. specular_rolloff has a range of 0.000 through 1.000. Rolloff values around 0.700 will create a “wet” look on a surface. specular_rolloff is only applicable to blinn model surfaces.

Also affects reflected rays in reflection maps.

Example:

specular_rolloff = 0.3,

split_velocity_min

Syntax:

split_velocity_min = <scalar>

Range:

0 to infinity

Default:

5

Purpose:

Appears only if psys_collisions are set to ON. This provides a limit on the speed a particle must be moving when it collides with an object to determine if the particle splits.

Example:

split_velocity_min = 5

surface_width

Syntax:

surface_width= <scalar>

Range:

Any value greater than 0.

Default:

0.0

Purpose:

Surface_width is only relevant in RayTracing for transparent surfaces. When the value is set to 0, the transparent surface is considered to be a solid. Thus refraction rays bend through this new medium in the interior of the surface. If a non-zero surface_width is specified, then the surface is not considered a solid, but rather the refraction rays bend through this new medium only for this surface width.

This is a fast method using RayTracing. Artifacts may appear if unreasonable surface_width values are specified (that is, the surface width is actually larger than the surface itself).

Example:

surface_width= 0.3,

translucence

Syntax:

translucence = <scalar>

Range:

Any floating point number.

Default:

0.0

Purpose:

This simulates the way light diffusely penetrates through translucent objects. It is very useful for a wide range of materials: clouds, fur, hair, marble, jade, wax, paper, leaves, petals, frosted light bulbs. The translucence_depth determines the distanced light will penetrate into the object. If the translucence depth is greater than zero, then light can shine on surfaces that face away from the lightsource. For example, a spotlight with a texture map could act like a rear projector lighting up a translucent screen from behind. If the light casts shadows, then the translucence depth will determine how far the light can penetrate into the object.

Objects like fur and hair benefit greatly by shading the translucency and very little diffuse illumination. The effect is that small scale surface bumps and tufts have very soft shading as light readily passes through, while large scale features (like the back of the object, as opposed to the front) get full shadows and highlights. This effect is almost impossible to achieve without translucence.

Comments:

Note that for lights without shadowing, the translucence_depth is effectively zero or infinite (all non-zero values). For raycast shadows, a faint gridlike artifact is sometimes visible. Usually this can be fixed by increasing the shadow quality or lowering the shadow resolution.

Generally it is useful to lower the diffuse intensity value when the translucence is high, to avoid washout.

The translucence calculation is based on illumination from lights, and has nothing to do with an object’s transparency; however, as an object becomes more transparent, the translucent (as well as diffuse) illumination gets dimmer.

Ambient lights have no effect on translucent (or diffuse) illumination.

This parameter may be animated.

Example:

translucence = 0.5

translucence_depth

Syntax:

translucence_depth = <scalar>

Range:

Any floating point number.

Default:

0.5

Purpose:

This determines how far light can translucently penetrate through an object.

See translucence for more information.

Comments:

Note that for lights without shadowing the translucence_depth is effectively zero or infinite (all non-zero values). In the raycaster, for very shallow depths (for example, 0.1) the spotlight parameter shadow_min_depth should be small (0.01) and the shadow_blend_offset should also be small (0.2).

This parameter may be animated.

Example:

translucence_depth = 0.2

transparency

Syntax:

transparency = <triple>

or

transparency = texture <texture>

Range:

0 to 255

Default:

0,0,0

Purpose:

Transparency is a three channel value. Any color can be specified as the transparency of a shader, white (255,255,255) being totally transparent and black (0,0,0) being totally opaque. Colors are filtered as you would expect; a white object behind a green transparent object will appear green (the red and blue having been filtered out), or a red object behind a blue transparent object will appear black.

If transparency is assigned a texture, the transparency across a surface can range from opaque to transparent depending on the value of the texture at any point. If an 8 bit map is specified, the value of the map is repeated to make a color value; a value of 35 in the 8 bit map will become (35, 35, 35).

Note that highlights and reflections on very transparent objects will not be washed away. Transparency is appropriate for all shading models.

Comments:

This component may be animated.

Example:

transparency = (255, 255, 255)

transparency_shade

Syntax:

transparency_shade = <scalar>

Range:

0 to 1. If a number smaller than 0 is used, transparency_shade is forced to 0; for numbers greater than 1, transparency_shade is forced to 1.

Default:

0

Purpose:

Light is not equally shadowed when it passes through a transparent object: it is focused, creating illumination that is brighter at some points and darker at others. To produce this effect properly requires a special ray trace from the point of view of the light source, and it is expensive. In order to approximate this type of effect cheaply, we use a technique similar to the ambient light model. That is, light which passes nearly tangentially through a transparent object will be attenuated more than light passing nearly perpendicularly through it. This is controlled in the same manner as the ambience component of an ambient light, but as part of the shader which is applied to the object.

Comments:

This component may be animated.

Example:

transparency_shade = 0

This results in a constant attenuation of the light through the object. With the default setting, planar transparent objects will cast a nearly uniform shadow unless a light source is close to the object.

u_patch_lines

Syntax:

u_patch_lines= <scalar>

Range:

Any value greater than 0.

Default:

0

Purpose:

U_patch_lines is only relevant in hidden-line rendering. By default, only the outline of the surface is drawn in hidden-line rendering (that is when u_patch_lines = 0). However, it is possible to get a gridded look of the outline, in which a number of lines per isoparm can be drawn through the u-direction of the surface. This number is the setting for u_patch_lines.

Because the gridded lines are drawn according to the uv-parameterization of the surface, it can warp undesirably. If such a case occurs, the best solution would be turn chord_length on in the texture definition.

Example:

u_patch_lines = 0

use_background_color

Syntax:

use_background_color = <scalar>

Range:

0 (OFF) to 1 (ON). If a number smaller than 0 is used, use_background_color is forced to 0; for numbers greater than 1, use_background_color is forced to 1.

Default:

0

Purpose:

For use_background_color, the color value for the shader is derived from the background. This may be used to apply shading to the background image or texture. Shadow and reflection catcher surfaces can be created with this method. use_background_color overrides the shader color or color map value.

Example:

use_background_color = 0

use_fill_color

Syntax:

use_fill_color= <scalar>

Range:

0 (OFF) to 1 (ON). If a number smaller than 0 is used, use_fill_color is forced to 0; for numbers greater than 1, use_fill_color is forced to 1.

Default:

0

Purpose:

Use_fill_color is only relevant to hidden-line rendering. When turned off, only the outline of the objects are drawn in hidden-line rendering. When turned on, the interior of the surface is filled in with the color as specified by fill_color.

It must also be noted that when use_fill_color is turned off, the mask generated only shows the existence of the outline. When turned on, then the entire object’s mask value are assumed to be opaque.

Example:

use_fill_color = 0

v_patch_lines

Syntax:

v_patch_lines= <scalar>

Range:

Any value greater than 0.

Default:

0

Purpose:

V_patch_lines is only relevant in hidden-line rendering. By default, only the outline of the surface is drawn in hidden-line rendering (that is when v_patch_lines = 0). However, it is possible to get a gridded look of the outline, in which a number of lines per isoparm can be drawn through the v-direction of the surface. This number is the setting for v_patch_lines.

Because the gridded lines are drawn according to the uv-parameterization of the surface, it can warp undesirably. If such a case occurs, the best solution would be turn chord_length on in the texture definition.

Example:

v_patch_lines = 0