Alpha mask transparency for sprite to make jpeg images transparent

Alpha mask transparency for sprite to make jpeg images transparent
0
#1

Hi there!
I wanted to reduce apk size of my game. So I wanted to convert PNG32 files to JPEG+Alpha.
I’ve spend several days to research and made a component for it.

“alpha_mask” Component:
This component can be applied any node that has cc.Sprite component on it to mask with alpha texture.
It compiles a shader to get RGB colors from original sprite texture and ALPHA from alpha texture.
Useful to apply transparency on JPEG images.

Tested on: Cocos Creator 1.9.3 Editor, Simulator, Browser, Windows, Android.

** Note for browser and editor **
It doesn’t work properly if original sprite frame and alpha sprite frame comes from differen texture atlases.
I couldn’t manage to give second texture on webgl. Any contribution appreciated :slight_smile:

Here is the repo:
https://bitbucket.org/supermegaspacegame/alpa-mask-component/src/master/

I hope it saves time for you :wink:

Html5 - bind additional uniform textures to shader