Jump to content
  • Advertisement
Sign in to follow this  

converting 3D space to 2D screen

This topic is 4296 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

Gday! Im a little stuck right now... In my game engine, the characters move around in 3d space (ie. 3 axes); however, Im using a 2D API (SDL) to draw stuff... so im a little stuck. The idea is to have a camera that either sees a rectangular prism of the 3d space, or is like a real camera where it sees a cone of the world, getting smaller as it gets closer to the lens. The latter would be better, but also seems harder. The problem is that I have very little idea as to how to display the things on the screen (assuming an oblique angle, diagonal-down). Does anyone know of an article that can explain how to do this, or is willing to explain it to me? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Silvo
The idea is to have a camera that either sees a rectangular prism of the 3d space


Orthographic projection.

Quote:
or is like a real camera where it sees a cone of the world, getting smaller as it gets closer to the lens.


Perspective projection (the whole article is relevant).

Quote:
The latter would be better, but also seems harder.


The principle is the same, the matrices are different. The perspective projection matrix is a bit harder to compute, but with the formulas, it's still straightforward.

Knowledge of linear algebra helps. If you need more help, we probably have articles lying around on the topic in the reference section.

Share this post


Link to post
Share on other sites
my site has code for exactly what you describe (2d points on a 3d plane) with rotation too.

It's pure SDL, no opengl:
mutedvision.net

click on the donut (toroid) project one.

NOTE: This is my code. Source is free to use and very well commented, however, mention me in a project if you use stuff directly and it helps. I won't claim that this is well programmed, I did it in my first semester of university and have learned a lot in the 3 years since then.

Good luck.

Source is in QBasic or C++ take your pick... Yes, I am a masochist.

Share this post


Link to post
Share on other sites
Thanks for the link! Im about to have at it now. The wikipedia articles are very confusing and a little beyond me ('little' used loosely). I did find some article in the gamedev reference archive, google search helps when you know what to search for...

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!