Autodesk



Your Ad Here


SDL: The Alias Scene Description Language Procedural Textures and Natural Phenomena > Sky

About environment maps

An environment map is a model of the world as seen from a particular point of view over a viewing angle of 360×. In AliasStudio, environment maps may be used for two things. For reflection mapping, the environment map is used to store a model of the world around a particular point inside or near a surface. This map is then used to compute the color of a ray reflected by that surface. In this way, convincing reflection effects may be produced.

The syntax for using an environment map to do reflections is as follows. In the DEFINITION section use the following statement as part of a texture on a shader:

	reflection = texture (procedure = name, 
			arg 1 = value 1, 
			arg 2 = value 2, 
			etc. ...); 

The second application of environment maps is to create backgrounds. Since an environment map stores a complete view of the world in all directions, any particular view may be computed efficiently. This will only be accurate if the environment map was created around the current eye point. There are several reasons to do this.

First, the environment may be procedural in nature and this is the only way to see it. The "sky" procedure is a good example of this case. Secondly, a scene may be largely static but also very expensive to render. In that case a fast method for animating the camera direction without re-rendering the scene for every frame would be desirable. Moving objects could then be rendered over the top. The "Cube" procedure would be ideal for this approach. The syntax for creating a background from an environment map is as follows. In the ENVIRONMENT section use:

	background = texture (procedure = name, 
			arg 1 = value 1, 
			arg 2 = value 2, 
			etc. ...); 

An environment map exists in an environment space coordinate system. The default for all environments in AliasStudio is to have the environment space aligned with world space. Certain applications require the ability to rotate the environment map relative to world space. In particular, an object, lights and camera may be fixed relative to each other and the environment map tumbled. The syntax for this is identical to the coordinate transformations used with solid textures.

For example, consider a surface that is a ball being rendered with reflection mapping. It needs to have a transformation associated with it.

In the DEFINITION section the transformation must first be declared.

	transformation ball; 

A subsequent shader will include a textured parameter with "transformation_name"

	reflection = texture (procedure = Chrome, 
	transformation_name= ball), 

In the MODEL section the statement

	ball = current_transformation ( ); 

will appear.

If it is located at the base of the hierarchy then the reflection map will be unaffected since the default is for the environment map to be aligned with world space anyway. However, if the assignment of the "current_transformation" to "ball" appears within a hierarchy, the environment map will rotate with the hierarchy. So, if the assignment occurs just before a patch statement the environment map will rotate with the patch. If a non-proportional scale is applied, the environment map will be stretched and distorted.

It is important to note that Ball, Chrome, Cube, Sphere and Sky should not be used for bump or displacement mapping. The basic nature of environment mapping precludes accurate calculations. Although the system will allow it, you will be warned that the results will be unreliable and unpredictable.

Ball

The Ball procedure maps photographs of reflective balls into 3D environments.

This texture is designed primarily to accompany a pix file background. If you take a photograph at a desired location and camera view for a scene, a reflective sphere is then placed in the scene at the location where you wish to view your model. The photo of the ball is essentially a sample of the total environment. It contains a full 360 degree field of view, minus the portion directly behind the ball. The highest resolution is in the direction of the camera, therefore providing the best compression of data for that point of view.

The Ball procedure has optional planes and a finite sphere to assist in modeling the geometry of the environment. An eyespace toggle is provided to simplify placement when a background pix file is used. In addition, a reflection toggle can be used to help in advanced modeling of background geometry.

Argument Name
Absolute Range
Useful Range
Default
Description
image
   
no default
Name of pix file for reflection maps
inclination;
-infinity, infinity
-180, 180
0
Angle of camera with walls
elevation
-infinity, infinity
-90, -90
0
Angle of Camera with floor
eyespace
ON OFF
 
OFF
When ON, the reflections will match the background pix, regardless of the camera location.
sky_radius
0, infinity
0, 50
0
Radius of intersection sphere
top
0, infinity
0, 50
0
Distance of intersection planes from origin
bottom
0, infinity
0, 50
0
Distance of intersection planes from origin
left
0, infinity
0, 50
0
Distance of intersection planes from origin
right
0, infinity
0, 50
0
Distance of intersection planes from origin
front
0, infinity
0, 50
0
Distance of intersection planes from origin
back
0, infinity
0, 50
0
Distance of intersection planes from origin
reflect
ON OFF
 
ON
If set to OFF, ball behaves like a solid texture

Chrome

The Chrome texture creates a simple but effective environment to emit convincing reflections. The basic environment map consists of a ground plane and a sky plane. To add visual complexity to the scene, a series of rectangular lights are included in the sky. These lights are for visual effect only and do not act as light sources.

There is no blurring capability for the Chrome procedure, so aliasing artifacts may appear on reflective surfaces. These may be greatly reduced by having an aalevel of 4 and an aathreshold of 0 when rendering. An alternative is to use Chrome to create the faces for the Cube procedure.

