Superfast 3D Scene Without 3D Engine

Based on my previous post about z-sorting indices, I have created a superfast 3DDM version using drawTriangles(). The following example renders 100×100 segments = 10201 vertices = 20000 triangles (faces) per frame. Just to imagine how much that is, see the main image fullsize. There is no 3D engine used at all, everything is handled by native flash classes and functions. Z-sorting is not calculated on every frame (however it could be, because the sort algorythm is pretty fast), but it is pre-cached for some rotation. Feel free to run the example in new window in order to see the real speed (there is more flash content around here on my blog template). I can go up to 12 fps with the best flash quality for the first image in demo, how much can you?

Read the rest of this entry »

Z-sorting Indices For drawTriangles()

While constantly improving 3DDM (drawTriangles() version soon to be released), I was looking for the fastest possible solution to render simple 3D object. It soon appeared to be drawTriangles() – the native ActionScript 3 method, that let you make illusion of 3D object based on deforming your texture. In fact native ActionScript contains a lot of useful and fast classes to work with 3D like: Utils3D, Vector3D, Matrix3D, PerspectiveProjection… so you do not need to create your own basic 3D engine tools. One thing that it does not contain is z-sorting. Z-sorting is very tricky job, that is why modern 3D engines let you decide which sorting method to use with your scenes (faster vs. precise). For my needs it is enough to use simpliest z-sort possible, based on projected max z coordinate of face (3 vertices).

Before continue reading, make sure you understand the basics of Using triangles for 3D effects, Transforming bitmaps, UV mapping and Culling. Everything is very good described by Adobe.

Read the rest of this entry »