cloakedninjas

roundPixels on a per-Sprite basis?

Recommended Posts

This topic seems to be mentioned a lot on these forums:

 

http://www.html5gamedevs.com/topic/15167-sprite-jittering-on-velocity/?hl=roundpixels

http://www.html5gamedevs.com/topic/12485-sprite-jittering-with-camera-follow/

 

Now I have similar question.

 

Originally I started out by having this set to true to ensure I had crisp textures. But I added some slow-moving clouds to my background and this caused them to jitter, obviously they're move so slowly that when their position was rounded, it caused movement that was larger than it should have been

 

Is there a way I can allow certain sprites to be rendered at sub-pixel values (and be aliased) while the rest follow the global game.renderer.renderSession.roundPixels = true ?

 

Share this post


Link to post
Share on other sites

Well... As a dirty hack I've added the following to my Cloud sprite class:

_renderWebGL(renderSession:PIXI.RenderSession) {    renderSession.roundPixels = false;    super._renderWebGL(renderSession);    renderSession.roundPixels = true;}_renderCanvas(renderSession:PIXI.RenderSession) {    renderSession.roundPixels = false;    super._renderCanvas(renderSession);    renderSession.roundPixels = true;}

This does the trick, but ideally it would be a property on the Sprite itself, along with checking the global setting: https://github.com/photonstorm/phaser/blob/c9c85330ab60547b39ba4c9400c258ed7fb2a317/src/pixi/display/Sprite.js#L423

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.