Jump to content
  • Advertisement
Sign in to follow this  
Flashthinker

3D Without Using Vectors or Matrices?

This topic is 4083 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm new to this forum btw. Anyway, I came here to know if you think it is possible to make a game's 3D engine without using vector math or algebra. And the reason why I'm asking this, is because I found a way to do it, and it seems that no one believes me (in some other forum), and I can't seem to find any documentation on my technique. I'd just like to know your thougths on the matter. [Edited by - Flashthinker on May 7, 2007 9:12:40 PM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Nypyren
What is your technique??


Well, it's pretty feasible to make 3D using trigonometry-only when you've got a single axis of rotation that doesn't change. But when you're making a game you need to change the axis of rotation.

Now the problem I had, was that the programing language I was using (ActionScript - Flash's programming language), does not provide any method for either 3D or rotation around a custom axis... So what I did is used trigonometry to make a set of 3D objects; each having a fixed axis of rotation (in their center), then, I remembered something I was told a while ago; That the same face of the moon is always facing the earth (so we only ever see half the moon), because it roates around itself at the same speed as it rotates around the earth... So I thought that I might use that concept with 3D objects, I made it so that if an object rotates around the "camera" from a distance, it will rotate accordingly around its own axis (except it wil be the inverse effect as the moon)... This worked with anything, even the floor...

Here's how it turned out:
My 3D Engine

- I had to reduce the quality of the texture mapping for speed reasons (Flash is was slow for the proper version)

... But in the end, I decided that ground looked too dodgy (texture mapping-wise), so I just used a mode7 engine instead (only for the ground that is):
My 3D Engine

- Oh, and I haven't done any collision testing yet.
[EDIT]Also, this engine's rotation starts to mess-up after a while; I haven't
uploaded the bug-free version yet... Too slack. (The problem had to do with the Mode7 engine not working in conjunction with the real 3D).[/EDIT]

[Edited by - Flashthinker on May 7, 2007 9:50:14 PM]

Share this post


Link to post
Share on other sites
I would believe that its possible, within a limited scope, but also that it's a complete waste of time, for a multitude of reasons, except in the realm of academic speculation.

Furthermore, you're going to need to define in more specific terms what you mean by "trig only." For example, the addition operator is not a trig function, but does using it break the "trig only" restriction?

What about matrices? Matrices, in most of their usages in computer graphics, are just conveniently storing regular old algebraic operations (once you resolve the matrix math); does "unrolling" the matrix math count as not using matrices? And if it's considered cheating, what about rotation, which is a bunch of trig encoded into a matrix?

In short, you need to clarify your constraints, otherwise it's impossible to tell if your proposal is a worthless joke or a mostly-pointless academic fantasy.

Share this post


Link to post
Share on other sites
Quote:
Original post by jpetrie
I would believe that its possible, within a limited scope, but also that it's a complete waste of time, for a multitude of reasons, except in the realm of academic speculation.


Well you're right in that it's a bit slower than vector math, but it also gives me more control for less code, I can deal with angles directly.

[EDIT]No, I haven't used matrices, vectors or algebra for the 3D engine itself. I did use Matrices for the texture mapping *(2D image distortion)* though. What I meant in the question was more of a is it possible without using vectors and matrices than a "is it possible using only trigonometry?"[/EDIT]

[EDIT]I changed the thread's title to avoid confusion.[/EDIT]

[Edited by - Flashthinker on May 7, 2007 9:05:09 PM]

Share this post


Link to post
Share on other sites
Quote:

[EDIT]No, I haven't used matrices, vectors or algebra for the 3D engine itself. I did use Matrices for the texture mapping though. What I meant in the question was more of a is it possible without using vectors and matrices than a "is it possible using only trigonometry?"[/EDIT]

Well, that's what I mean -- in that case, then yes, it is completely possible. Consider translation. You can translate (x,y,z) to (x',y',z') with:

| x y z 1 | * | 1 0 0 dx | = | x' y' z' 1 |
| 0 1 0 dy |
| 0 0 1 dz |
| 0 0 0 1 |

Or by doing:

x' = x + dx
y' = y + dy
z' = z + dz

The former uses matrices, the latter does not. They do the same thing, however, and that "unrolling" process can be applied to any matrix transform. You avoid vector operations by simply not storing the points as "vectors" (it is debatable of course where the line is between "vector" and "3-tuple" in this context). So it's trivially true -- you can't really say that this "doesn't count" because the trig you use to rotate objects is itself an unrolled version of a rotation matrix (or the matrix is a "rolled up" version of the trig; either way it doesn't matter).

The net effect is that, regardless of how you represent and apply the math, it's still the same math, and as long as its the same math, it doesn't matter (as far as correctness goes) how you represent and apply it.

Quote:

but it also gives me more control for less code, I can deal with angles directly.

Not true in general (the former, at least). As for the latter, while you might think this is more ideal now, it would quickly become a chore as you got to particularly complex scenarios. Consider the arbitrary axis-angle rotation matrix produce by OpenGL's glRotatef() function. This matrix (and thus the "unrolled" calculations you'd be doing) becomes excruciatingly ugly to write out if you eschew the vector operations used to generate it.

Share this post


Link to post
Share on other sites
Quote:

Not true in general (the former, at least). As for the latter, while you might think this is more ideal now, it would quickly become a chore as you got to particularly complex scenarios. Consider the arbitrary axis-angle rotation matrix produce by OpenGL's glRotatef() function. This matrix (and thus the "unrolled" calculations you'd be doing) becomes excruciatingly ugly to write out if you eschew the vector operations used to generate it.


