Jump to content

roundPixels on a per-Sprite basis?


cloakedninjas
 Share

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 ?

 

Link to comment
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

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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