software rasterizer for 3d pool/billiard balls

software rasterizer for 3d pool/billiard balls

Post by chrisweave » Thu, 08 Sep 2005 08:05:14


I need to write a simple 3d pool/billiard simulaton using software only
rendering. I've already got a triangle scanline renderer but I don't
want to render the balls using polygons! Instead I need a fast way to
render them either by blitting directly to screen space or some other
method without tessalating them.

The problem I'm having is because perspective effects would normally be
visible if the balls were rendered using triangle meshes (in the same
way as the pool table) unless the balls were directly in the centre of
the screen, and not too close to the camera. However, simply blitting a
pre-rendered circle or perfect sphere around the balls centre point
does not give the same perspective effect, and is not quite correct.

How do other pool games do this (other than using meshes) and maintain
consistency with perspective distortion?

(I read some reviews of commercial billiard games and they rave about
the balls being perfectly round, surley you can't do that unless its an
orthographic perspective transform, which there clearly not.)


software rasterizer for 3d pool/billiard balls

Post by chrisweave » Sat, 10 Sep 2005 00:36:01

Thanks Andy, that article looks usefull but it seems to only work for
parallel projected (without perspective) spheres, correct me if I'm

I can use something like this but how can I 'control' the amount of
perspective a that you would ever see on the balls, so that a ball
drawn perfectly round like this would still look correct in the rest of
the perspective projected world (the billiard table).

I guess I need to limit how close the camera can zoom into any ball and
its field of view, but is there a way to do this other than guesswork.

Don't molecular simulations do something similar where there are
thousands of spheres, to many to use triangles but perspective has to
be correct?



software rasterizer for 3d pool/billiard balls

Post by tekto » Sat, 10 Sep 2005 12:36:32

Hans Kopp wrote an article titled - "Fast Texture Mapping Of Spheres",
you could try googling for it, or you could try downloading the XBLite
archive ( ), as it has both the article
and source code in basic if that helps (look in \demo\gui\spheres\).

Regards - Andy

software rasterizer for 3d pool/billiard balls

Post by Just d' FA » Sat, 10 Sep 2005 16:20:24

The projection of a sphere is always a conic, and usually an ellipse.
However, rarely will anyone object to the substitution of a circle for
the "correct" projection, especially in a large molecular model. What
*is* important is the occlusion relationships, nearer objects blocking
the view of farther objects.