Compute bounding quad of a sphere with vertex shader

I found a paper that describes what you need - calculating the bounding quadric. See:

http://web4.cs.ucl.ac.uk/staff/t.weyrich/projects/quadrics/pbg06.pdf

Section 3.2, Bounding Box calculation. The paper also mentions doing it on the vertex shader, so it might be what you're after.

Some personal thought:

You can approximate the bounding box by approximating the size of the sphere by its radius, though. Transform that to screen space and you'll get a slightly larger than correct bounding box, but it won't be that far off. This fails when the camera is too close to the point, or when the sphere it too large, of course. But otherwise should be quite optimal to calculate, as it would be simply a ratio between two similar, right triangles.

If you can figure out the chord length, then the ratio will yield the precise answer, but that's a little beyond me at the moment.

alt text http://xavierho.com/temp/Sphere-Screen-Space.png

Of course, that's just a rough approximation, and has a large error sometimes, but it would get things going quickly, easy.

Otherwise, see paper linked above and use the correct way. =]