air
The ``air'' shader mimics the behaviour of atmosphere. Volumes of modeled air can be given a realistic appearance by using this shader. The shader performs basic Beer's Law extinction and contrast reduction. It should be applied only on regions where the air code has been set to a non-zero value. See edcodes for information about setting the air flag on the region).

The ``air'' shader assumes that the volume is a homogeneous volume of non-turbulent air. The shader provides crude modeling of absorption and scattering effects in the atmosphere. Absorption and/or extinction effects are modeled by reducing the transmission of the air volume by an amount proportional to the distance traveled through the air.

Transmission = exp( - Tau )
Tau	= optical path depth
	= density_per_unit_distance * distance

Scattering effects are modeled by replacing the non-transmitted color energy with an ambient energy. Specifically, the color of the air region is used for the non-transmission portion. The result is that short paths through the air volume are relatively clear, whereas long paths become very muddied with the color of the air.

Parameters

ParameterAbbreviationDefault Value
dpm - 0.1

dpm
Density per meter. This parameter describes the optical density of the atmosphere per unit meter of distance.

Example

	mged> mater air.r air dpm=5000 180 180 220 0

emist
The ``emist'' shader is much like the air shader except that the density of the atmosphere varies exponentially as a function of altitude. Above a certain delta from the Z=0 plane, emist should be identical to ``air''. Below this level, density increases exponentially.

Parameters

ParameterAbbreviationDefault Value
dpm - 0.1
deltad0.0

dpm
Density per meter. This parameter describes the optical density of the atmosphere per unit meter of distance.
delta
This is the height (above the Z=0 plane) at which the fog starts to get exponentially denser. From this altitude downward density increases. By default this value is specified in millimeters, (regardless of the current MGED editing units). It is possible to specify values in other units by appending the units as a suffix to the value. For example: ``2ft''.

Examples

	mater swamp_gas.r emist "dpm=5000 delta=2ft" 180 180 220 0

marble
The "marble" shader simulates the color patterns present in some types of marble. This is a procedural shader based upon a fractal noise function known as turbulence.

The fractal noise function produces a pseudo- random number in the range [0.0 ... 1.0] from the 3-space coordinates of a point in the bounding volume of the region. This noise value is used to determine the ratio of two colors present as the final color of the object. The object color and a shader-specific color are combined. The color produced is a combination of

The fractal pattern has infinite resolution. As a result, the borders of the color splashes never become pixelated, no mater how close the eyepoint is to the surface.

ParameterAbbreviationDefault Value
Noise Parameters
lacunarityl2.1753974
HH1.0
octaveso4.0
sizes1.0
vscalev1.0/1.0/1.0
deltad1000/1000/1000
Shader Specific Parameters
color2c2250/100/100
Lacunarity
The grid on which the noise function is built is scaled by this value for each successive octave of noise which will be combined to produce the final result.
H
Octaves
The number of times the noise grid will be scaled and recombined to produce the final noise function
Size, Vscale
If size is set it is used as a scalar which defines the size of the noise grid on the object. So if t2=0.5 and size=5mm then splotches of color3 would tend to be no larger than 5-10mm. If non-uniform scaling is required, Vscale can specify the grid size in X, Y and Z.
Delta
This specifies a translation in noise space for the origin of region space. Since the origin of noise space is reflected 8 ways, it is undesirable to have that portion of noise space overlap with region space.

Examples

	mater column.r stack marble s=512;plastic 250 240 280 0

camo
The "camo" shader creates a pseudo-random tri-color camouflage pattern on the object using a fractal noise pattern. This is a procedural shader based upon a fractal noise function known as fractional brownian motion or fBm.

The fractal noise function produces a pseudo- random number in the range [-1.0 ... 1.0] from the 3-space coordinates of a point in the bounding volume of the region. This noise value is used to determine the color of the object at the given location.

Noise valueObject Color
nv < thresh1color1
nv < thresh1
and
nv < thresh2
color2
nv > thresh2color3

The fractal pattern has infinite resolution. As a result, the borders of the color splashes never become pixelated, no mater how close the eyepoint is to the surface.

Parameters

The parameters associated with the noise function are common to all shaders based upon the noise functions.

ParameterAbbreviationDefault Value
Noise Parameters
lacunarityl2.1753974
HH1.0
octaveso4.0
sizes1.0
vscalev1.0/1.0/1.0
deltad1000/1000/1000
Shader Specific Parameters
thresh1t1-0.25
thresh2t20.25
color1c197/74/41
color2c226/77/10
color3c338/38/38
Lacunarity
The grid on which the noise function is built is scaled by this value for each successive octave of noise which will be combined to produce the final result.
H
Octaves
The number of times the noise grid will be scaled and recombined to produce the final noise function
Size, Vscale
If size is set it is used as a scalar which defines the size of the noise grid on the object. So if t2=0.5 and size=5mm then splotches of color3 would tend to be no larger than 5-10mm. If non-uniform scaling is required, Vscale can specify the grid size in X, Y and Z.
Delta
This specifies a translation in noise space for the origin of region space. Since the origin of noise space is reflected 8 ways, it is undesirable to have that portion of noise space overlap with region space.

Examples

	mged> shader tent.r stack "camo ; plastic"

Limitations

Because of the continuous nature of the fractal noise space, it is impossible to get a splash of color1 directly adjacent to a splash of color3.


fire
The ``fire'' shader creates a space-filling semi-transparent color texture that resembles fire.

Parameters

