- #1

- 6

- 0

## Main Question or Discussion Point

Hi everyone, this is my first post on this forum.

Anyway, I was hoping that you might be able to solve a problem I've encountered while programming a vector-based 3D engine in Flash. Here's an example of what I made with it:

http://jongro.phpnet.us/space.html" [Broken] - It might look like it's working fine, but there is a limitation...

Basically, the API I made takes arrays of 3D planes which are grouped into Building Blocks (a series of planes grouped together to form a 3D basic shape)... Then each of these building blocks is assembled into a final 3D object which you should be able to see in the link above.

Now, you don't really need to worry about the structure, but it might help you find a solution. In any case, each plane has exactly 4 3D points (x, y, z) and, using these 3D points, I need to find a way to arrange the planes in 3D space from front to back. *EDIT* to make a triangular shape, I just set two of the points to the same coordinates... And yes, I know this causes problems with my current z-sorting algorithm*/EDIT*

The way I've done it is took the average z-value of every point in each plane which gave me the "z-index center point" of each plane at any time and I used this number to sort the planes from greatest to least... And display them on the screen accordingly.

Now The problem with this is that It allows very little flexibility in the design of my 3D objects. Take this for http://jongro.phpnet.us/3ddddd.gif" [Broken] (they won't make a great deal of sense as they are, but you'll get the drift).

From looking at the diagram we can tell that the semi-transparent square-plane will be in front of the other one... But the problem is that, in some cases, the average z-index will not accurately tell which plane is in front.

Another problem is that, due to the limited processing power of the programming language I am using (ActionScript 3.0), I cannot have it do a per-pixel z-sorting... Instead I have to find a way to make the z-sorting work using Vector physics or other mathematical concepts.

Also, it might be processor intensive if I were to do comparative-checking, but if you've got a good way of doing it, please share.

That being said, I would rather have a system where every plane generates a value which will automatically place it in the correct position if sorted numerically against other planes.

Is there a way to do this, please share your ideas on this, thanks.

P.S. Please avoid using mathematical terms or if you do, tell me what they represent because I'm not much of a mathematician or physicist.

Anyway, I was hoping that you might be able to solve a problem I've encountered while programming a vector-based 3D engine in Flash. Here's an example of what I made with it:

http://jongro.phpnet.us/space.html" [Broken] - It might look like it's working fine, but there is a limitation...

Basically, the API I made takes arrays of 3D planes which are grouped into Building Blocks (a series of planes grouped together to form a 3D basic shape)... Then each of these building blocks is assembled into a final 3D object which you should be able to see in the link above.

Now, you don't really need to worry about the structure, but it might help you find a solution. In any case, each plane has exactly 4 3D points (x, y, z) and, using these 3D points, I need to find a way to arrange the planes in 3D space from front to back. *EDIT* to make a triangular shape, I just set two of the points to the same coordinates... And yes, I know this causes problems with my current z-sorting algorithm*/EDIT*

The way I've done it is took the average z-value of every point in each plane which gave me the "z-index center point" of each plane at any time and I used this number to sort the planes from greatest to least... And display them on the screen accordingly.

Now The problem with this is that It allows very little flexibility in the design of my 3D objects. Take this for http://jongro.phpnet.us/3ddddd.gif" [Broken] (they won't make a great deal of sense as they are, but you'll get the drift).

From looking at the diagram we can tell that the semi-transparent square-plane will be in front of the other one... But the problem is that, in some cases, the average z-index will not accurately tell which plane is in front.

Another problem is that, due to the limited processing power of the programming language I am using (ActionScript 3.0), I cannot have it do a per-pixel z-sorting... Instead I have to find a way to make the z-sorting work using Vector physics or other mathematical concepts.

Also, it might be processor intensive if I were to do comparative-checking, but if you've got a good way of doing it, please share.

That being said, I would rather have a system where every plane generates a value which will automatically place it in the correct position if sorted numerically against other planes.

Is there a way to do this, please share your ideas on this, thanks.

P.S. Please avoid using mathematical terms or if you do, tell me what they represent because I'm not much of a mathematician or physicist.

Last edited by a moderator: