Well, your first optimisation is very simple - render only one hemisphere.
You view only one hemisphere when looking at a sphere, the other one is
Next, calculate the texture coordinates in-advance and store them somewhere,
the same for the coordinates of the vertices. There is an article on
texture-mapping a sphere over at Paul Bourke's (highly recommended)
Current graphics-cards use Phong shading to calculate colour for each
vertex. However, most of them do not do it per-pixel but rather per-vertex.
When rendering a sphere this doesn't pose a serious problem, if your
geometric resolution is decent. A resolution of 36x36 seems good enough at
medium screen resolution and considering you only rendering half of the
sphere, that's about a 1000 polygons for each object. If the spheres only
occupy small part of the frame-buffer you can lower the resolution with
little or none visual quality loss. You can use connected geometric
primitives such as triangle-strips very easily here, this allows you to
lower the stress on the geometry-related part of the pipeline.
If you are really desperate and must optimize and your scene lights are
static, you can pre-calculate luminance/colour value for each vertex. This
gives you substantial speed increase as there are no lighting calculations
in real-time and you can program your own shaders.
Regarding environment maps, remember they are not supposed to be accurate
but look good. Just use the regular multi-texturing and alter the texture
matrix (I know it exists in OpenGL, don't know about other APIs).
There was a very recent OpenGL Challenge entry that displayed
procedurally-textured spheres very nicely, you might want to check it out
or/and contact its author. The OpenGL challenge can be found at:
Just my two cents,
> Hi There,
> I am (also) looking for information on how to render as near as damn it
> perfect spheres and texture map them. I know it's a lot to ask, but I am
> aiming high to try and achieve the best results:
> I want to be able to texture map a sphere with a pattern, give it
> shading - close to phong would be nice! - so there is one or more specular
> highlights and possibly environment map a reflection into/onto it.
> And now here's the crunch. I'd like to be able to render as many as 20
> spheres realtime, very, very quickly, as quick as possible as there is
> other triangle based rendering to be performed at the same time.
> If anyone has information on very very fast algo's to phong shade or
> procedurally texture spheres, create highlights or quickly environment map
> sphere, I would be very grateful.
> Thanks a bunch
> p.s. any help on fast shadow algorithms would be appreciated too, see my
> other post!
> p.p.s remove nospam for direct replies.