GIG reference manual

maps appendix

____________________________________________________________________________________

Section contents

____________________________________________________________________________________

Symbols

Remember, everywhere in the attributes input boxes where normal values, bump, or colors are used, they can be replaced by value, color, or color maps. So instead of noise(0.1) you can also type:

     noise(mu()*mv()))
. Also some conversions between types are possible. Conversion from color to value:

     Value = val( Color ColorName )

Example: val(red) is 0.30

     Value = ColorName.n (where n is 0, 1, or 2)

Example: red.0 is 1 and red.1 is 0 and red.2 is 0

____________________________________________________________________________________
Coding
In the following description of useful maps, we use the following coding to describe the maps: ReturnedMapType FunctionName (ParameterList) The ReturnedMapType can be either of type Value, Color or Bump. The ParameterList contains the possible parameters that can be used to customize the function. It can contain mandatory or optional parameters. If more than one parameter is required, parameters are separated by commas: (ParameterDescription1, ParameterDescription2, ParameterDescription3). The syntax of ParameterDescription is:

Type ParameterName

The type can be Value, Color or Bump. Most parameters are simple values. Finally, if a parameter is optional, it is placed in square brackets:

[Type ParameterName]

Comment:
If more than one parameters is optional, and one is to be specified, then all preceding parameters must also be given. It is not possible to leave out some in front and just specify the ones at the end.

____________________________________________________________________________________

Primitive maps

bnoise
See noise for the explanation. The returned map has a value scaled from -1 to 1, while the noise function returns a map with a value scaled from 0 to 1. This map is useful for bumpmapping, e.g. Bump = bump(bnoise(), bnoise()) creates a bump map of 2 noises.

Usage:
Value = bnoise( [Value Size [, Value Seed]] )

bscratch
Scratchy vector valued bumpmap.

Usage:
Bump = bscratch( [ scl [, order [, dens [, maxdens [, thick [, dir [, dirfact ]]]]]]] ) (All parameters are of type Value.)

bump
This function makes a bumpmap of two value maps. One has to be aware of the fact that value maps are normally scaled from 0 to 1, while bumpmaps have values symmetrical around 0. Use vtob(Value) to convert [0, 1] to [-1, 1]

Usage:
Bump = bump( Value1, Value2 )

Example:
vbump = bump( vtob( mu()), vtob( mv()) )

bumpwave
the same as wave, but producing a bumpmap rather than a value map.

Usage:
Bump = bumpwave( [ Value1, Value2, Value3, Value4, Value5, Value6 ]* )

bumpwave3d

Usage:
Bump = bumpwave3d( [ Value1, Value2, Value3, Value4, Value5, Value6, Value7 ]*)

See also:
wave3d

chess3
This is the 3-dimensional counterpart of vchess. It defines a 3-D chessboard value map of size x by y by z cubes in 3-D units with values Value1 and Value2.

Usage:
Value = chess3( [ Value x, Value y, Value z [, Value1, Value2 ]] ) Default 8 by 8 by 8, 0 and 1.

clipmaps
For each point the resulting map is chosen out of a row of maps according to the value of a controlmap.

Usage:
Map = clipmaps( mp0, mp1 [, nx, mpx ]* ) ( x: 2 ... n )
clipmaps( cmp, mp1, v2, mp2, v3, ... , vn, mpn )
v1, v2, ... , vn should form a increasing row of values.
There are a v0 = 0 and a v(n+1) = 1 assumed.
For each point cmp is determined. If this value lies between vi and v(i+1), mpi is used as the resulting map.

conditional maps
Maps can be created using conditional expressions such as:

     mx() < 0.5 ? red : green
The normal expression is:
     Q ? Y : N
Where: Q is the question; an expression returning a Boolean value: T (true) or F (false) Y is the result when the answer to the question is yes (the result is true). N is the result when the answer to the question is no (the result is false).

mx() < 0.5 ? 1 : 0

dither
To make maps with a pointilistic appearance, there is a dither function which can be applied to any value map. The number of levels to which the map is randomly dithered can be given. This function is quite time consuming!

Usage:
Value = dither( Value Map, [ Value] )

dnoise
See noise for the explanation. The resulting map is a vectorvalued bump map.

Usage:
Color(or Bump) = dnoise( [Value Size [, Value Seed]] )

