What is the best way to render 3D without a library?

Let's say I want to create a 3D environment from scratch, without any sort of library. My instinct is to create a 3D matrix (a vector, since I'm using AS3) and then manipulate objects' and cameras' positions in the matrix. Then I would calculate the position of the active camera and how much of the matrix it should be able to see, and render those parts of the matrix (the objects) into view.

I would, of course, have a separate matrix holding object positions for efficient access.

Is this efficient? Will the processor be able to handle these calculations in a single-threaded AS3 application? If not, what is a better method?

Answers


In Actionscript3 there are some basic 3D objects like Matrix3D, Vector3D, TriangleCulling, Utils3D, GraphicsTrianglePath. These objects are optimized but please don't expect wonders. I've looked into my own Engine and I can render a model with 700 faces with 20-30 fps.

A better (faster) way would be to use the GPU accelerated methods in AS3: Stage3D, Context3D. These objects are more abstracted and it's like programming OpenGL or DirectX.

So if you want to learn how 3D engines work under the hood go with option 1. Else go with option 2 or WebGL.


Need Your Help

Voice command for android music player app

android voice-recognition audio-player android-music-player

I am working on an android music player and I wanna have hand-free voice commands,i.e., don't need to press any button to start recording. the app should keep listening all the time. Is there a way ?

CSS rotation in IE is "jittery"

css css3 internet-explorer

I created a CSS3 animation that works as intended, but on Internet Explorer the rotation is very jittery.