Sign in to follow this  

3D Textures and Mipmaps?

This topic is 4300 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'm am currently working on my terrain-renderer and for that, I'm using 3D-Textures. Is it possible to create mipmaps/enable anistropic filtering for those 3d textures? I have ugly pixel-artefacts when moving on my terrain. But when I enable anistropic filtering in the ati-control panel, they are gone. Here is the code for creating the texture:
		glGenTextures(1, &newtexture.textureid);
		glBindTexture(GL_TEXTURE_3D, newtexture.textureid);

		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);

		glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 256, 256, 4, 0, GL_RGB, GL_UNSIGNED_BYTE, buffer);
Edit: Okay, when using anistropic filtering, it works good:
	glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 4.0f);
So, now I've got another question: Does it make sense to use mipmaps? For all my 2D-Textures, I'm currently using gluBuild2DMipmaps. Should I begin to use only anis-filtering? [Edited by - Ludi83 on March 4, 2006 8:16:45 PM]

Share this post


Link to post
Share on other sites
yes u can have mipmaps for 3d textures u need to use GL_..MIPMAP.. for one of the min or max filtering methods
also u should never use gluBuild2DMipmaps for creating mipmaps use GENERATE_MIPMAP or loadd them yourself

Share this post


Link to post
Share on other sites
Quote:
Original post by zedzeek
yes u can have mipmaps for 3d textures u need to use GL_..MIPMAP.. for one of the min or max filtering methods
also u should never use gluBuild2DMipmaps for creating mipmaps use GENERATE_MIPMAP or loadd them yourself


Thanks for your answer. Without using GL_GENERATE_MIPMAP, set the minfilter to GL_LINEAR_MIPMAP_LINEAR creates an invalid enum error, but now it works :) And I will ban gluBuild2DMipmaps from my texture-loader :)

But there's another problem: When using mipmaps and set the min-filter to any GL_.._MIPMAP_... value, it produces only a blurred pixel-mass:


Setting the min-filter to GL_LINEAR, I get those pixel arifacts :(


Arrrgh, what can I do? Any help?

Share this post


Link to post
Share on other sites
im using
glTexParameteri( texture_target, GL_GENERATE_MIPMAP, GL_TRUE );
glTexParameteri( texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );

no probs
if its to blurred perhaps the 3dtexture size is to small?
though in those screenshoots it looks like u would only be using the mag filter and not the min since the 3d image takes up a large part of the screen

Share this post


Link to post
Share on other sites
Quote:
Original post by zedzeek
im using
glTexParameteri( texture_target, GL_GENERATE_MIPMAP, GL_TRUE );
glTexParameteri( texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );

no probs
if its to blurred perhaps the 3dtexture size is to small?
though in those screenshoots it looks like u would only be using the mag filter and not the min since the 3d image takes up a large part of the screen


It works now, just before I wanted to post it, you made the response :). The problem was, that this test-quad was to small. I put it on a big terrain, and it looks ... hmm ... little bit better now :)



But I have a problem with anisotropic filtering. As soon as I enable it, I get those strange shadows/whatever on my terrain (but I don't do any shadowing yet). Is it a dirver-bug, perhaps?



Edit:
I'm using a Radeon9800 Pro, don't know which driver (I think 5.11/12) :)

Share this post


Link to post
Share on other sites

This topic is 4300 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.

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