Blur of texture viewed in flat angle

Hi, I have a problem with my textures on a street. “DriverSeat”-Camera blurs the road marking very strong after a certain distance and I do not know what to do about it. Seems that the angle of view on the texture is an important factor. Anyone any ideas what this could be? I am pretty new to jMonkey, so this might as well be a common problem, hopefully easy to solve :slight_smile:

Thanks a lot!

You can try messing with:
http://hub.jmonkeyengine.org/javadoc/com/jme3/texture/Texture.html#setAnisotropicFilter(int)

Thanks: This did it:
GL11.glBindTexture(GL11.GL_TEXTURE_2D, t.getImage().getId());
GL11.glTexParameterf(GL11.GL_TEXTURE_2D,
GL12.GL_TEXTURE_MAX_LOD, 4f);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D,
GL12.GL_TEXTURE_MIN_LOD, 0f);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D,
GL12.GL_TEXTURE_MAX_LEVEL, 4);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D,
GL12.GL_TEXTURE_BASE_LEVEL, 0);

@paulhoepner said: Thanks: This did it: GL11.glBindTexture(GL11.GL_TEXTURE_2D, t.getImage().getId()); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, 4f); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0f); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, 4); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_BASE_LEVEL, 0);

Can I trouble you to post a followup pic after the fix? Just interested in seeing the results (if it’s not a huge bother)

This is after the fix

1 Like

Thanks! =)

@paulhoepner said: Thanks: This did it: GL11.glBindTexture(GL11.GL_TEXTURE_2D, t.getImage().getId()); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, 4f); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0f); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, 4); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_BASE_LEVEL, 0);

This is how not to do it.

ok, sorry! It worked for me, but if its a wrong approach, please let me know how to do it better …

Isn’t this a mipmap issue (i.e. setMinFilter, setMagFilter of texture should be able to do what you are looking for)?

Damn, sorry!!! I forgot to post that line of code, of course I used setMinFilter & setMagFilter. This is the complete code I used to optimize:

[java]

		                MatParam m = singleGeom.getMaterial().getParam("DiffuseMap");
		

				Texture2D t = (Texture2D) m.getValue();
				t.setAnisotropicFilter(8);

				t.setMinFilter(Texture.MinFilter.BilinearNearestMipMap);
				// t.setMagFilter(Texture.MagFilter.Bilinear); //slower
				// t.setMagFilter(MagFilter.Nearest); //faster
				GL11.glBindTexture(GL11.GL_TEXTURE_2D, t.getImage().getId());
				GL11.glTexParameterf(GL11.GL_TEXTURE_2D,
						GL12.GL_TEXTURE_MAX_LOD, 4f);
				GL11.glTexParameterf(GL11.GL_TEXTURE_2D,
						GL12.GL_TEXTURE_MIN_LOD, 0f);
				GL11.glTexParameteri(GL11.GL_TEXTURE_2D,
						GL12.GL_TEXTURE_MAX_LEVEL, 4);
				GL11.glTexParameteri(GL11.GL_TEXTURE_2D,
						GL12.GL_TEXTURE_BASE_LEVEL, 0);
				[/java]

Well what Normen means is that we do not recommend using direct GL calls.
Do you really need them? isn’t setting the anisotropic filter to 8 enough?

Hmm, yes, it anisotropic filter does help, but ist there another way to change the MipMap LOD Levels? I found, that reducing them increased my FPS … I surely do not want to use anything unrecommended, as I am sure theres good reasons for that :slight_smile:

@paulhoepner said: Hmm, yes, it anisotropic filter does help, but ist there another way to change the MipMap LOD Levels? I found, that reducing them increased my FPS ... I surely do not want to use anything unrecommended, as I am sure theres good reasons for that :)
There is no way to change that no...This should be added to the Texture class. For now you may have no other choice. The thing is that for example those calls wouldn't work on android. So if you want to switch to android at some point, you'll have to change that. No big deal, but that's why it's not recommended.
1 Like