ffract
Ffract takes the fractional part of a value (or value map). It clips the value map between 0 and 1.

Usage:
Value = ffract( Value )

ffract( 5 * mu() )

fracint
Fracint generates a fractal map. Fractal mappings are calculated in advance and can use a lot of memory space depending on the fractal size that might be given. The term fractal is meant as: A set of data defined on a 2-dimensional rectangular grid, generated by stochastic means, which has fractal characteristics. The fractals are generated by an adaptation of the well-known midpointdisplacement algorithm. The fractal size is not given as a parameter, however. It has to be typed in advance to the function fracint separated by a ";." So for example, to get the following figure, type in the intensity input box: fracsize( 50 ) ; fracint()

Usage:
Value Map = fracint()

fracint() with fracsize(50)

fracturb

Usage:
Value = fracturb( Value )

hsv
convert rgb to hsv color.

Usage:
Color = hsv( Color )

hsvmap
The same as rgbmap, except the 3 components are taken to represent hue, saturation and value. For example, type in the color input box: hsvmap( mu(), mv(), 1) and render.

Usage:
Color = hsvmap( Value, Value, Value )

mandel
The famous Mandelbrot set which keeps a lot of people from getting into mischief.

Usage:
Value = mandel( zr, zi, s, i )

parameters:

	zr and zi complex number which is the center of the map.

s scale of the complex plane which coincides with an u-v unit. i maximum iteration count.

Usually the Mandelbrot set is visualized by taking the iteration count as index in a color table. This map scales the range of the iteration count to the real interval 0 - 1. Gaps in the iteration are continuously filled by taking into account the resulting distance from the limiting circle in the complex plane (a problem which is closely related to the nature of the set itself). The map is calculated during raytracing. Thus it is possible to zoom in the Mandelbrot set by literally zooming in the object with the camera.

Example:
(Peitgen & Richter, The beauty of fractals, Map 58-60 ) mandel( -1.253443, 0.046689, 0.001163, 256 )

marble2 and marble3
These two functions generate marble intensity maps. When no parameters are given, the default values will be used. These function might be a useful alternative of those in the Mapfactory or materials library in GIG. The calculation during rendering is considerably faster.

Usage:
Value = marble2( Value scl, Value mf, Value md )
Value = marble3( Value scl, Value mf, Value md, Value frc )

These two functions generate marble intensity maps. When no parameters are given, the default values will be used. These function might be a useful alternative to those in the Mapfactory or materials library in GIG. The calculation during rendering is considerably faster.

scl: scale value.