I haven't used either of the two methods you showed. I haven't even touched on anything to do with derivatives or algebra.
Also, to rotate the axis of rotation itself, I could just rotate the 3D points multiple times. The first time, I rotate them around the y axis, and the second time, I could rotate them around the x axis by the number of degrees I want, then I could display the 3D object, then reset the x axis rotation and perform the process over again. It would be the equivalent of rotating the axis itself... It is more processor intensive though.

I guess the reason why I chose to make my engine without using vectors or matrices is because, I have to admit, I'm not that experienced with them... I am a self-taught programmer after all; I needed to play it safe and do with what I know well.

Share this post


Link to post
Share on other sites
Quote:

Also, to rotate the axis of rotation itself, I could just rotate the 3D points multiple times. The first time, I rotate them around the y axis, and the second time, I could rotate them around the x axis by the number of degrees I want, then I could display the 3D object, then reset the x axis rotation and perform the process over again. It would be the equivalent of rotating the axis itself... It is more processor intensive though.

But it can gimbal lock much easier. It's also a lot harder to figure out the appropriate sequence of Euler angle rotations (that's what you're basically describing, if I understand you properly) that correspond to one axis-angle rotation in general (especially for weird axes like normalize(0.32,0.111,0.18903).

Quote:

I guess the reason why I chose to make my engine without any any vectors is because I have to admit, I'm not that experienced witht them... I am a self-taught programmer after all; I needed to play it safe and do with what I know well.

Time to learn. I recommend "The Geometry Toolbox" or "Essential Math for Games and Interactive Simulations." Understanding matrices and vectors is critical to doing anything nontrivial in computer graphics. Even if you can work it so you're using only trig... the API is still doing vector stuff underneath, and you need to understand it.

Share this post


Link to post
Share on other sites
You can program a graphics engine without explicitly using matrices and vectors. They just simplify things. You can also use roman numerals instead of arabic numerals when solving math problems by hand.

Share this post


Link to post
Share on other sites
No matter what terminology you use, you'll still be performing the same calculations. jpetrie's two translation examples don't just do the same thing, they are the same thing, mathematically speaking.

Matrices just provide compact notation for linear transformations. You are free and welcome to do things in expanded form, and it will all work just fine, but you can say goodbye to hardware acceleration (SIMD operations and all 3D pipelining).

I recommend you bite the bullet and learn vector algebra. If you're competent with mathematics, it will come easy to you. On the other hand, if you aren't so comfortable with algebra, then you'll never make it along the alternative route.

Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!