Argument Name
Absolute Range
Useful Range
Default
Description
floor_color (triple)
0, infinity
0, 255
150,150,200
Color straight down as seen from front window
horizon_color (triple)
0, infinity
0, 255
0, 0, 0
Color just below the horizon
sky_color (triple)
0, infinity
0, 255
200,200,250
Color just above horizon
zenith_color (triple)
0, infinity
0, 255
100,100,250
Color straight up along +y
light_color (triple)
0, infinity
0, 255
250, 250, 250
Color of lights in the sky
light_width
0, infinity
0, 10
1.0
Number of lights per unit length along width
light_width_mult
0, 1.0
0, 1.0
1.0
Multiplier for light width
light_width_offset
0, 1.0
0, 1.0
1.0
Offset for light width
light_depth
0, infinity
0, 1.0
1.0
Number of lights per unit length along z
light_depth_mult
0, 1.0
0, 1.0
1.0
Multiplier for light depth
light_depth_offset
0, 1.0
0, 1.0
0.0
Offset for light depth
grid_color (triple)
0, infinity
0, 255
0, 0, 0
Grid line color
grid_width
0, infinity
0, 10
1.0
Number of grid cells per unit length along x
grid_width_mult
0, 1.0
0, 1.0
1.0
Multiplier for grid width
grid_width_offset
0, 1.0
0, 1.0
0.0
Offset for grid width
grid_depth
0, infinity
0, 10
1.0
Number of grid cells per unit length along z
grid_depth_mult
0, 1.0
0, 1.0
1.0
Multiplier for grid depth
grid_depth_offset
0, 1.0
0, 1.0
0.0
Offset for grid depth
real_floor
TRUE FALSE
0, 1
0
Flag for presence of real vs angular floor
floor_altitude
-infinity, infinity
-100, 100
-1.0
Elevation of floor along the y-axis

"Chrome" is an environment texture.

Sphere

A Sphere environment texture uses a single image to store the intensity information for all possible directions. However, in order to create the spherical map, the system actually uses a square texture map. If you consider wrapping a square texture map onto a sphere, you will see an immediate problem; you can't wrap a whole square onto a sphere and have the side edges match without either shrinking the square image vertically or having a lot of overlap at the poles. This is because the texture map goes 360× around the sphere at the sides, but vertically it only covers the sphere from pole to pole, which is 180×. To overcome this problem, the middle half of the square texture map is used and the information of the top and bottom 1/4 of the map is discarded, as shown in the following illustration.

The best way to create a spherical environment map is to generate a ramp image and then paint objects onto it that avoid the poles and the edges.

Consider the case of the default transformation and an eye point on the positive x-axis looking at the origin. If the spherical environment map is used directly as a background, the edge join will be visible. However, if a surface is viewed that has been reflection mapped, the join will be behind the surface and hardly visible.

Also consider the resolution of spherical reflection maps and how crisp they will appear. The horizontal resolution corresponds to 360×. A 5122 image will have one pixel every 1/2×. Flat surfaces that are reflection mapped will appear as blurred indistinct reflections. Higher resolution images may be used, but they are difficult to paint and use a lot of memory. It is better to use rounded geometry instead.

Argument Name
Absolute Range
Useful Range
Default
Description
image
   
no default
Name of pix file for reflection maps
flip
0, 1
 
0
Flag to indicate whether to swap u, v
shear_v
-infinity, infinity
-5, 5
0.0
Change of u for change in v
shear_u
-infinity, infinity
-5, 5
0.0
Change of v for change in u
source_texture
   
no default
Texture to be used as the image

"Sphere" is an environment texture.

Cube

The procedure "Cube" is an environment map defined by six faces of a cube. These faces are just square texture images in the form of pix files. Each file corresponds to a perspective view with a field of view of 90×, with a view direction along the positive and negative x, y, z axes. These images can be painted or digitized. However, the real application of cubic reflection maps is using rendered images. It is possible to construct an environment map about a particular point in a scene merely by using a few lines of SDL.

For the origin point 0.0 0.0 0.0 use the following statements:

In the DEFINITION section:

	startframe = 1; 
	endframe = 6; 
	 
	triple camera_view(0.0, 0.0, 0.0); 

In the MODEL section use:

if (	frame == 1.0 ) camera_view = (1.0, 0.0, 0.0); 
else if	(frame == 2.0 ) camera_view = (-1.0, 0.0, 0.0); 
else if	(frame == 3.0 ) camera_view = (0.0, 1.0, 0.0); 
else if	(frame == 4.0 ) camera_view = (0.0, -1.0, 0.0); 
else if	(frame == 5.0 ) camera_view = (0.0, 0.0, -1.0); 
else if	(frame == 6.0 ) camera_view = (0.0, 0.0, -1.0); 
camera (eye = (0,0,0), view = camera_view, fov = 90, 
	viewport = (0.0, 255.0, 0.0, 255.0), 
	aspect = (1.0) 
); 

For further information on creating cubic environment maps, please refer to the Cubic Environment Tutorial.

"Cube" is an environment texture.

Cubic environment maps are very fast to reference so they are the preferred method for animation sequences. The same scene may render 3 or 4 times faster using a cubic reflection map in place of the Sky procedure. It is possible to use other environment maps to create cubic environment maps merely by rendering them as backgrounds. It is, of course, not worth doing if the environment such as Sky varies every frame. However, if the environment is static for many frames, the speed savings will be considerable.

