santisan
santisan

Reputation: 149

Color banding artifacts with RGBA8

My 3d application has color banding artifacts when rendering to RGBA8 render targets. How can I get rid of them (without having to render to buffers with greater precision) ?

UPDATE

The rendering process is basically:
1) Render the geometry to a texture
2) Apply a fullscreen post-processing step (contrast, brightness, saturation, tone mapping and gamma correction)

Here are two screenshots, one using a rgba8 target and the other using a rgba16f target. Both rendered with the post-processing step disabled. As you can see there are banding artifacts in the rgba8 render.

screenshots comparison: rgba8 - rgba16f

The geometry consists of three deformed planes, which are drawn with the following shader and additive blending enabled:

float4 PlaneFP(VSOutput In) {
    float3 normal = normalize(In.WorldNormal);
    float3 eyeDirection = normalize(In.WorldPosition - scene.EyePosition.xyz);        
    float falloff = 1.0f - saturate(dot(normal, -eyeDirection));
    falloff = pow(falloff, 4.0f);        
    return float4(MaterialDiffuse * falloff, 1.0f);
}

If I enable the post-processing steps the banding artifacts are much more noticeable. The banding disappears when using rgba16f, but I'm developing this app for the PS3 and it can't handle MSAA with floating point targets.

Upvotes: 0

Views: 1816

Answers (1)

Sniggerfardimungus
Sniggerfardimungus

Reputation: 11782

If you're seeing banding, then at some point in your rendering pipeline, the precision of one of your calculations is not as high-precision as you think it is.

For example, you might have 32-bit textures, 32-bit color for light sources, etc., but if your computation of diffuse reflection has made a tradeoff of bit depth for speed, then you'll see mach banding along diffusely-lit surfaces.

Have you at least narrowed down the source of the banding (by switching to individual light sources at a time, replacing textures with a diffuse color, removing specular reflection, etc.?) With what you've given us, there's little that can be done to help. Some screen captures would be at least a little help.

Upvotes: 0

Related Questions