Artifacts on loaded texture

Hi



I’m trying to stick in a background for a logging in state for my project. I’m just using a simple texture, but I’m seeing some strange horizontal artifacts on the image when it’s rendered in game. The original image is here and a screen shot is here. As you can see, there are artifacts running from side to side on the screenshot on the grey areas, almost purple in areas. They are not there in the original though.



Here is the standard code I use.

      ts.setTexture(TextureManager.loadTexture(getClass().getClassLoader()
            .getResource("data/images/login.png"), Texture.MM_LINEAR,
            Texture.FM_LINEAR, 1.0f, false));



I've also tried MM_NONE and a variety of other mipmap settings incase it was that.

Any ideas?

Thanks

Endolf

good thinking!

Yeah, I think shingoki is spot on.

The texture is probably resized because it's not square and a power of two. You should see a warning message about this somewhere in the debug output.

not nice of you to use a texture of size 799x601 :slight_smile: but it also looks like you are running the game in 16bit color depth?

That was true, but I fixed it, there is a png version that is resized with alpha around it, I uploaded the jpg by mistake.



Here is the png version with the surrounding alpha’d border here



Endolf



P.S. the properties dialog has 32 bit selected :), but yes, thats exactly the sort of thing.

Any more ideas?



It looks horrid :slight_smile:



Endolf

post some more code on how you set things up…and, have you tried any other images to see if the same things happens there?

Perhaps it is mipmapping that is uglifying (God, I kill me) your image. Try loading it with:



ts.setTexture(TextureManager.loadTexture(getClass().getClassLoader()

.getResource("data/images/login.png"), Texture.MM_NONE,

Texture.FM_NEAREST, 1.0f, false));

I could be wrong… but it looks like the result of compression on texture loading.



Try loading like this:



TextureManager.loadTexture(

SomeClass.class.getClassLoader().getResource(resourceName),

Texture.MM_LINEAR_LINEAR,

Texture.FM_LINEAR,

//Make sure we don't use compression, which makes images with gradients look awful

com.jme.image.Image.GUESS_FORMAT_NO_S3TC,

1f,

true);



I had the same thing with my skybox images, took me a while to work it out :slight_smile:

Give that man a cigar :slight_smile:



Perfect



Thank you all for looking at this.



Endolf