Environments
These shaders return colors from color textures that are
mapped to finite or infinite distances. They are useful for
adding background or foreground plates to the rendered scene.
Environments must be used for environment shaders, overlays must
be used for lens shaders, and textures must be used for texture
or material shaders on a plane or other object in the scene.
Spherical Environment
Given a texture shader, assume that the texture it produces is
wrapped on an infinite sphere around the scene, evaluate the
texture, and return the color. This is useful for environment
shaders.
mib_lookup_spherical
color "mib_lookup_spherical" (
vector "dir",
scalar "rotate",
color texture "tex")
- dir
- is the direction to sample. If connected to
mib_texture_vector, a select value of -10 is useful. It
should be given in world space. If this is the null vector, the
ray direction is used, after conversion to world space.
- tex
- is a texture or shader to look up at the computed
coordinate.
Cube Environment
Same as the spherical environment shader, but accept either
one or six textures mapped on an infinite cube. This is useful
for environment shaders.
mib_lookup_cube1
color "mib_lookup_cube1" (
vector "point",
vector "dir",
vector "size",
color texture "tex")
mib_lookup_cube6
color "mib_lookup_cube6" (
vector "point",
vector "dir",
vector "size",
color texture "tex_mx",
color texture "tex_px",
color texture "tex_my",
color texture "tex_py",
color texture "tex_mz",
color texture "tex_pz")
- point
- is the view location.
- dir
- is the direction to sample. If connected to
mib_texture_vector, a select value of -10 is useful. If
this is the null vector, the ray direction is used.
- size
- is the size of the box.
- tex
- is a texture to look up at the computed coordinate.
One texture contains all six sides; it has six times the number
of scanlines required for a single face, with the sub-textures
stacked in the following order, top-down: -x, +x, -y, +y, -z,
+z.
- tex_**
- are six textures for the left (mx), right (px),
bottom (my), top (py), yon (mz), and hither (pz) faces. "p" and
"m" stand for plus and minus.
Cylindrical Environment
This environment shader is most useful for projecting regular
patterns onto geometry, for example for surface quality control.
The cylinder does not have caps, so it might happen that rays do
not hit the cylinder. The cylinder is defined by a transformation
which transforms from world to canonical cylinder space, and two
scalars that allow cutting off part of the cylinder. If both
begin and end are zero, a full cylinder is
selected.
mib_lookup_cylindrical
color "mib_lookup_cylindrical" (
transform "xform",
scalar "begin",
scalar "end",
color texture "tex" )
- xform
- transforms from world to canonical cylinder
space. The canonical cylinder has the Z axis as the major axis,
extends from -1 to +1 on the Z axis and has a
radius of 1. If tex is a procedural texture, texture coordinates
are calculated for the intersection point: Z = -1 is
mapped to v = 0 and Z = +1 is mapped to v =
1. Texture coordinates for u are calculated counterclockwise
around the Z axis where +X is mapped to u = 0 and
-X to 0.5.
- begin
- specifies the starting angle in radians where the
cylinder begins. The angle specification is based on +X =
0 radians.
- end
- specifies the ending angle where the cylinder body
should end.
- tex
- is a texture or shader to look up at the computed
coordinate.
Backgrounds
Given a texture shader, place it in the background of the
scene such that the edges of the texture line up with the edges
of the rendered image. Factors can be applied to stretch and pan
the texture, to allow for lenses that bend rays away from the
center. The purpose of this environment is inserting background
plates. Returns a color. This is useful in three different types
of shaders:
- Environment shaders can place the background plate at
infinity.
- Lens shaders can place the plate in front of the entire
scene by evaluating the background shader first and casting an
eye ray only if the returned alpha is less than 1, and blending
the results.
- Material shaders on an XY axis aligned plane in the scene
insert the plate at the Z coordinate of the plane if they first
evaluate the background shader, then cast a transparency ray
only if the returned alpha is less than 1, and blend the
results.
mib_lookup_background
color "mib_lookup_background" (
vector "zoom",
vector "pan",
boolean "torus_u",
boolean "torus_v",
color texture "tex")
- zoom
- enlarges the texture image by a factor given by
the X and Y components of the zoom vector. The Z component is not
used. If a component is 0, it defaults to 1.
- pan
- shifts the texture sideways by a fraction of the
rendered image size. The Z component is unused. For example, if
the X component is 0.1, the left 10% of the rendered image
background remain blank.
- torus_*
- if true, repeats the texture endlessly in the
respective direction. If false, transparent black is returned
outside the tex image.
- tex
- is a texture or shader to look up at the computed
coordinate. It will be sampled in the range [0 ... 1)
only.
Copyright (©) 1986-2008 by
mental images GmbH