Doc talk:Manual/Textures/Types/Environment Maps
-Needs update for Cube Plane Zoom --Roger 03:48, 31 January 2008 (CET) Can the following be deleted? Temporarily moving tutorial content here. --Matt Ebb 06:19, 19 July 2006 (CEST)
Setup
The first step to follow when creating an environment map is to define the viewpoint for the map. To begin, add an empty to the scene and place it in the specular position of the camera with respect to the reflecting surface. (This is possible, strictly speaking, only for planar reflecting surfaces.) Ideally, the location of the empty would mirror the location of the camera across the plane of the polygon onto which it is being mapped. It would be ridiculously difficult to create a separate environment map for every polygon of a detailed mesh, so we take advantage of the fact that the human eye is very gullible. In particular, for relatively small and complex objects, we can get away with simply placing the empty near the center. We name the empty env so that we can refer to it by name in the environment map settings.
We will create a reflective sphere over a reflective plane, using the set up depicted in Environment Map utilisation example.
Note the 'env' Empty is placed exactly below the camera, at a distance
from the reflecting plane
equal to 3 blender units, which is equal to the height of the camera over
the same plane.
Now, let's place some lights, leave the sphere without a given
material,
and move (M) the plane to a different layer. For
example, say that everything is
on layer 1, except for the plane which is in layer 2.
Give the plane a low Ref and
Spec material
and add a texture on channel two with the parameters in Reflecting plane material.
Note both the Refl mapping and the
Cmir effect.
We use channel 2 and not 1 because we will need channel 1 later on
in this example.
Now define the newly assigned texture as an EnvMap in the Texture Buttons (F6) (Reflecting plane EnvMap settings.). In the Envmap Panel, note the Ob: field containing the name of the Empty with respect to which we compute the EnvMap. Note also the resolution of the cube on which the EnvMap will be computed and, most important, the Don't render layer: buttons. Because the EnvMap is computed from the Empty location it must have an unobstructed view of the scene. Since the reflecting plane would completely hide the sphere, it must be on its own layer which must be marked as Don't render layer for the EnvMap calculation.
Pressing F12 starts the rendering process. First, six different square images comprising the EnvMap are computed, after which the final image is produced, of the sphere reflected over the plane.
To add more visual appeal to the scene, add a texture in the World Buttons.
Then add a new Empty in the center of the Sphere and move the Sphere to Layer 3. Next, give the sphere an EnvMap exactly as you did for the plane (but this time layer 3 must not be rendered!) Now add some cylinders, to make the environment even more interesting, and, before pressing F12 return to the plane's texture and press the Free Data button. This will force Blender to recalculate the EnvMap for the new, different, environment. This time in the rendering process twelve images, six for each EnvMap, will be computed. The result is in Reflecting sphere on a reflecting surface.. The sphere is shiner than the plane due to slightly different settings in the materials.
But wait, there is a problem! The Sphere reflects the Plane, but the Plane reflects a dull grey Sphere! This is because the Plane EnvMap is computed before the sphere EnvMap. As such, when it is computed the sphere is still dull grey, while when the Sphere EnvMap is computed the plane already has its Reflection. To fix this locate the Depth Num Button in the Envmap panel of the Texture buttons and set it to 1 both for the plane and the sphere EnvMap texture. This forces recursive computation of EnvMaps. Each EnvMap is computed, then they are recomputed as many times as 'Depth' is set to, always one after the other. The result is in to fix this Reflecting sphere on a reflecting surface with multiple reflections..
Now, if you are still wondering why the first texture channel of the Plane material was kept empty... Add a new texture to the first channel of the plane material. Make it Glob, affecting the Nor with a 0.25 intensity (Additional texture set-up for BumpMapping.).
This new texture should be of Stucci type; tune the Noise Size down to 0.15 or so. If you now render the image the plane will look like rippled water (Reflecting sphere on a reflecting water with multiple reflections.).
You must have the BumpMap on a channel preceding the EnvMap because textures are applied in sequence. If you were to do this the other way around the reflection would appear to be broken by waves. You can save EnvMaps for later use and load them with the pertinent buttons in the Texture Buttons. You can also build your own envmap. The standard is to place the six images mapped on the cube on two rows of three images each, as in The EnvMap as it is stored..
Additional Settings for Environment Maps
Note
You can animate the water of the previous example by setting an IPO for the ofsX and ofsY values of the texture placement in the Material Buttons. Rendering the animation would then show moving ripples on the surface, with reflections changing accordingly! |
Note
The EnvMap of the Plane needs to be computed only once at the beginning if nothing else moves! Hence it can be static. The Envmap on the sphere is another matter, since it won't reflect the changes in the reflections in the water unless it is computed at each frame of the animation. Hence it should be of type Anim. |
If the camera is the only moving object and you have a reflecting
plane, the Empty must move too and you must use
Anim
EnvMaps. If the object is small and the Empty is in its center, the
EnvMap can be
Static, even if the object itself rotates since
the Empty does not move. If, on the other
hand, the Object translates the Empty should follow it and the
EnvMap be
of Anim type.
Other settings are:
- Filter: - With this value you can adjust the sharpness or blurriness of the reflection.
- Clipsta, ClipEnd - These values define the clipping boundaries when rendering the environment map images.
Note
EnvMap calculation can be disabled at a global level by the EnvMap Tog Button in the Render Panel of the Rendering Buttons. |