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.
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.
shader arrow ( model = phong,
specular = (0.853881, 0.853881, 0.853881),
shinyness = 23.0,
color = (255.0, 0.0, 33.0)
);
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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). |
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).
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.
If the background has an environment map, then reflect_background = ON will reflect this environment.
This component may be animated. A reflection is appropriate for phong and blinn shading models.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
This determines how far light can translucently penetrate through an object.
See translucence for more information.
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.
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.
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.
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.
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.
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.
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.
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.
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.