ParameterAbbreviationDefault Value
Noise Parameters
lacunarityl2.1753974
HH1.0
octaveso4.0
sizes1.0
vscalev1.0/1.0/1.0
deltad1000/1000/1000
Shader Specific Parameters
flickerf0.0
stretchst0.0

flicker
Specifies rater of translation through noise space for animation. Animation frametime*flicker produces a delta of Z in noise space for the given frame/pixel. Useful values are probably in the range 0 .. 10.
stretch
Specifies a scaling of the exponential stretch of the flames. Flame stretch effect = exp(pos[Z] * - stretch)

Examples

	mged> mater air.r air dpm=5000 180 180 220 0

light
When light sources are explicitly modeled in the geometry description, they are given a shader type ``light''. The color of the region defines the color of the light.

Parameters

ParameterAbbreviationDefault Value
inten - 1000
angle - 180
fract - (computed)
aim - 0
shadows - 1
infinite - 0
invisible - 0

intensity
Intensity of the light source (nominally in lumens)
angle     
Beam dispersion angle (degrees 0..180)
fraction
Fraction of total light
shadows
Boolean: Does light cast shadows
infinite
Boolean: Is light source infinitely distant
aim     
Boolean: Take light aim direction from solid
invisible
Boolean: Is light source visible as an object

Example

	mged> shader lightbulb.r light

fbmbump
turbump
fbmcolor
turcolor
These shaders apply a noise function to the surface normal or the intensity of the surface color. The ``bump'' shaders apply either fBm or turbulence noise to the surface normal of the object. The ``color'' shaders apply either fBm or turbulence noise to the intensity of the surface color.

Parameters

ParameterAbbreviationDefault Value
Noise Parameters
lacunarityl2.1753974
HH1.0
octaveso4.0
sizes1.0
vscalev1.0/1.0/1.0
deltad1000/1000/1000
Shader Specific Parameters
anglea/ang1.0

angle
Maximum angle of the surface normal deviation.

Example

	mged> shader air.r proto

plastic
mirror
glass
These are really all just the Phong shader ``plastic''. The ``mirror'' and ``glass'' shaders simply set different defaults.

Parameters

ParameterAbbreviationDefault Value
plasticmirrorglass
shinesh1044
specularsp0.70.60.7
diffusedi0.30.40.3
transmittr0.00.00.8
reflectre0.00.750.1
ri-1.01.651.65
extinctionex0.000

shine
Describes the shininess of the object [4..20] where 4 is a very highly polished surface, and 20 defines a very rough surface
specular
Defines the amount of energy due to directional reflection of energy (e.g. due to light sources in the scene)
diffuse
Defines the portion of energy due to diffuse (non directional) surface reflection, e.g. due to ambient illumination
transmit
Defines the portion of light [0..1] due to energy transmitted through the object
reflect
Defines the portion of light [0..1] due to reflected energy
ri
Sets the refractive index
extinction
Set but not used

Example

	mged> shader air.r proto

points
Phil Dykstra's points shader

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

scloud
Lee's ``Solid Clouds''

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

cloud
Geoffrey Gardner style 2D cloud texture

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

cs
Lee's Color space. Maps RPP of region onto color cube

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

rtrans
John's random transmission shader

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

spm
Spherical pixmap texture

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

stack
Shader stacker

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

stack
external Shader stacker

The "extern" shader takes a filename as its only argument. The file is opened and shaders and their parameters are read from the file. The "extern" shader is really an extension of the "stack" shader. The contents of the file can have the same structure as the content of the stack shader parameters.

WARNING: Since the mged command line format for specifying shaders and their parameters was converted to a Tcl/Tk syntax, the format in the shader file is NOT what the user is accustomed to typing. Instead, the old structparse() format should be adhered to:

	shader param=value param=value;shader param=value param=value
The "extern" shader was developed to overcome limitations in the v4 database format. The specific limitation addressed is that there are only 40 characters available for the shader parameter string.

Example

	mged> shader stuff.r "extern stuff_material.shd" 255 255 255 0

	% cat stuff_material.shd
	texture file=image.pix w=768 n=512;
	plastic sp=.8 di=.2 sh=10 tr=.1 re=.1

stxt
Broken and antiquated attempt at solid textures

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

checker
checkerboard color texture

Parameters

ParameterAbbreviationDefault Value

a
3-tuple color for squares
b
3-tuple color for other squares
s
number of squares in each direction (u,v)

Example

	mged> shader board.r "stack checker a=255/255/255 b=100/100/100 s=8;plastic"

fakestar
A fake star skymap texture

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

texture
maps a .pix file onto an object using u,v coordinates. This is usually undesirable for objects made up of more than one primitive solid.

Parameters

ParameterAbbreviationDefault Value
file    
w   512
n l w
transp    

file
Name of the pix file to map onto the object
w
width of the pix file in pixels
n
number of scanlines in the pix file
transp
a value which indicates the object does not exist (is transparent).

If the "transp" parameter is not set by the user, then no values are deemed transparent.

Example

	mged> shader cube.r stack texture file=eagle-w512-n438.pix w=512 n=438;plastic 0 0 0 0

See Also

prj, bwtexture


bwtexture
maps a .bw file onto an object using u,v coordinates

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

bump
Uses the R,B color data from a .pix file as a surface normal bump map

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto

testmap
Ramps the red value from off to on as the "u" coord of a texture map varis fro m0 to 1, and the blue value with the "v" coordinate. For debugging.

Parameters

ParameterAbbreviationDefault Value

parameter
Description of parameter

Example

	mged> shader air.r proto