MistOfShades Posted March 4, 2021 Share Posted March 4, 2021 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! But alas, not on mobile... 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! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 4, 2021 Share Posted March 4, 2021 > I speak English and Russian. Welcome! https://t.me/gamedevforweb https://t.me/webgl_ru Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 4, 2021 Share Posted March 4, 2021 Use highp in fragment. There's no other way. precision mediump float; Quote Link to comment Share on other sites More sharing options...
MistOfShades Posted March 5, 2021 Author Share Posted March 5, 2021 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 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 5, 2021 Share Posted March 5, 2021 highp and mediump are different across devices, and high-performance devices can give you more precision even for mediump. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.