Problem with Sprite

Hi,

I’m facing some weird problem when I try to include a sprite in my scene.

The sprite is showing some lines on right and down (the one marked with orange box). This is how I include the sprites in my scene.

spriteManager_test = new BABYLON.SpriteManager("TestManager", 
               "./textures/icon.png", 2000, {width: 512, height: 1024});
spriteManager_test.isPickable = true;.
 testsprite = new BABYLON.Sprite("See 3D Model", spriteManager_test);
 testsprite.width = 250;
 testsprite.height = 500;
 testsprite.position = new BABYLON.Vector3(100, -300, 750);
 testsprite.isPickable = true;
 testsprite.useAlphaForPicking = true;

Not sure of the reason why the sprite shows some lines on right and down. Any help is appreciated.

Maybe you have to put a border of transparent pixels around your sprite: it seems those are border pixels that are repeated by the “clamp” address mode.

A repro in the Playground would definitely help here.

Hi,

Thanks for the reply, sharing the PG - https://playground.babylonjs.com/#YCY2IL#296

Hi, found the solution but I’m not sure if this is the correct one, Changing width and height in SpriteManager and sprite seems to work.

You should try to add a border of transparent pixels all around the picture: that should make it work.

Yes, if you use the exact same size than the picture (108x106) it will work.

1 Like