Samples

Using the environment map

MascotCapsule V3 can process sphere mapping by using a special texture for sphere mapping, when the models are specified with sphere mapping attributes.

Table of contents



1. Environment mapping

Environment mapping is a mapping method where surrounding environment is reflected on the surface of a model.
Sphere mapping is an environment mapping method where 360-degree surrounding scenery is reflected on the model. There are other environment mapping methods, such as cube mapping where 90-degree horizontal surrounding scenery and 90-degree vertical surrounding scenery are reflected on the model, respectively.



2. Specifying the environment map setting

In order to load a texture for sphere mapping, specify false for the second parameter when creating the Texture object. Also, use the setSphereTexture( Texture sphereMap ) method in the Effect3D class to enable sphere mapping.

Specify null here to disable sphere mapping. In this sample, the soft key enables/disables sphere mapping. Also, press-down the direction keys to rotate the camera position.

// Loading the environment map data
sphereMap = new Texture( "SphereMap.bmp", false );

/**
  * commandAction() method
  * Process when the soft key is pressed-down (changing the rendering parameter)
  */
public void commandAction( Command c, Displayable d ){
String label = c.getLabel();

/* Switching the sphere map */
if( label.equals( commandLabels[ 0 ] ) ){
effect.setSphereMap( null );
}else if( label.equals( commandLabels[ 1 ] ) ){
effect.setSphereMap( sphereMap );
}
}
 

Sphere mapping enabled (left), disabled (right)



Page TopBack