We have already seen some tips and tricks regarding materials between the lines. But there are a few others left that are worth mentioning.
When developing for the web, file size is always something to keep in mind. Using a lot of textures with Papervision3D can soon result in a big download. Any savings that keep the file size as low as possible should be taken into consideration—especially when you're working on larger projects.
A smart technique often used in 3D is texture tiling. It repeats the texture in a horizontal and vertical direction, creating a new, larger texture out of this.
The code described below demonstrates how this works. For this example, we use a bitmap file material having a size of 128 by 128 pixels and we create a plane of 1024 by 512 units. The loaded image will be tiled 8 times horizontally and 4 times vertically.
First we can just instantiate BitmapFileMaterial
as you would do this normally.
private function init():void { var material:BitmapFileMaterial...