Away3d 2.2 is now released! So it is time to start dipping into the new features available, and demo some of what’s on offer.
One of the biggest new features in 2.2 is triangle caching. This is a way to speed up scenes with static cameras, and (some) static content. The demo above shows how Away3d can now handle around 50,000 polys rendered to screen without too much hassle, while maintaining interactivity and framerate. This is accomplished by automatically detecting when a triangle mesh require redrawing, and skipping that step when it isn’t required.
You can view the turtles from any angle, but in order to maintain framerates while moving around, a wireframe model is swapped in from the point the camera starts moving. Once things are static again, triangle caching automatically kicks in. The beauty of this feature is that it will work on your existing Away3d applications without any modifications – if triangle caching can be employed, Away3d will use it!
Source code is available here, or in the right-click menu of the demo. The use of ownCanvas in the source is something to note – it essentially allows boundaries to be defined for different areas of caching in a scene. When an object has it’s own drawing canvas with ownCanvas enabled, it has it’s own caching routine that updates separately to other areas of the scene. So if you have a definite separation between objects that are static and objects that move (or in this case have their materials updated), enabling ownCanvas on a moving object will ensure only that container has a redraw triggered, allowing the rest of the scene to remain cached and keeping framerates high.
More demos of the new features of Away3d 2.2 should be arriving here soon. In the meantime, check out the latest svn source or visit the Away3d downloads page for zip files.