Jump to content

smoothing/ antialias


Cedric
 Share

Recommended Posts

First, thanks for providing your code! It's much easier to describe the solution when I can try it before hand.  :)

 

Add these 3 lines to your boot state init:

Phaser.Canvas.setImageRenderingCrisp(game.canvas);  //for Canvas, modern approachPhaser.Canvas.setSmoothingEnabled(game.context, false);  //also for Canvas, legacy approachPIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST; //for WebGL

These work because you are using Phaser Scale Manager to do the scaling.

 

YOU ARE DONE.

 

See the reasons why: https://github.com/photonstorm/phaser/issues/1586#issuecomment-74843571

 

 

ps: As an aside, if you were using CSS to scale your canvas, the solution to the problem would be different:

canvas {  image-rendering:optimizeSpeed;             /* Legal fallback */  image-rendering:-moz-crisp-edges;          /* Firefox        */  image-rendering:-o-crisp-edges;            /* Opera          */  image-rendering:-webkit-optimize-contrast; /* Safari         */  image-rendering:optimize-contrast;         /* CSS3 Proposed  */  image-rendering:crisp-edges;               /* CSS4 Proposed  */  image-rendering:pixelated;                 /* CSS4 Proposed  */  -ms-interpolation-mode:nearest-neighbor;   /* IE8+           */}

See why: http://stackoverflow.com/a/8888964/28290

Link to comment
Share on other sites

thank you for your quick responses

 

I accualy dont know wich browser cocoon JS uses, I suppose chrome but since mobile browsers arent supported yet I think thats why its not working.

 

The added css rules didnt change anything unfortunantly.

 

btw I use the canvas+ method for testing withing the cocoon JS launcher

 

Best regards

Link to comment
Share on other sites

wich version of the launcher are you using ? 

my s4 mini hasnt been updated for the last year(still on 4.1.7).

I've read in the support page that version 2.0 of the launcher can only be installed on devices with 4.4 or above.

 

It might be that why its not working, I'm currently updating as we speak. It takes ages though ;)

 

Best regards

Link to comment
Share on other sites

I accualy have send you a second version, ill send you the first one with a accual player/character

 

you'll stil see AA when you move the player the opening is smoothed

 
Link to comment
Share on other sites

I have added the properties to all sprites now but with no luck.

 

I'm currently compiling the file to see if it made a change when in a apk form.

 

Best Regards

 

Link to comment
Share on other sites

It didn't make any change.

 

thank you for your interest and time,

hopefully there will be a better mobile browser or cocoonJS compatibility with Phaser 3 ;)

 

best regards

Cedric

Link to comment
Share on other sites

create: function() {		//game.renderer.renderSession.roundPixels = false;		Phaser.Canvas.setImageRenderingCrisp(game.canvas);  //for Canvas, modern approach		Phaser.Canvas.setSmoothingEnabled(game.context, false);  //also for Canvas, legacy approach		PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST; //for WebGL				game.stage.backgroundColor = "#6A093F";		game.state.start("load");        } 

First of sorry for this many replies BUT!!!!!!!!

I have some news: I managed to get it all working in the chrome browser on my phone!

All I did was moving the block of code you provided to the create function and tada!

 

the laucher problem is still there though.

 

Best Regards

Link to comment
Share on other sites

If you have a retina (or equivalent high density display), you will still not get pixellated graphics unless the browser supports those CSS properties mentioned earlier on canvas elements.

 

The way I get around this is by abusing PIXI's resolution parameter, which isn't supported in the current version of Phaser. The next version will allow this to be set, hopefully it gets released soon. You can check it out in the dev branch on github.

Link to comment
Share on other sites

thank you for your reply.

 

does PIXI's resolution parameter effect the cocoonJS launcher?

The game runs and looks fine on my pc on google chrome as well as on my mobile google chrome browser.

It just won't show up as in the browers as in the cocoonJS laucher ==> my compiled version is blurry/smoothed/antialiased

Link to comment
Share on other sites

people who followed the thread: 
the problem is fixed, ludei answered it on the issue thread of cocoon + phaser
 
I had to include there cocoon.js build file in my game directory from github and then set this command in my bootState: Cocoon.Utils.setAntialias(false);

also I had to include the code from earlier to make it all work in the browsers as well (code from gingerbeardman).

 

Thank you for answering 

 

Best Regards,

Cedric

doodle jump remake.zip

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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