How do I Tint without webgl?

0 favourites
  • 5 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hello all,

    Yes, I know the Tint effect must use webgl, but since not all mobile browsers support it (Android < 5 and iOS < 8), I'm looking for a workaround.

    I'm trying to avoid both preparing sprites in different colors, or using cocoon/crosswalk to force the chromium browser and a large size overhead...


  • The closest you can get is to paste the Sprite to a canvas object, read the pixels, calculate the tint then draw it back. This isn't fast at all so maybe you could do it when the game starts and draw by juggling the canvas objects.

    Another way would be to use blend modes to color the objects, however you can't exactly do a tint.

    Anyway to do this it's probably easiest to use the canvas or paster objects, although you may be able to do it with layers instead.

    Basically each Sprite will have a paster object positioned over it so the paster covers the Sprite. Then do these steps

    Fill paster with whatever color you want.

    Set the sprite's blend mode to source in.

    Paste Sprite to paster

    Set the sprite's blend mode to normal

    Then you just adjust the opacity of the paster object to change the strength of the coloring. You could also use the additive blend on the paster object for a different coloring.

    Keep in mind each instance of canvas/paster will use it's own texture.

  • I'm also looking for something similar but I havn't found anything very useful yet. My solution so far: - Don't cater for people with crappy phones/old browsers, the game is probably not gonna run well anyway. So worry about tint, when the overall experience is gonna be laggy/slow is a waste of time.

    My game with webgl constant 60fps on a midrange phone. Without webgl even on same phone feels choppy and slow 30-40fps

    Now imagine without webGl on a low end phone. Unplayable. Don't waste your time.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's better to spend time to create a popup screen for pople without webGl enabled phones.

    Sorry this game is not supported on this device.

    That way you will save yourself a lot of bad reviews from people having a bad experience with a laggy game.

    Unless you completely design your game for low end users and If your game runs well on a low end phone without webGL, don't worry about tint.

  • R0J0hound, thanks a lot! my sprites needs to change tint at runtime, so I'm afraid paster will slow things down. I'll have a look at it, but I guess I'll use animation frames (different color each frame).

    tunepunk, Tint is a very major part of my game (as of now, at least), and saying "your device is not supported" on Google play/App store is a big no no...

    My game has quite a low object count (about 50 sprites on screen, and 4-5 particles at its peak), so I wouldn't worry about low end performance.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)