How do I Tint without webgl?

Get help using Construct 2

Post » Sat Jun 18, 2016 8:19 pm

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

Thanks!
B
17
S
7
G
1
Posts: 157
Reputation: 1,878

Post » Sun Jun 19, 2016 2:22 am

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.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Sun Jun 19, 2016 10:20 am

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.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Sun Jun 19, 2016 10:58 am

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.
Follow my progress on Twitter
or in this thread Archer Devlog
B
35
S
15
G
17
Posts: 944
Reputation: 12,210

Post » Sun Jun 19, 2016 8:13 pm

@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.
B
17
S
7
G
1
Posts: 157
Reputation: 1,878


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Casimir, pwrtoppl, resdesign and 9 guests