emeric636 / andengine

Automatically exported from code.google.com/p/andengine
0 stars 0 forks source link

Texture bleeds into adjacent texture on scaling sprites #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. load two PNG textures, one (A) with colors to the edge (like a box), another 
(B) with transparency around edges (like a cloud), in adjacent locations within 
a Texture using TextureRegion.createFromAsset(). So, if texture (A) is 32 x 32 
loaded at (0,0), then texture (B) would be loaded at (32,0). 
2. Load a sprite using (A), setScale 2.0f, or higher, 
3. Load a sprite using (B), and animate it on a dark background
4. (B) shows a 1 or 2 pixel edge, on the side adjacent to where (A) is loaded 
in the Texture. Edge on (B) becomes more visible, i.e. 2 pixels thick or more, 
if (A) is scaled to a higher value.

What is the expected output? What do you see instead?
Expected output is that as long as loaded textures are not overlapped in the 
createFromAsset() calls, a texture should not show any visible effect from any 
neighboring textures.

What is seen instead is, adjacent assets bleed over to next texture when 
scaled, causing critical artifacts especially if neighboring texture has 
transparency at edges and is animated.

What version of the product are you using? On what operating system?
Current build of library as taken from the Examples.
Issue has been replicated on Android 2.1 and 2.2 on different devices.

Please provide any additional information below.

Work-around: Leave a 2 to 4 pixel buffer between textures in loading from 
assets.

Original issue reported on code.google.com by anindo.g...@gmail.com on 13 Feb 2011 at 7:11

GoogleCodeExporter commented 9 years ago
The reason for this is that you are probably using TextureOptions.BILINEAR or 
similar which averages over the 4 nearest textels to the requested texel. 

But as you suggested, the easiest is to use some spacing, which can be done 
automatically, when you use a BuildableTexture instead of a 'norma' Texture.

Original comment by NicolasG...@gmail.com on 24 Feb 2011 at 12:25