the Fiddler's picture

[Solved] Dark artifacts with detail textures

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.

Inline Images
No artifacts without detail texture

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Snorkel's picture

I see the artifacts in the first picture but I can't see the detail texture ?
You can force the lower mipmaps to test if they are darker. In hlsl this command is tex2dlod.
Btw most games fadeout the detail maps in the distance.

the Fiddler's picture

Thanks, it seems that the two highest mips were too dark after all. I fixed that by trying different options in the DDS plugin for GIMP (insert bounding box + bicubic seems to work well).

The screenshots above are medium-to-high distance in order to show the issue, which is why the detail texture isn't visible. Close up and the the detail texture really helps, even though the base textures are 2048*2048.