1

I was wondering what procedure a simple 3d program uses to draw 2d pixels so that they appear 3d. I'm really interested in this for drawing purposes since if a program can figure out how to use a flat screen to produce images with depth then maybe I could use those techniques in my drawing.

Are there any basic 3d engine out there I can look at? Without any 2d to 3d abstractions?

tshepang
  • 12,111
  • 21
  • 91
  • 136

1 Answers1

0

Two notions may interest you:

  • The perspective projection, which is the mathematical transformation which takes 3D points (or vertices) and the characteristics of your camera (position, orientation, frustrum, ...) and gives you the 2D projection of the point on your chosen medium (screen).

  • The Painter's algorithm (since you seem to ask for drawing-related techniques), a rendering method which sorts by depth all the elements of your scene after their projection, and draws them on your medium by decreasing depth, to ensure a realistic output ("far objects hidden behind closer ones" - imitating painters method). This algorithm has however some limits (far from efficient in its basic implementation, can't easily deal with elements intersecting or circularly overlapping each others), so most of the days a more efficient method is used, the Z-buffering, which deals with depth conflicts on a pixel-to-pixel basis.

By combining those notions, you can actually implement your own simple 3D engine (in the other StackOverflow thread I'm pointing, I gave a link to an article I made about creating such an engine easily).

If you want to look at more complex engines and notions, you can take a look at the GPU Gems 3 by Nvidia for instance, or look at articles about OpenGL.

Hope it helped, bye !

Community
  • 1
  • 1
benjaminplanche
  • 14,689
  • 5
  • 57
  • 69