Sign in to follow this  
procgen

OpenGL 3D texture mipmapping.

Recommended Posts

I want to create mipmap textures which shrink only in width and height.

1024x1024x4
512x512x4
256x256x4
etc.

glGenerateMipmap and glTexParameteri with GL_GENERATE_MIPMAP seem to shrink all dimensions for each mipmap level. This doesn't look good at all. I tried generating my own mipmaps by creating the downscaled versions myself and uploading them through glTexImage3D. This doesn't work. I'm basically wondering if it should work? Also, some general insight into how strict OpenGL is with the 3D mipmap dimensions would be helpful. Thanks in advance.

Share this post


Link to post
Share on other sites
It's a very convenient method of interpolating between multiple 2D textures. Imagine a grassy terrain, you don't want the same grass texture repeating over and over. It looks much better with many different textures of grass in different colors and configurations. If you have a 3D texture where each layer is a variety of "grass texture", then you can easily create variety by simply changing the depth texture coordinate throughout the terrain. The alternative to this is one big 2D texture where all the different grass textures are side-by-side, or multiple 2D textures bound to different texture units. These methods work as well, but they are not as elegant, in my opinion.

Share this post


Link to post
Share on other sites
By definition, when you have mipmapping, each side gets smaller by HALF until all sides reaches 1.
For a 3D texture, it will be 1x1x1.
What you are asking for is not supported by hardware.

You have to have several 2D textures and you do the blending between them yourself or
using [b]GL_TEXTURE_2D_ARRAY[/b] and you dothe blending between them yourself. The advantage of [b]GL_TEXTURE_2D_ARRAY is that you only need to bind the texture once.

http://www.opengl.org/wiki/Array_Textures
[/b]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this