Home  Part 1 

3D Graphics using Java

Part 2 - Texture Mapping

The applets on this page demonstrate texture mapping. From left to right:- non-perspective correct texture mapping without lighting, non-perspective correct with lighting, perspective correct with lighting. The non-perspective applets use a simple but fast affine algorithm, whereas the perspective correct applet uses the widely published z-divide method. The difference in rendering quality between perspective and non-perspective mappings is most evident on large polygons where there is a significant change in z (depth). However, you should be able to see by looking at the static images below that the checkerboard texture of the left and center images looks slightly skewed where the right hand image does not.

This cube features 24 vertices instead of the regular 8 due to the fact that the texture coordinates will vary depending on which face the vertex is being used on. Each vertex is therefore repeated three times, each time with different texture coordinates. This also prevents the cube from becoming rounded by the Gouraud algorithm, i.e. there are definite edges between faces.


Launch
Applet
 
Launch
Applet
 
Launch
Applet