I know that there are 3 techniques to draw 3D objects: (1) Wireframe Modeling and rendering (2) Additive Modeling (3) Subtractive Modeling

Am I correct?

What formula or algorithm can I use to draw a 3D Sphere?

I am using a low-level library named WinBGIm from colorado university.

For example, how to draw this:

enter image description here

And, this:

enter image description here

  • $\begingroup$ I feel this is a very broad question. What exactly do you want to learn that you can't when using one of said low-level graphic APIs? $\endgroup$
    – David Kuri
    Sep 7, 2015 at 11:56
  • $\begingroup$ @DavidKuri, drawing a 2D geometric primitive (circle or line) in 3D is easy (just need to convert/translate 3D coordinates to 2D coordinates or vice versa). suppose I want to draw a sphere without OpenGL. Where to start from? Just give me a guideline to study. $\endgroup$
    – user464
    Sep 7, 2015 at 11:59
  • $\begingroup$ You mean software rendering? $\endgroup$ Sep 7, 2015 at 12:02
  • $\begingroup$ @ratchetfreak, yes. I need to draw a sphere/ellipsoid/or whatever it is on the screen. Rasterization in 3D. $\endgroup$
    – user464
    Sep 7, 2015 at 12:03
  • 1
    $\begingroup$ Stack Exchange works best when you ask about very specific problems you might encounter in your day to day work/studies. It doesn't work as well for book-length studies. If an answer cannot comfortably fit in the space of a post, it is probably too soon for a Q&A site like this. That is why we close these questions as too broad. $\endgroup$ Sep 11, 2015 at 12:10

1 Answer 1


Scratchapixel has a nice tutorial on writing a basic rasterizer here. Also, you could use the projection algorithm here to get the position of the vertices in screen space, then use Bresenham's algorithm or DDA to draw lines in between. If you want to fill them too you can use scanline (you can find it on Wikipedia).

For ellipsoids, you can either just turn them into a triangle mesh, or the approach here might work, although I haven't tried it.

The Z-Buffer algorithm is very straightforward, just calculate the distance from the point to the camera and store that somewhere for each pixel, then make sure that that's less than whatever was already there.

  • $\begingroup$ Scratchapixel is definitely the best place to learn about that stuff (2D & 3D). They explain rasterisation and also ray-tracing and everything there is to know around 3D techniques (texturing, how to store polygonal objects in memory, etc.). Really cool website and it's free content. $\endgroup$
    – user18490
    Sep 9, 2015 at 21:49