Cubic environment maps have the advantage that they may be blurred by an arbitrarily large amount without any additional cost. When generating a background from an environment map the amount of blurring required to prevent aliasing increases with the field of view. In practice, with 5122 texture images and a field of view less than 90× this will result in very little required blurring. For reflection mapped surfaces, however, the amount of blurring will depend upon the surface curvature and the distance from the eye point. Currently, this is not computed automatically. However, the variable "bluroffset" will allow the user to defocus the reflections by a desired amount. In fact, soft focus reflections can be used to simulate less than perfectly polished surfaces.

Argument Name
Absolute Range
Useful Range
Default
Description
top
   
no default
Pix file name for top image
bottom
   
no default
Pix file name for bottom image
right
   
no default
Pix file name for right image
left
   
no default
Pix file name for left image
front
   
no default
Pix file name for front image
back
   
no default
Pix file name for back image

In y-up systems, these are relative to the view down the z-axis; in z-up systems, they are relative to the view down the y-axis.

Sky

The Sky procedure is an environment map that generates images of a planetary atmosphere as seen from the surface of the planet. Parameter sets enable you to control the composition of the atmosphere and the cloud layer. If no floor is specified, the environment below the horizon is a vertical mirror reflection of the environment above the horizon. If a floor is specified, it must be given an altitude and other variables to control the positioning of a color pix file texture map on the surface.

Argument Name
Absolute Range
Useful Range
Default
Description
floor_texture
   
no default
pix file name for floor texture 24 bits
cloud_texture
   
no default
Mask file name for cloud texture 8 bits
cloud_altitude
0, 1
0, 0.5
 
y coordinate of cloud layer as a fraction of sky_thickness (if Y-up)
space_samples
0, infinity
1, 10
5.0
# of samples above clouds
floor_samples
0, infinity
0, 3
1.0
# of samples in front of floor
cloud_samples
0, infinity
0, 3
5.0
#. of samples below clouds
air_density
0, infinity
0, 10
1.0
Density of air molecules
dust_density
0, infinity
0, 3
0.0
Density of dust particles
sun_azimuth
-infinity, infinity
0, 360
145.0
Rotation of sun vector about vertical vector
sun_elevation
-infinity, infinity
-10, 90.0
45.0
Angle of elevation of sun vector relative to floor
sun_size
0, infinity
0, 30
0.531
Radius of sun's disc in degrees
sun_blur
0, infinity
0, 50
1.0
Radius of halo around sun in degrees
sun_halo_brightness (triple)
0, infinity
0, 1
0.2,0.3,0.2
Multiplicative color for halo around the sun
sky_brightness (triple)
0, infinity
0, 10
1.0, 1.0, 1.0
Multiplicative color for the sky
sun_brightness (triple)
0, infinity
0, 10
1.0, 1.0, 1.0
Multiplicative color for the sun
floor_altitude
-infinity, infinity
-100, 100
-1.0
y coordinate of the floor (if y-up)
cloud_density
0, infinity
0, 5
1.0
Density of the sky
cloud_radius
0, infinity
0, 50
20.0
Radius of halo around sun
cloud_width_mult
-infinity, infinity
-0.2, 0.2
0.1
Scaling factors for cloud map position on floor
cloud_depth_mult
-infinity, infinity
-0.2, 0.2
0.1
" " "
cloud_blurmult
0, infinity
0, 10
1.0
Scaling factor for cloud blur size
cloud_bluroffset
0, infinity
0, 1
0.0
Offset for cloud blur size
cloud_threshold
0, infinity
0, 1
0.5
Threshold for presence of clouds
cloud_brightness
0, infinity
0, 10
1.0, 1.0, 1.0
Multiplicative color for ambient cloud illumination
cloud_sunset_brightness
0, infinity
0, 500
300, 300, 300
Multiplicative color for front lighting
cloud_power
0, 1
0, 1
1.0
Exponent for cloud density falloff
floor_width_mult
-infinity, infinity
0, 10
1.0
Scaling factors for color map position on floor
floor_depth_mult
-infinity, infinity
0, 10
1.0
" " " "
floor_width_offset
-infinity, infinity
0, 1
0.0
Offsets for color map position on floor
floor_depth_offset
-infinity, infinity
0, 1
0.0
" " " "
floor_blurmult
0, infinity
0, 10
1.0
Scaling factor for floor blur size
floor_bluroffset
0, infinity
0, 1
0.0
Offset for floor blur size
floor_color (triple)
0, infinity
0, 255
255, 255, 255
Color of floor
sky_radius
0.01, infinity
0.01, 300
50.0
Radius of planet as a multiple of sky_thickness
sky_thickness
1, infinity
100, 10000
1000
Thickness of atmosphere
total_brightness
0, infinity
0, 10
1.0
Scales the overall brightness of environment
has_floor
TRUE FALSE
 
TRUE
Flag setting whether or not a floor is used.

"Sky" is an environment texture.


Autodesk
www.autodesk.com
aliasstudio.docs@mail.autodesk.com

Return to AliasStudio Index


Your Ad Here