Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


Preparing Textures to Reduce Shimmering


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Endemoniada   Members   -  Reputation: 312

Like
0Likes
Like

Posted 17 April 2014 - 07:16 PM

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.

 



Sponsor:

#2 Promit   Moderators   -  Reputation: 7333

Like
0Likes
Like

Posted 17 April 2014 - 08:11 PM

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.



#3 MJP   Moderators   -  Reputation: 11567

Like
1Likes
Like

Posted 17 April 2014 - 11:06 PM

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. 



#4 Hodgman   Moderators   -  Reputation: 30882

Like
1Likes
Like

Posted 18 April 2014 - 01:16 AM

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.

#5 Endemoniada   Members   -  Reputation: 312

Like
0Likes
Like

Posted 19 April 2014 - 10:12 AM

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.



#6 lipsryme   Members   -  Reputation: 1030

Like
0Likes
Like

Posted 19 April 2014 - 01:00 PM

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


Edited by lipsryme, 19 April 2014 - 01:08 PM.


#7 Digitalfragment   Members   -  Reputation: 864

Like
0Likes
Like

Posted 24 April 2014 - 06:13 PM

 

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS