White Lines Between Sprites

  ... discussions about development with the GLES1 branch of AndEngine.

White Lines Between Sprites

Postby Ghilt » Thu Mar 29, 2012 2:46 pm

Hello!

My towerdefence is coming along nicely and i have started replacing all my temporary graphics... however

Image

On my scene i place 64x64 sprites next to eachother with no overlap and no spacing inbetween.

You see the white vertical lines in the grey path? Where do they come from and how do i get rid of them? They flicker in and out of existance if i move the camera.

All my grass also had these lines, but i decided to see if i could fix it by make my sprites 65x65 pixels and have them overlap one pixel, and that fixed it, but it feels very lame and unneccesary :(

Can it be something with the way i save my .png files?
Ghilt
 
Posts: 27
Joined: Mon Jul 04, 2011 1:46 pm

Re: White Lines Between Sprites

Postby Mathew » Thu Mar 29, 2012 4:05 pm

While using BILINEAR texture option, such effect occurs, obvious way is to change texture option (but disadvantage is quality loss) or overlap tiles with 1px (I'm using this way, since quality is really important)
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: White Lines Between Sprites

Postby Ghilt » Thu Mar 29, 2012 8:44 pm

well changing it fixed the problem... and there are no other solutions? :/

annoying that i have to 'up' some of my sprites to 65px... though i guess the most effiecient way to do it would be doing a big BitmapTextureAtlas so i dont sit around with many only 1/4 filled 128px ones
Ghilt
 
Posts: 27
Joined: Mon Jul 04, 2011 1:46 pm

Re: White Lines Between Sprites

Postby darknlight » Thu Mar 29, 2012 9:18 pm

the keyword is padding i think : post30926.html
darknlight
 
Posts: 7
Joined: Thu Nov 03, 2011 4:54 am

Re: White Lines Between Sprites

Postby Mathew » Thu Mar 29, 2012 10:00 pm

Padding doesn't work in my case, overlapping fixed it, as I mentioned in thread you linked above.
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: White Lines Between Sprites

Postby Ghilt » Thu Mar 29, 2012 10:38 pm

hmm not running gles2 though :/

inquired some more:

The code bellow produced the picture in my opening post. Route-b is a 65x65 pixel grass texture, placed with overlap. All the other files are 64x64 pixel and are the path texture parts

textureRegions is just a hashmap where i store texture regions

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                         BitmapTextureAtlas routeSpecialTex = new BitmapTextureAtlas(128, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  2.                 TextureRegion routeSpecialReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeSpecialTex, this, "route/Route-b.png", 0, 0);
  3.                 textureRegions.put("RouteB", routeSpecialReg);
  4.                
  5.                
  6.                
  7.                 BitmapTextureAtlas routeTex = new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  8. //              TextureRegion routeBReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-b.png", 0, 0);
  9. //              textureRegions.put("RouteB", routeBReg);
  10.                 TextureRegion routeVReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-v.png", 64, 0);
  11.                 textureRegions.put("RouteV", routeVReg);
  12.                 TextureRegion routeHReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-h.png", 128, 0);
  13.                 textureRegions.put("RouteH", routeHReg);
  14.                 TextureRegion route1Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-1.png", 192, 0);
  15.                 textureRegions.put("Route1", route1Reg);
  16.                 TextureRegion route2Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-2.png", 0, 64);
  17.                 textureRegions.put("Route2", route2Reg);
  18.                 TextureRegion route3Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-3.png", 64, 64);
  19.                 textureRegions.put("Route3", route3Reg);
  20.                 TextureRegion route4Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-4.png", 128, 64);
  21.                 textureRegions.put("Route4", route4Reg);
Parsed in 0.035 seconds, using GeSHi 1.0.8.4



this code below i just changed the code to make room for the extra pixel in my files but did not change the files, so they are still 64x64.


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. BitmapTextureAtlas routeTex = new BitmapTextureAtlas(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  2.                 TextureRegion routeBReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-b.png", 0, 0);
  3.                 textureRegions.put("RouteB", routeBReg);
  4.                 TextureRegion routeVReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-v.png", 65, 0);
  5.                 textureRegions.put("RouteV", routeVReg);
  6.                 TextureRegion routeHReg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-h.png", 130, 0);
  7.                 textureRegions.put("RouteH", routeHReg);
  8.                 TextureRegion route1Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-1.png", 195, 0);
  9.                 textureRegions.put("Route1", route1Reg);
  10.                 TextureRegion route2Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-2.png", 0, 65);
  11.                 textureRegions.put("Route2", route2Reg);
  12.                 TextureRegion route3Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-3.png", 65, 65);
  13.                 textureRegions.put("Route3", route3Reg);
  14.                 TextureRegion route4Reg = BitmapTextureAtlasTextureRegionFactory.createFromAsset(routeTex, this, "route/Route-4.png", 130, 65);
  15.                 textureRegions.put("Route4", route4Reg);
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


That code produced this picture:

Image

The original white path gets black lines, the former white lines in the brown path are now green and i get white lines in my grass. And my grass is still 1px overlapping... gonna proceed anyway and do 65x65 path-parts just to see what happens... hmm weird s****
Last edited by Ghilt on Thu Mar 29, 2012 11:32 pm, edited 1 time in total.
Ghilt
 
Posts: 27
Joined: Mon Jul 04, 2011 1:46 pm

Re: White Lines Between Sprites

Postby Ghilt » Thu Mar 29, 2012 11:31 pm

ok of to bed!

I managed to remove all lines in the end, 65x65 textures, but i could for some reason not bunch up all textureRegions under one textureAtlas. Though it worked for all but one, not for my path-vertical-part, but if i simply gave it its own bitmaptextureatlas it worked fine. Randomness yay -.-, i see no difference from any of the other parts but ohh well, good enough for tnight ^^

Thanks for all the help
Ghilt
 
Posts: 27
Joined: Mon Jul 04, 2011 1:46 pm


Return to GLES1

Who is online

Users browsing this forum: Exabot [Bot] and 14 guests