typical 0.0 < scl <= 1.0 for marble2, no limits for marble3, default 0.5 mf: mixing factor of 'veins' and 'background' 0.0 <= mf <= 1.0, default 0.5 md: narrowness of veins. md > 0.0,default 0.5 frc: number of noises in marble3. This paramter is very relevant in respect to the calculation time of the map. integer > 0, default 2 (stones from `materials' have this parameter always 3, number of noises = 2*frc+1)

matmap
This map has a non-correlated random bump with Gaussian distribution. The optional parameter is the standard deviation, default 1.

Usage:
Bump = matmap( [ Value ] )

mbound
This function allows you to create intensity maps similar to conditional maps but with smooth borders.

Usage:
Value = mbound( map, bandwith, position )

mbound(mv(), 0.2, 0.5 )

mu

Usage:
Value = mu()

mv

Usage:
Value = mv()

These functions make the coordinates of the 2D map domain immediately available as value maps.

mx

Usage:
Value = mx()

my

Usage:
Value = my()

mz

Usage:
Value = mz()

These functions make the coordinates of the 3D map domain immediately available as value maps.

noise
This describes a function that returns a value map. It receives two parameters, both of type value. It is a modification of the map described by Perlin (Siggraph 85). It generates non-correlated random values and gradients on 3-D grid points and interpolates between these points.

Usage:
Value = noise( [ Value Size [, Value Seed ] ] )

Size: the grid size (distance between grid points, default 1. size might be a map ) Seed: like a random seed, default 0, to be able to generate different non-correlated maps. ( 0 <= o < 1024 )

noise( mv() )

rgb
Converts hsv color to rgb.

Usage:
Color = rgb( Color )

rgbmap
This function takes 3 value maps ( or values ) and interprets them as the red, green and blue component of a color map.

Usage:
Color = rgbmap( Value, Value, Value )

rotate
Create transformation representing rotation of n units (degrees or radians) around an axis. ( Axis can be lx, ly or lz for the x, y, and z axis). For example rotate(30.0, ly) creates a rotation of 30 degrrees around the y-axis.

Usage:
Value = rotate( Value n, Axis )

scale
Create scaling transformation. (Axis might also be o for scaling relative to the origin). For example, scale(3.0, o) creates a scaling of 3 relative to the origin. And, scale(10, lz) creates a scaling of 10 relative to the z-axis.

Usage:
Value = scale( Value n, Axis )

scratch
3-d map which creates a scratched surface. The scratches are intersections of a surface with flat discs. These discs are generated according to a density function with a poisson distribution. The direction of the scratches is default random, but can be controlled withe a vector function.

Usage:
Value = scratch( [ scl [, order [, dens [, maxdens [, thick [, dir[, dirfact ]]]]]]] ) parameters:
scl: 	 scale of basic volume.
	 type: number or value map.
order: 	 order of random generation to be able to generate non-correlated 
	 maps.

type: integer. dens: density of scratches according to basic volumes as defined by the scl parameter. type: number or value map. maxdens: only relevant if dens is a map. maximum value dens can obtain. will not be regarded if dens is constant. type: number. thick: thickness of the scratches relative to scl. Default 0.001 type: number or valumap. dir: direction of the scratches. given as the normal of the plane of the discs. If given as a map, it must be a 3-D map. default the direction is uniform randomly distributed. type: point or vector map. dirfact: the direction of the scratches can be a mixture of the given dir and the default random direction. dirfact gives the factor of the random direction. if dir is given the default is 0 otherwise 1. type: number or valuemap.

translate
This function creates translation transformation.

Usage:
Value = translate( n1, n2, n3 ) ( == translate( point( n1, n2, n3 )); )

trfmap
With this function it is possible to redefine all map-domain coordinates by any map.

Usage:
mp = trfmap( mp, Value1, Value2 ) mp = trfmap( mp, Value1, Value2, Value3)

3D texture coordinatescan be transformed with trfmap(map, newx, newy, newz). This creates a new map out of the given map 'map' with (x, y, z ) space defined by the given newx, newy, and newz. 3D to 2D projections can be defined with trfmap(map, mu(), mv(), 0.0) 2D texture coordinates can be transformed with trfmap(map, newu, newv). This creates a new map out of the given map 'map' with (u, v) space defined by the given newx, newy, and newz.

trfmap( vchess(), mu() + 0.1 * noise(0.1), mv())

2D to 3D projections can be defined with trfmap(map, mx(), my())

turb

Usage:
Value = turb([Value])

turbbump
mixture of several noises combined.

Usage:
Bump = turbbump([Value])

vchess
Produces chess board pattern as a 2D (u, v) value map consisting of rectangles with alternating values.

Usage:
Value = vchess( [ Value u, Value v [, Value1, Value2 ]] ) Parameters:

number of rectangles in u and v direction and two values to use. Defaults are 8, 8, 0, 1

vchess( 4, 8 )

wave
This is a simulation of circular waves such as those produced by stones thrown in water. Each circular wave has 6 parameters. One can produce as many interfering waves as one desires.

Usage:
Value = wave( [ u, v, fr, ph, in, dc ]* ) u, v are the coordinates of the center in the 1.0 by 1.0 map defining square. The center can actually lie outside the square. fr is the frequency of the wave relative to the u-v unit. ph is the phase of the wave expressed in radians ( 0-2*pi ). in is the intensity. dc is the exponential decay factor. 0 means constant wave. < 0 outward decaying wave, > 0 increasing wave.

Wave (0.75,0.75, 2, 0, 1, -1.0)

wave( 0.5, 0.5, 10, 0.66, 1, -0.1, 0.1, 3.5, 33, 0.74, 0.25, -0.05 );

wave3d
This is the 3-D counterpart of the 2-D wave .It generates the interference of ball shaped propagating waves. It requires one more parameter per wave: x, y, z instead of u, v.

Usage:
Value = wave3d( [ x, y, z, fr, ph, in, dc ]* )

wolk2

Usage:
Color = wolk2([Color])

wolk3

Usage:
Color = wolk3([Color])

These two functions create cloud like maps. You might possibly set the "sky" color to a chosen color.

witwolk

Usage:
Color = witwolk( map )

wwolk

Usage:
Color = wwolk( map [,Color])

Generalisation of the wolk2 and wolk3 functions. The first parameter is a value map. This might be a user defined noise map to create cloud-like effects.

____________________________________________________________________________________

Mathematical functions

These mathematical functions are in general not used directly as output for creating maps. However, they can be used to describe more complex functions that can be used as parameters in other standard functions.

Examples:

noise( acos( pi * mv() ) )

trfmap( vchess(), cos ( pi * mv() ), mu() )

trfmap( vchess(), sin ( pi * mv() ), sin ( pi * mu() ) )

acos
Value = acos( Value ) Bump = acos( Bump )

acosec
Value = acosec( Value ) Bump = acosec( Bump )

acosh
Value = acosh( Value ) Bump = acosh( Bump )

acosech
Value = acosech( Value ) Bump = acosech( Bump )

asec
Value = asec( Value ) Bump = asec( Bump )

asech
Value = asech( Value ) Bump = asech( Bump )

asin
Value = asin( Value ) Bump = asin( Bump )

asinh
Value = asinh( Value ) Bump = asinh( Bump )

atan
Value = atan( Value ) Bump = atan( Bump )

atanh
Value = atanh( Value ) Bump = atanh( Bump )

atan2
Value = atan2( Value1, Value2 )

cmplx
Bump = cmplx( Bumpv1 , Value2 ) make complex value in rectangular form.

color
Color = color( Value, Value, Value ) Converts three values into a color vector. This function is identical to the function point.

cos
Value = cos( Value ) Bump = cos( Bump )

cosec
Value = cosec( Value ) Bump = cosec( Bump )

cosech
Value = cosech( Value ) Bump = cosech( Bump )

cosh
Value = cosh( Value ) Bump = cosh( Bump )

exp
Value = exp( Value ) Bump = exp( Bump )

fabs
mp = fabs( mp ) Value = fabs( Bump )

hypot
Value = hypot( Value1, Value2 )

im
Value = im( Bump ) get imaginary part of complex value.

log
Value = log( Value ) Bump = log( Bump )

pcmplx
Bump = pcmplx( Bump , Value ) make complex value in polar form.

point
Color = point( Value, Value, Value ) This function is identical to the color function.

pol
Value = pol( Value ) get complex value in polar form.

re
Value = re( Bump ) get real part of complex value.

sec
Value = sec( Value ) Bump = sec( Bump )

sech
Value = sech( Value ) Bump = sech( Bump )

sin
Value = sin( Value )

trfmap(sin(10*pi*mv()) , mu(), mv()+0.1*noise(0.1))

sinc
Value = sinc( Value )

sinh
Value = sinh( Value )

sqr
Value = sqr( Value )

sqrt
Value = sqrt( Value )

tanh
Value = tanh( Value ) Bump = tanh( Bump )

vatan2
Value = vatan2( Value1, Value2 ) vatan2 with values from 0 to 1.

vcos
Value = vcos( Value ) Cos with period and value from 0 to 1.

vcos(mu())

vsin
Value = vsin( Value ) Sin with period and value from 0 to 1.

vsin(mv())

____________________________________________________________________________________
Valid Color Names
Color name		Red	 Green 	Blue

Aquamarine		0.438 	0.855 	0.574
Black			0.000 	0.000 	0.000
Blue			0.000 	0.000 	0.996
Blueviolet		0.621 	0.371 	0.621
Cadetblue		0.371 	0.621 	0.621
Coral			0.996 	0.496 	0.000
Cornflowerblue		0.258 	0.258 	0.434
Cyan			0.000 	0.996 	0.996
Darkgreen		0.184 	0.309 	0.184
Darkolivegreen		0.309 	0.309 	0.184
Darkorchid		0.598 	0.195 	0.797
Darkslateblue		0.418 	0.137 	0.555
Darkslategreen		0.184 	0.309 	0.309
Darkturquoise		0.438 	0.574 	0.855
Dimgrey			0.328 	0.328 	0.328
Firebrick		0.555 	0.137 	0.137
Forestgreen		0.137 	0.555 	0.137
Gold			0.797 	0.496 	0.195
Goldenrod		0.855 	0.855 	0.438
Green			0.000 	0.996 	0.000
Greenyellow		0.574 	0.855 	0.438
Indianred		0.309 	0.184 	0.184
Khaki			0.621 	0.621 	0.371
Lightblue		0.746 	0.844 	0.844
Lightgrey		0.656 	0.656 	0.656
Lightsteelblue		0.559 	0.559 	0.734
Limegreen		0.195 	0.797 	0.195
Magenta			0.996 	0.000 	0.996
Maroon			0.555 	0.137 	0.418
Mediumaquamarine	0.195 	0.797 	0.598
Mediumblue		0.195 	0.195 	0.797
Mediumforestgreen	0.418 	0.555 	0.137
Mediumgoldenrod		0.914 	0.914 	0.676
Mediumorchid		0.574 	0.438 	0.855
Mediumseagreen		0.258 	0.434 	0.258
Mediumslateblue		0.496 	0.000 	0.996
Mediumspringgreen	0.496 	0.996 	0.000
Mediumturquoise		0.438 	0.855 	0.855
Mediumvioletred		0.855 	0.438 	0.574
Midnightblue		0.184 	0.184 	0.309
Navy			0.137 	0.137 	0.555
Navyblue		0.137 	0.137 	0.555
Orange			0.797 	0.195 	0.195
Orangered		0.996 	0.000 	0.496
Orchid			0.855 	0.438 	0.855
Palegreen		0.559 	0.734 	0.559
Pink			0.734 	0.676 	0.914
Plum			0.914 	0.676 	0.914
Red			0.996 	0.000 	0.000
Salmon			0.434 	0.258 	0.258
Seagreen		0.137 	0.555 	0.418
Sienna			0.555 	0.418 	0.137
Skyblue			0.195 	0.598 	0.797
Slateblue		0.000 	0.496 	0.996
Springgreen		0.000 	0.996 	0.542
Steelblue		0.137 	0.418 	0.555
Tan			0.855 	0.574 	0.438
Thistle			0.844 	0.746 	0.844
Turquoise		0.676 	0.914 	0.914
Violet			0.309 	0.184 	0.309
Violetred		0.797 	0.195 	0.598
Wheat			0.844 	0.844 	0.746
White			1.000 	1.000 	1.000
Yellow			0.996 	0.996 	0.000
Yellowgreen		0.598 	0.797 	0.195
____________________________________________________________________________________

Operators


Binary Operators

|
logical disjunction
Boolean = Boolean1 | Boolean2

&
logical conjunction
Boolean = Boolean1 & Boolean2

>
greater than comparison
Boolean = Value1 > Value2

<
smaller than comparison
Boolean = Value1 < Value2

>_ or _>
greater or equal comparison
Boolean = Value1 >_ Value2

<_ or _<
smaller or equal comparison
Boolean = Value1 <_ Value2

_=
equal comparison
Boolean = Boolean1 _= Boolean2
Boolean = Value1 _= Value2
Boolean = Color1 _= Color2

#=
not equal comparison
Boolean = Boolean1 #= Boolean2
Boolean = Value1 #= Value2
Boolean = Color1 #= Color2

+
numerical addition
Value = Value1 + Value2
Bump = Bump1 + Bump2
Color = Color1 + Color2

-
numerical subtraction
Value = Value1 - Value2
Bump = Bump1 - Bump2
Color = Color1 - Color2

*
numerical ( scalar ) multiplication
Value = Value1 * Value2;
Bump = Value * Bump;
Bump = Bump1 * Bump2;
Color = Value * Color

/
real division
Value = Value1 / Value2;
Bump = Bump / Value;
Bump = Bump1 / Bump2;
Color = Color / Value

^
power
Value = Value1 ^ Value2;
Bump = Bump1 ^ Bump2

@
matrix multiplication
Value = Value @ Value Map

.
index of point or color, e.g. red = color(1, 0, 0)
red.0 = 1
red.1 = 0
red.2 = 0

Unary operators

-
numeric additive inversion Value = -Value Bump = -Bump Color = -Color

!
logical inversion Boolean = !Boolean

/
numeric multiplicative inversion Value = / Value ( == 1.0 / Value) Bump = /Bump