[ This chapter does not appear in the book. ]
This chapter explains how to build a bending coloured block, using the M3G SkinnedMesh class. SkinnedMesh has a 'skin' and 'skeleton' - as the skeleton moves, the skin goes with it.
The other topic of this chapter is how to create an interesting landscape, by improving the texturing of the ground, adding trees, and animating the sky.
The Floor class, used in the preceding chapters, is replaced by TiledFloor, which tiles a texture over the surface, making the ground appear more detailed.
Trees are included in the scene, not implemented with 3D models, but as 2D images drawn on flat screens (billboards), which always stay oriented towards the camera. This orientation means that the tree images are visible from every angle, supporting the illusion of 3D solidity. I use M3G's Sprite3D class for some of the trees, but also utilizes my own Billboard class. Billboard employs a partially transparent mesh and camera alignment, techniques that we'll need (and extend) in M3G chapter 5.
The MobileCamera class from M3G chapter 3 (with some minor changes) moves the camera. As the camera changes position and orientation, the background (a blue sky with clouds) also moves. The background is controlled through a MobileBackground class.
The images on this page are screenshots of the application taken at different times, from different camera angles.
The block uses vertex colouring: the vertices in its base are red, the middle ones are green, and the ones in its top are blue. The bending is achieved through rotations around the block's z-axis; one rotation point is in the block's base, the other in its middle. I'll go into the details later.
The two screenshots show that the five 2D tree images keep facing the camera, even after the camera has been moved. Also, the cloudy sky background is different between the two shots. The ground (a tiled 'grass' image) is more detailed than the grass surface used in M3G chapters 2 and 3.
Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to my home page