texture noise

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

texture noise

Post by Sullivan »

Hi all,
I have a problem with texture in Irrlicht.
Here a screenshot of my little demo.
Image

How you can see the texture in the front of camera is quite good, instead the faces far of the camera are rendered with a strange noise. Also, when I move the camera around the scene, the noise effect is more marked...
For what I have saw from the tutorials images like that
Image
the texture far away from the camera haven't this horrible effect...

Here I post a piece of my code about the map materials:

Code: Select all

 
map_model = scene->getMesh(path.c_str());
    if(!map_model)
    {
      return false;
    }
 
    map_node = scene->addMeshSceneNode(map_model);
 
    map_node->setMaterialTexture(1, device->getVideoDriver()->getTexture("./data/models/Maps/lightmap.png"));
    map_node->setMaterialType(irr::video::EMT_LIGHTMAP_M4);
    
    map_model->setMaterialFlag(irr::video::EMF_LIGHTING, true);
    map_model->setMaterialFlag(irr::video::EMF_FOG_ENABLE, false);
    map_model->setMaterialFlag(irr::video::EMF_ANISOTROPIC_FILTER, true);
    map_model->setMaterialFlag(irr::video::EMF_ANTI_ALIASING, true);
    map_model->setMaterialFlag(irr::video::EMF_TRILINEAR_FILTER, true);
 
    map_node->getMaterial(0).SpecularColor.set(255,255,255,255);
    map_node->getMaterial(0).DiffuseColor.set(255,255,255,255);
    map_node->getMaterial(0).AmbientColor.set(170,170,170,170);
 
 
Some hints?
thanks
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: texture noise

Post by Radikalizm »

Are you disabling mipmapping anywhere in your code? I can't see the noise pattern all too clear in your screenshot, but disabling mipmaps can give an ugly moiré pattern on distant textures
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

Re: texture noise

Post by Sullivan »

I can't see the noise pattern all too clear in your screenshot
The noise is more visible when I move the camera, that's why could be hard see it just in a screenshot
Anyway, seems that you are in the right way. Disabling this mipmapping the result is nicer and the noise effect is less visible.
Thanks for the hint!
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: texture noise

Post by Radikalizm »

Sullivan wrote:
I can't see the noise pattern all too clear in your screenshot
The noise is more visible when I move the camera, that's why could be hard see it just in a screenshot
Anyway, seems that you are in the right way. Disabling this mipmapping the result is nicer and the noise effect is less visible.
Thanks for the hint!
I think you misunderstood my point, it's the disabling of mipmaps which gives artifacts, you shouldn't disable mipmaps unless you have a very specific reason to do so, I was just asking if you had disabled it somewhere to see if that was the issue

Have you tried different filtering settings for your material?
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

Re: texture noise

Post by Sullivan »

Sorry, my fault! :D
I haven't write correctly...

I said "Disabling mipmapping...etc", but I wanted to say "Not disabling mipmapping...". Sorry
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: texture noise

Post by Radikalizm »

Sullivan wrote:Sorry, my fault! :D
I haven't write correctly...

I said "Disabling mipmapping...etc", but I wanted to say "Not disabling mipmapping...". Sorry

Ok, good to hear that it's (partially) solved then ;)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: texture noise

Post by hendu »

Looks like AF would benefit those textures too.
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

Re: texture noise

Post by Sullivan »

hendu wrote:Looks like AF would benefit those textures too.
Sorry don't get it. What's "AF"?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: texture noise

Post by hendu »

Anisotropic filtering.
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

Re: texture noise

Post by Sullivan »

hendu wrote:Looks like AF would benefit those textures too.
if you mean

Code: Select all

model->setMaterialFlag(irr::video::EMF_ANISOTROPIC_FILTER, true);
Is already enabled
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Re: texture noise

Post by Lonesome Ducky »

If it's still a problem, try changing the material's LODBias so it picks a lower detail mipmap earlier.
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

Re: texture noise

Post by Sullivan »

Lonesome Ducky wrote: If it's still a problem, try changing the material's LODBias so it picks a lower detail mipmap earlier.
Do you mean this, right?

Code: Select all

 
material.TextureLayer[0].LODBias = <value>;
 
If yes, I tried it, but sadly I didn't notice a real change.
Anyway I also noticed that the noise effect is much less evident changing the model size (of course this is an expedient for the problem)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: texture noise

Post by hybrid »

Do you use b3d as mesh file format (not for the ninja, but the building). b3d stores a flag whether mipmap should be used or not. However, most editors don't set this properly. You can override this falg with a scene parameter, though, which will make the mipmaps automatically build then. Just make sure you get the mipmaps somehow. This mesh is probably not usable without mipmapping.
Sullivan
Posts: 9
Joined: Mon Jul 04, 2011 5:54 pm

Re: texture noise

Post by Sullivan »

hybrid wrote: This mesh is probably not usable without mipmapping.
:(
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: texture noise

Post by hybrid »

Well, that's not a problem, just use mipmaps.
Post Reply