Please critique my idea for plotting a point in 3D space on a 2D screen

Started by
70 comments, last by Utwo 20 years, 3 months ago
Ok ok ok. I don''t have a lot of programming experience but I think this might work. I drew visuals too. Really this is all for my own benefit because until I put my ideas down on "paper" but I figured I''d have others take a look as well because frankly I don''t know if I''m even close to being right. I want to be able to define a point in 3D space with x, y, and z coordinates, and then plot it on a 2D screen. I think I have this figured out. Please let me know if I''ve got this wrong. Ok, first, I understand that the cone of vision for the uman eye is 60 degrees. I don''t suppose it really matters what I use for the 3D "camera" though, but I''ll go with 60 degrees just for the hell of it: Alright. First thing I should mention is that the x, y, and z coordinates will be relative to the camera''s point of view. Later if I program any games with this (I have one in mind but I doubt I will finish it, because I never do), I will probably have all the points'' coordinates relative to the game world, and then convert the [i">visible[/i"> points in each from to be relative to the camera to make calculations easier. But for now, I have the field of view devided into 4 quadrantS: Now suppose I plot a point in that field of view: It''s 7 "units" on the z axis away from the camera, 2 units on the x axis to the right, and 2 units high on the y axis. Here''s another visual so you can see what I mean: Now the basic idea here is that I want to know what angles (x and y) exist from the center of the point of view and then determine what percentage of the total 60-degree cone these angles take up. Here''s what I mean: Now here''s a better picture with the useless stuff removed: Knowing that the point is both 7 units away and 2 units high, I can easily figure out that the angle here is 15.9454 degrees. The other angle is also 15.9454 degrees because it has the same measurements, so no need to do the math again this time. This tells me that the 15.9454-degree angle is 26.5756% of the total 60-degree cone. When I apply that percentage to the vertical and horizontal resolution of the display, I find that it equals about 64 and 85 pixels. I have to round because duh you can light a fraction of a pixel. Anyway, so now I know how many pixels away from the center of the screen the point should be, right? And now the finished point: The one thing I did notice that was wrong while typing this is that the cone should probably be 60 degrees wide and 45 degrees tall, since the screen has a 4:3 aspect ratio. This method will probably make everything look a little smooshed. Other than that though it seems it should work. What do you think?
---signature---" Actually, at the time, I didn't give a damn about the FoxNews issue... just that you would come swooping in with your Super Mith cape flapping behind you and debunk it just because it didn't happen in your living room." - InnocuousFox
Advertisement
...



Check out my Forum
My First Space Art (Ever)
My Second Space Art (Ever)
My upcoming space mod for Battlefield: 1942.

Status: 25% Me and a friend are working on it, we are pretty much ready to release in game screenshots.
The Untitled RPG - |||||||||| 40%Free Music for your gamesOriginal post by capn_midnight 23yrold, is your ass burning from all the kissing it is recieving?
wow! 0.o
i h8 u guys

Just kidding I don''t. But damn I looked at the thread listings and thought I had 2 replies.
---signature---" Actually, at the time, I didn't give a damn about the FoxNews issue... just that you would come swooping in with your Super Mith cape flapping behind you and debunk it just because it didn't happen in your living room." - InnocuousFox
I actually like it.(Ignore my 0.o) I''d like to see it teted out.
Cool I''ll give it a try when I get home. I don''t know why I always insist on getting an "ok" on my plans without first trying them out myself. It''s not like I mind committing the time to program. :-p

Thanks for the feedback.
---signature---" Actually, at the time, I didn't give a damn about the FoxNews issue... just that you would come swooping in with your Super Mith cape flapping behind you and debunk it just because it didn't happen in your living room." - InnocuousFox
It seems to be correct (didn''t check it personally), but I think it''s a waste of time, you are trying to reinvent the wheel. There is already a whole theory of 3d graphics, projection and rendering, far more advanced than what you could achieve by your own. I think it''s wiser to use what is already there and tested, and work from that point, so your effort is productive.

Besides, using trigonometric calculations like tangent is always slower than matrices.

And even if you code a program to project points in 2d screens, there is still a long road to walk, like rendering polygons, backface culling, texturing, z-buffer.. do you want to go through all that pain just to get to the same point you could be just by reading a couple tutorials?
-----DevZing Blog (in Spanish)
The concept is sound, as I implemented it in a cheap QBASIC shape renderer awhile back.
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
No of course not, but it's just a fun little challenge I set up for myself. I don't intend to build all of my future 3D programming upon this concept. Just a personal enrichment sort of thing.

The concept is sound, as I implemented it in a cheap QBASIC shape renderer awhile back.

Oh cool! Thanks for letting me know!

[edited by - utwo on January 4, 2004 10:03:15 PM]
---signature---" Actually, at the time, I didn't give a damn about the FoxNews issue... just that you would come swooping in with your Super Mith cape flapping behind you and debunk it just because it didn't happen in your living room." - InnocuousFox
quote:
It seems to be correct (didn''t check it personally), but I think it''s a waste of time, you are trying to reinvent the wheel. There is already a whole theory of 3d graphics, projection and rendering, far more advanced than what you could achieve by your own. I think it''s wiser to use what is already there and tested, and work from that point, so your effort is productive.

Besides, using trigonometric calculations like tangent is always slower than matrices.

And even if you code a program to project points in 2d screens, there is still a long road to walk, like rendering polygons, backface culling, texturing, z-buffer.. do you want to go through all that pain just to get to the same point you could be just by reading a couple tutorials?



And i don'' think its very wise to put down a new idea.

This topic is closed to new replies.

Advertisement