PDA

View Full Version : Textured sphere rotation



starman
01-22-2004, 07:14 AM
I've searched far and near on this forum and others and can't find an anwser to my query. Perhaps I'm asking the wrong questions.

I have textured a gluSphere with a mercator map of the planet Mercury. It's lit and has material applied (low ambient, high diffuse, no specular or emission). The light source has similar properties. I rotate a camera slowly around the sphere to give the viewer the effect of orbiting Mercury.

I'm happy with the lighting, but one thing that bothers me is that as it rotates, the texture appears to be "sparkling" in certain, more complex regions of the map. I've tried using fog to hide this to no avail. I've twiddled with the light, texture, and material properties to no avail.

I'm sure that I haven't given enough information here, but I'm hoping that this effect I'm seeing is common and someone will be able to help just from this description. I'd post code, but it's subdivided across several classes in a medium sized project. Please let me know any other pieces of information that would be helpful.

dorbie
01-22-2004, 12:12 PM
You need to modify the texture filtering.

Using glTexParameter make the minification filter GL_LINEAR_MIPMAP_LINEAR and make sure you load all the levels of MIP image, or use glubuild2DMipMaps to load your texture image.

starman
01-22-2004, 02:21 PM
That was it...thanks! Could it have been the mag filter? It also works without using mipmaps but by specifying GL_LINEAR as my min and mag filters and using glTexImage2d(). This is a single texture stretched over a lot of polys (a gluSphere).

Anyway, thanks a lot. This has been puzzling me for a while. Time to finally learn how texture mapping works.

dorbie
01-22-2004, 02:34 PM
Magfilter helps too but generally this replaces tiling when you're zoomed into a texture with a smooth blurred effect, it will stop texture aliasing (your problem)especially when the texture is close to 1:1 or larger on screen probably up to 2:1 before you really notice the discrete tiles depending on projection etc.

Linear will definitely help the minfilter, the issue is really the degree of minification. A linear filter will be better under minification than a nearest filter, but under extreme minification it will start to alias again. So then you will need MIP mapping to counter the new artifacts, MIP mapping is also usually faster under heavy minification thanks to the better behaved texture cache and data access pattern.

But hey, whatever works.

[This message has been edited by dorbie (edited 01-22-2004).]

starman
01-22-2004, 02:45 PM
I actually went with the mipmap solution, but tried just the linear filters first (because it was quick and easy!). What's the best treatment of the subject in your opinion? The Red Book?