Tutorial 2: Environment mapping
Environment Mapping, also known as "Reflection Mapping" is a useful way to make 3D models in your application more appealing.
Instead of having a simple, uniform colored global illumination the model is put into a large virtual textured cube.
| Example of an Environment Map |
 |  |  |  |  |  |
| negative_x | negative_y | negative_z | positive_x | positive_y | positive_z |
In this example we use an environment map with a sky-look for the truck model. The map consits of six images which have to have specific names (see table above). We recommend putting those files into a subfolder of the projects assets folder. In this case we called the folder "env_map". Loading the map works now by calling
loadEnvironmentMap on the MobileSDK instance:
mMobileSDK.loadEnvironmentMap( getAssetPath("truck/env_map" ) );

For environemt mapping you can use any model format that the MobileSDK can load (see e.g.
the content tutorials).
| Reflection Map | Texture |
 |  |
Additonally you need:
- Texture: As for any model, you need one texture file. The name of the file must be the same as the name of the 3D model file (without extension).
So if your geometry has the file name "<modelname>.md2" or "<modelname>.obj" the name of texture file would be "<modelname>.png" or "<modelname>.jpg" .
Example: If the model file name is "truck.obj" the texture name is "truck.png"
- Reflection Map: It defines how strong the reflection of the enviroment should be at a certain spot on the model. A brighter value means more, a darker value means less reflection. The name of the file must be like the models name with "_reflective" attached (similar to a normal texture file). The MobileSDK tries to load the file if you use the loadEnvironmentMap method.
Example: If the model file name is "truck.obj" the reflection maps file name is "truck_reflective.png"
- For each side of the cube one texture. The files must be located within the same folder and have specific names (see below). Once you call loadEnvironmentMap the MobileSDK tries to access these files in the specified folder which implies that all files for the environment map have to exist.
Example: If your files are in a folder called "env_map" and that folder is inside of another folder named "truck", the MobileSDK will look for the following files within the folder "truck/env_map":
- negative_x.png
- negative_y.png
- negative_z.png
- positive_x.png
- positive_y.png
- positive_z.png
--
SupportMetaio - 2011-12-07