![]()
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:
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:
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.
A subsequent shader will include a textured parameter with "transformation_name"
In the MODEL section the statement
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.
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.
"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.
"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:
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.
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.
"Sky" is an environment texture.
|
Autodesk www.autodesk.com aliasstudio.docs@mail.autodesk.com |