- 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
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default Value |
dpm | - | 0.1 |
delta | d | 0.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.
Parameter | Abbreviation | Default Value |
Noise Parameters |
lacunarity | l | 2.1753974 |
H | H | 1.0 |
octaves | o | 4.0 |
size | s | 1.0 |
vscale | v | 1.0/1.0/1.0 |
delta | d | 1000/1000/1000 |
Shader Specific Parameters |
color2 | c2 | 250/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 value | Object Color |
nv < thresh1 | color1 |
nv < thresh1 andnv < thresh2 | color2 |
nv > thresh2 | color3 |
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.
Parameter | Abbreviation | Default Value |
Noise Parameters |
lacunarity | l | 2.1753974 |
H | H | 1.0 |
octaves | o | 4.0 |
size | s | 1.0 |
vscale | v | 1.0/1.0/1.0 |
delta | d | 1000/1000/1000 |
Shader Specific Parameters |
thresh1 | t1 | -0.25 |
thresh2 | t2 | 0.25 |
color1 | c1 | 97/74/41 |
color2 | c2 | 26/77/10 |
color3 | c3 | 38/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
Parameter | Abbreviation | Default Value |
Noise Parameters |
lacunarity | l | 2.1753974 |
H | H | 1.0 |
octaves | o | 4.0 |
size | s | 1.0 |
vscale | v | 1.0/1.0/1.0 |
delta | d | 1000/1000/1000 |
Shader Specific Parameters |
flicker | f | 0.0 |
stretch | st | 0.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
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default Value |
Noise Parameters |
lacunarity | l | 2.1753974 |
H | H | 1.0 |
octaves | o | 4.0 |
size | s | 1.0 |
vscale | v | 1.0/1.0/1.0 |
delta | d | 1000/1000/1000 |
Shader Specific Parameters |
angle | a/ang | 1.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
Parameter | Abbreviation | Default Value |
plastic | mirror | glass |
shine | sh | 10 | 4 | 4 |
specular | sp | 0.7 | 0.6 | 0.7 |
diffuse | di | 0.3 | 0.4 | 0.3 |
transmit | tr | 0.0 | 0.0 | 0.8 |
reflect | re | 0.0 | 0.75 | 0.1 |
ri | - | 1.0 | 1.65 | 1.65 |
extinction | ex | 0.0 | 0 | 0 |
- 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
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- scloud
- Lee's ``Solid Clouds''
Parameters
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- cloud
- Geoffrey Gardner style 2D cloud texture
Parameters
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- cs
- Lee's Color space. Maps RPP of region onto color cube
Parameters
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- rtrans
- John's random transmission shader
Parameters
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- spm
- Spherical pixmap texture
Parameters
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- stack
- Shader stacker
Parameters
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto
- checker
- checkerboard color texture
Parameters
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default 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
Parameter | Abbreviation | Default Value |
- parameter
- Description of parameter
Example
mged> shader air.r proto