UV mapping doesn't work correctly (probably wrong material parameters)?

Hello jmonkeys,
I’ve created a very simple custom quad in my game which is 32x32 (width and height).
I’m trying to apply a texture to it using the UV coords and the used image is also 32x32.
The actual texture of this quad is a very small piece of the image, as it’s a 4x4 area in the top-left corner of it.
I think I’m using the correct UV coords, but there’s a strange behaviour with the pixels of the image (like gradients between near pixels)
I’m using Unshaded.j3md as material.

This is the texture:

And this is the strange result:

So in my custom mesh the UV coords are:

        texCoord[0] = new Vector2f(0, 1F-(4F/32F));
        texCoord[1] = new Vector2f(4F/32F, 1F-(4F/32F));
        texCoord[2] = new Vector2f(0, 1);
        texCoord[3] = new Vector2f(4F/32F, 1);

And I create my quad with the following code:

        Mesh quad = CustomBox.createCustomQuad(32, 32);
        Geometry geom = new Geometry("Quad"+this.ID, quad);
        Material mat = new Material(MyGame.app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", MyGame.app.getAssetManager().loadTexture("Textures/testBox2.png"));
        mat.setBoolean("SeparateTexCoord",true); 
        geom.setMaterial(mat);
        rootNode.attachChild(geom);

What did I do wrong? Is it for the unshaded material?

Thanks for your help and time,
Axel

After 4 hours still can’t make it work.

I’ve PHOTOSHOPPED the previous image to show you how the correct result should be:

Please give me any tip, I cannot continue my work without this feature done :frowning:
Thanks as always!

http://hub.jmonkeyengine.org/javadoc/com/jme3/texture/Texture.html#setMagFilter(com.jme3.texture.Texture.MagFilter)

Thanks pspeed!
So it was there! I must use “nearest” instead of “bilinear” for the MagFilter! I’ll try in few minutes and I’ll report the results! :smiley:

Ok that’s perfect, everything is beautiful now :smiley: