Jump to content

Filters on mobile


MistOfShades
 Share

Recommended Posts

Hello, fellow game makers!

Last day I was wrestling with PIXI's filters, or to be more precise, with applying filter to local coordinates of DisplayObject to make it scaling-consistent. 
So I got a smoke shader from the bottom of this tutorial and made it work at local coordinates of an object. I even adjusted frame and vTextureCoord for resolutions other than 1.
And look at this gorgeous pearl-like texture! It is even animated and looks so beautiful!

image.png.2f79a90d251e1687348e8c127df33d22.png

But alas, not on mobile...

image.thumb.png.64f7ed41fa7ae4bbb97782fd5d739f72.png

This is Samsung A3 2016 with resolution 1280x720 and devicePixelRatio=2

I'm pretty sure that coordinates are correct and shader doesn't request anything other than coordinates.

PIXI.settings.FILTER_RESOLUTION and PIXI.settings.RESOLUTION are set to window.devicePixelRatio

Input textures have a right resolution and scaled back to fit object boundaries. 

But somehow results on mobile and desktop are inconsistent.
I have no idea how to approach this problem and I absolutely don't want to blindly adjust filter values with hope for it to work

This is working example. Please try it on your device and share results. Devices with resolutions other than 1 or 2 are very welcome!
https://www.pixiplayground.com/#/edit/vY25ooUOikjeQbp1k6ywF

I speak English and Russian. 
Please be welcome to contact me through Telegram: https://t.me/PastRecall

I really hope to use shaders for my personal project, so I hope there is a solution for this problem.
Thank you for reading and have a nice day!

Link to comment
Share on other sites

Thank you Ivan, you are magician! Everything working wonderful now
For anyone wondering, I added this lines at the top of fragment shader:

#ifdef GL_FRAGMENT_PRECISION_HIGH
  precision highp float;
#else
  precision mediump float;
#endif

Somehow my pc used highp even with implicit medump directive, but my phone was more obedient in this regard

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...