PDA

View Full Version : Normal Map Filtering



Schnulla
11-19-2011, 09:58 AM
Hi,

what kind of filtering do you use for normal maps?
I always disable stuff like anisotropic filtering but how
do you setup GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER?

I guess bilinear and trilinear filtering are a bad choice
when dealing with normals stored as rgb values, right?

Thanks!

ZbuffeR
11-19-2011, 12:38 PM
trilinear/aniso is not so bad as sharp bump detail will be smoothed, which avoid a lot a aliasing when you have sharp speculars. Might want to widen the specular exponent along as well if you aim for perfection.

I would say test both, rendering side to side on exact same animated scene.

Schnulla
11-19-2011, 02:07 PM
Ok thanks!

aqnuep
11-20-2011, 12:43 PM
Binilear/trilinear filtering is usually used for normal maps as well. Anisotropic filtering may be less useful, though it may provide better results in certain scenarios.

tksuoran
11-21-2011, 03:51 AM
You can and should use filtering with normal maps. But you should take extra care when computing mipmaps for normal maps. For example, you should normalize the normals. NVIDIA*texture tools has a special mode for normal maps. And if you really want to get things more "right", this can be worth reading:

http://blog.selfshadow.com/2011/07/22/specular-showdown/

RealtimeSlave
12-21-2011, 07:00 AM
Wouldn't be the correct way to normalize the normals
in the shader after reading them with texture2D()?

I mean even if they are normalized in the mip maps
the trilinear interpolation between the mip map
levels would produce denormalized normals, right?

Btw how can one normalize the mipmaps when generating
them with glGenerateMipMap in hardware?

Alfonse Reinheart
12-21-2011, 09:55 AM
Wouldn't be the correct way to normalize the normals
in the shader after reading them with texture2D()?

I mean even if they are normalized in the mip maps
the trilinear interpolation between the mip map
levels would produce denormalized normals, right?

You want the data in the texture to be as accurate as possible, so that the filtering won't add too much distortion to it.


Btw how can one normalize the mipmaps when generating
them with glGenerateMipMap in hardware?

You don't. If you need mipmaps generated a special way, you have to generate them yourself.