I recently implemented detail textures for an extra boost in visuals, but I'm seeing a strange artifact I cannot pinpoint the cause of. The detail texture is a simple high-frequency grayscale image, stored in the A channel of a DDS texture. While rendering, this texture modulates the underlying color, like so:
#if DETAIL_TEXTURE // Multiply texcoords by a non-integer value to reduce tiling artifacts. // Average luminance of the detail texture should be 50% to avoid // over-darkening or over-brightening the scene. vec4 detail = texture2D(MapDetailBump, 143.6 * TexCoords0.st); color.rgb *= 2.0 * detail.a; #endif
Unfortunately, this results in some very visible "darkening" artifacts in areas that lie at grazing angles to the camera.
My best guess so far is that higher mipmaps somehow become darker than lower ones. Indeed, disabling mipmapping fixes the issue, but introduces unacceptable sparkling.
Any suggestions? I am creating the DDS files through GIMP as I'm not aware of any other DDS-capable image editor that runs on Linux.