Preparing Textures to Reduce Shimmering

Started by
5 comments, last by Digitalfragment 9 years, 12 months ago

Hey guys,

I was wondering if there are some tried and true methods for preparing textures to reduce shimmering. Even with mipmaps and filtering I get some shimmering, mostly with high contrast textures that are viewed from the side.

I'm pretty sure it's the high frequency pixels causing the problem and I can do low pass filtering to minimize it, but all I can think of in Photoshop is either gaussian blur or reduce noise. Maybe there is a better way, or some guidelines to go by.

Thanks.

Advertisement

Are you using generated mipmaps or authored ones? Often, people will alter the mip levels by hand to cut back on shimmering. Also you might try trilinear filtering, if you're using bilinear with mipmaps. That causes the hardware to filter across levels, rather than choosing a level and only filtering within it.

After that, there are the extreme answers but they probably don't apply here.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Are you talking about shimmering from specular, or from the colors in the texture itself? If it's the former, you should read the link Promit provided and perhaps also check out this thread where we were discussing the same topic. If it's the later, then you can probably address it by prefiltering the mips differently. Filtering out higher frequencies will reduce aliasing, but will also remove high-frequency details from the texture. Certain filter kernels can counteract this somewhat by adding a "sharpening" effect due to their negative lobes.

In theory you really shouldn't get any aliasing from a "standard" mip chain and trilinear filtering, but GPU's tend to play a little loose with their filtering quality in order to boost performance. You can actually adjust manually on some GPU's in the driver control panel.

The way that you generate your mipmaps also has an impact. Standard mipmapping should completely eliminate texture shimmering, at the cost of blurring details. Some art is configure to use a filter other than bilinear durin generation in order to preserve details a bit more.

Thanks for the info guys. I'm getting the shimmering from the texture itself. An extreme example would be a texture with a black background and white gridlines. For a texture like that I'd have to drop the levels so the white becomes grey (say 0.5 instead of 1.0) and gaussian blur it, I can also make sure the gridlines aren't too thin. Even after doing that I'd still get some shimmering.

I switched to trilinear by doing this:

d3d_device->SetSamplerState(0,D3DSAMP_MINFILTER,D3DTEXF_LINEAR);
d3d_device->SetSamplerState(0,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR);
d3d_device->SetSamplerState(0,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR);

...and it made a pretty big difference, but some lines still wink in and out a little.

I'm making my mips like this:

d3d_device->CreateTexture(width,height,0,D3DUSAGE_AUTOGENMIPMAP|D3DUSAGE_DYNAMIC,D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT,&texture,NULL);

texture->GenerateMipSubLevels();

Am I on the right track using gaussian blur to prefilter ? Is there another filter that will eliminate only the high frequencies, so it won't blur everything ?

Thanks again.

Someone correct me if I'm wrong but the auto-generated API function applies a simple box filter (aka just averaging neighboring pixels).

Not sure if I understood it correct but do you generate them using the api call and then try to apply a gaussian filter on them ? Because you shouldn't do that tongue.png

I remember Mitchell (which is a specialized kind of cubic filter afaik) being a fairly good filter for mipmaps.

If you create your textures using photoshop you can set the mip filter using the nvidia dds tool.

I also remember Jimenez having a grid sample for his SMAA (Subpixel-Morphological-Anti-Aliasing) solution, so you could look into this kind of AA if nothing else helps.

http://www.iryoku.com/smaa/downloads/SMAA-DX10-v2.8.exe

Is there another filter that will eliminate only the high frequencies, so it won't blur everything ?

There's also anisotropic filtering, which helps when looking at surfaces from sharp angles.

This topic is closed to new replies.

Advertisement