Billy ONeal
Billy ONeal

Reputation: 106549

Why might I see this OpenGL spherical mapping artifact in GLSL?

Globe Artifact

I'm trying to map a globe texture onto a sphere. I'm using a plate carrée (Equirectangular) map projection, and there's this meridian which has this "blurring". What's strange is that the blurring isn't around a singularity in my texture (which occurs right down the pacific ocean in this example). Instead, the defect occurs around the (s,t) = (0.5, ?) point.

Have I done something really stupid?

EDIT: And to prove the model's not strange, here's the same thing on a teapot:

Teapot Artifact

Upvotes: 2

Views: 2392

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473457

You cannot generate texture coordinates like that.

The problem is that really quite simple. At 359 degrees, the S texture coordinate will be something like 0.95 or so. Close to 1.0, but not equal to 1.0. At 0 degrees, which physically is a position directly adjacent to the last position, the texture coordinate will be 0.0. So you will interpolate between 0.95 and 0.0. It doesn't go around the other way.

This is one of the many reasons why cubemaps exist. You can't get around this problem without either cubemaps or changing the topology of your mesh.

Upvotes: 6

Related Questions