6.3. Changing the model appearance

Lighting

Lighting can either be "off", in which case the appearance of the model in the viewer is only dependant on the colour of the texture map, or "on", in which case the model will appear to have a light shining on it.

The appearance of the model under lighting is defined by the three lighting parameters (each of which range from 0.0 to 1.0).

Shadows

The location of the light causes a shadow to be cast on the ground plane. The applet parameter shadow can be set to either "none" or "soft".

Texture mapping mode

Texture mapping is the processes of applying an image to the model, to make it appear more realistic. Specify the default texture mapping by using the textureQuality applet parameter.

The viewer supports two types of texture mapping - nearest neighbour and bilinear. Nearest neighbour produces a faster, but lower quality image. Setting a value of 'normal' means nearest neighbour, and 'best' means bilinear. The current setting can be changed from the context menu in the viewer.

Environment mapping

Environment mapping gives the impression of a reflective model. It is achieved by specifying an environment map texture, which is a special pre-distorted image that represents the world that is reflected from the model.

The environment map texture is specified by the environmentMap applet parameter. The amount of environment mapping is controlled by the environmentMapAmount applet parameter. The amount value ranges from 0.0 to 1.0, where 0 represents no environment mapping, and 1 represents full environment mapping (i.e. a fully reflective surface like chrome).

Background image

A background image can be supplied with the model and viewer. This image is downloaded by the applet and displayed as the background to the model. The background image should be a JPEG (or GIF) image of the same width and height as the applet. The name of the background image is specified in the bgImage applet parameter.

For best results the background image should be placed in a JAR or ZIP file (e.g. using WinZip or Sun's jar utility). The JAR or ZIP file should be placed in the same directory as the other model files and the filename should be placed in the archive file list after viewerb.jar. This will ensure that the background image is downloaded without all the model data being downloaded first. Here is an example ...

<applet code="javaRenderer/JavaRenderer.class" codebase="model_files"
        archive="viewerb.jar,background.jar,model.jar,model_0.jar,model_1.jar"
        width=200 height=200>
        <param name="model" value="model.123">
        <param name="bgImage" value="background.jpg">
        ...
        </applet>
TIP:

Instead of creating a separate archive file for the background image you can add it to the existing model JAR file. Open the first model archive file (e.g. model.jar) using WinZip and drag and drop your background image to add it to this archive.

Alternatively, you can specify a plain coloured background using the bgColor parameter.