Jump to content
  • Advertisement
Sign in to follow this  
Andrew Kabakwu

OpenGL Texture parameter for Normal maps

This topic is 2806 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,
I've added normal maps to the opengl engine I've been writing.
However, am not sure about the parameters to use when creating the texture object for the normal map.

As the normal map contains the normals, I believe I don't want to perform any filtering on the values read from the texture.

What is the right combination of glTexParameter calls for normal maps?

Am using the following -
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

How do you setup your texture objects that are normal maps?

thanks

Share this post


Link to post
Share on other sites
Advertisement
You should be able to both filter and mip them the same as anything else. They're just RGB textures after all and the math works given you should be normalising your final normal in the PS anyway.

A math-head might give a reason why this isn't technically accurate (or he might not), but if that's the case they still look ok to me tbh.

You could run into issues compressing them, but a google search will show you how to handle that. For now, don't compress em.

Share this post


Link to post
Share on other sites
When you're mipmapping you'll need to renormalize each RGB triplet in each miplevel otherwise you might get slight artefacts, but otherwise there's no reason not to mip them.

Obviously, doing your own mipmap reduction code makes this a LOT easier than using autogen mipmaps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!