What can cause banding textures in OpenGL?

387 views Asked by At

I recently rewrote the lighting engine in a project I've been working on and noticed that I am getting banding on textures, and only in one direction per face.

The lighting engine is now deferred rendering, so it is composed of 3 textures processed as scene data. Could this be the cause of the texture banding?

Here is a screenshot: Banding texture

It only seems to occur where the lighting is close.

If it helps, my 3 textures are in the following formats:

World fragment position: GL_RGBA16F - GL_FLOAT
World normal direction: GL_RGBA16F - GL_FLOAT
Fragment diffuse texture: GL_RGBA - GL_UNSIGNED_INT
1

There are 1 answers

0
Nathan Wride On BEST ANSWER

Thanks to ratchet freak and Andon M. Coleman.

Ratchet freak pointed out that it was probably a rounding error in the angle at which the light hits the surface (leading to a low dot product between normal and direction).

The cause was that the internal format of the normal direction texture was set to GL_RGBA16F - 16 bit floats which caused the rounding. Setting the format to GL_RGBA32F fixed the rounding by holding 32 bit floats.

Andon M. Coleman pointed out that I should stop using GL_RGBA as an internal format because it is ambiguous and that GL_RGBA8 was appropriate