Jump to content

Texture frame visualization problem with scaling


zarstar
 Share

Recommended Posts

Hi guys,

I have a problem with texture frames and scaling.

 

Pratically I have a DisplayObjectContainer and a lot of Sprites in it.

Each Sprite has a Texture, got by applying a crop from an original Texture.

So each Sprite shows just a part of the original Texture.

The original Texture background color is black.

 

Now the problem is that when I scale the DisplayObjectContainer quickly, some bars appears (the bars are the black background of the original Texture).

So pratically it's like PIXI doesn't mantain the frame of the Texture perfectly.

 

I uploaded a video to let it be clearer (at the end there is a "slow motion" part):

http://gabrielenosso.com/temp/pixiproblem.mp4

 

 

So what do you think can I do to solve the problem?

And should I post it to the PIXI Github page?

 

Link to comment
Share on other sites

Does this issue happen in both renderers or only the WebGL Renderer?

Looks like an rounding issue which happens in the WebGL shader.

Maybe you could try to extrude your tiles 1 px in each direction.

Just an example:

0.1 * 0.2 is 0.020000000000000004 and not 0.02.

Most fractions can't be represented with their exact value.

And that is most likely why your texture is sometimes 1 px off.

Link to comment
Share on other sites

Honestly I didn't tried it with the Canvas Render, however I need it to work with the WebGL Renderer.

 

I'm aware about the problem about fractions binary representation, but what could I do about it?

 

Removing a pixel isn't an option for me: i really need every single pixel of the image.

 

Coulnd't PIXI round the textures frame with Math.floor() / Math.round() or something like that?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...