Texture Filtering: GL_NEAREST

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

Texture Filtering: GL_NEAREST

Post by yv »

Hi,

According to the irrlicht source, both Material.BilinearFilter and Material.TrilinearFilter must be set to FALSE, for the textures to be rendered with GL_NEAREST to be set for texture filtering.

Unfortunately that did not work for me.

Here is the image from RenderMonkey where I render Noise on a sphere with GL_NEAREST NOT set.

http://vanzine.org/download/noisysphere.GIF

There you can see rectangular artifacts. They disappear as soon as I set GL_NEAREST for texture filtering.

Recently I tried same noise in irrlicht.

http://vanzine.org/download/raw_no_gl_nearest.jpg

Even though I set the texture filtering, the artifacts are not going away.
Here is code:

Code: Select all


...
Material.BilinearFilter = false;
Material.TrilinearFilter = false;
...

Please help!

Thanks,

yv
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It's definitely chosen if you disable both settings. However, with mipmapping enabled you will get NEAREST_MIPMAP_NEAREST. Disable mipmaps to get GL_NEAREST.
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

GL_NEAREST_MIPMAP_NEAREST is causing this

Post by yv »

I tested it in RenderMonkey and it is in fact GL_NEAREST_MIPMAP_NEARESTon one of the dependable texture reads that is causing this.

I don't however know how to disable mipmaps. What I tried below did not have any effect.

Code: Select all

 
	driver->setTextureCreationFlag(E_TEXTURE_CREATION_FLAG::ETCF_CREATE_MIP_MAPS,false);
	FireProfile = driver->getTexture("data/firetexflip.jpg");	
	FirePermNoise = driver->getTexture("data/Noise/GeneratePermTexture2D.bmp");	
	FireGradNoise = driver->getTexture("data/Noise/GenerateGradTexture2D.bmp");

Thank you!

yv
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

GL_NEAREST still not being set?

Post by yv »

I have looked at the code in the opengl driver source and can say that GL_NEAREST are being set for my material with 3 textures if I disable bilinear and trilinear texture filtering and set the mipmap creation to false.

But why does my texture still look exactly as if GL_NEAREST was never set?

I will keep looking.

Thanks,

Yuri
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe you should check the material with an OpenGL debugger. I'm pretty sure that with your settings shown (disabling mipmaps works exactly like this, but don't forget to reenable it in order to have them for other textures later on) it should choose GL_NEAREST, but you never know. Maybe it's some default initialization which makes it work differently. Would be nice if you try it out and report back.
I'll move it to bug forum to not loose track of this post.
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

GL_TEXTURE_MIN_FILTER=GL_NEAREST_MIPMAP_NEAREST

Post by yv »

I ran gDEBugger and discovered the following texture filtering settings on my noise lookup textures:

GL_TEXTURE_MIN_FILTER=GL_NEAREST_MIPMAP_NEAREST
GL_TEXTURE_MAG_FILTER=GL_NEAREST

While it should be:

GL_TEXTURE_MIN_FILTER=GL_NEAREST
GL_TEXTURE_MAG_FILTER=GL_NEAREST

My code simply calls the Irrlicht draw functions:

Code: Select all


void FS::drawBackToFront()
{
	video::IVideoDriver* driver = SceneManager->getVideoDriver();
	driver->setMaterial(Material);
                driver->drawIndexedTriangleFan(...)

}


Prior to loading the textures I am setting the mipmap creation flag to false.

Prior to using the material I am setting Bilinear and Trilinear Filtering to false.

I hope that this information can help us track down this bug.

Thanks,
yv
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, just as I thought. But I'm really not able to find a point where the setting could go wrong. Only exception would be a render state confusion with other textures. Do you use more than one mesh and texture?
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

Post by yv »

I am using a skybox, 3 textures and have meshes turned off. Using a custom scenenode instead. I will try to use glDebugger on a simple irrlicht example with a triangle and a texture and cause the filtering to be set to GL_NEAREST and see if I can actually do it.
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

Problem went away with version 1.31

Post by yv »

I have been meaning to upgrade for awhile and today got around to it. This issue has gone away! Thank you, team!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

From which version did you upgrade?
yv
Posts: 34
Joined: Sun Aug 20, 2006 2:52 pm

1.2 -> 1.31

Post by yv »

I upgraded from 1.2 to 1.31
Post Reply