Invert Alpha checkbox in Material Opacity

Been using Playcanvas for quite a few years now and it’s great, but the biggest problems I’ve been having is the lack of flexibility with the materials compared to some other game engines but I believe there are a few quick wins to be made.

For example, I often bake shadowplanes for objects which I usually just put in the Ambient slot. Some times however I want to put such a shadowplane on top of another object to just cast a shadow on top of another material. It would be great in these cases to just take the ambient occlusion map and use it in the Opacity slot as an alpha and just check an invert checkbox. Many compositing softwares for example have similar features and they are a big boon in my book! That way I don’t have to save another inverted map and upload it to playcanvas, dealing with even more assets. And whenever I might have to update said map I save some recurring steps in the process.



Hi @phvi and welcome,

That’s a valid request! I’ve been in the same place myself, sometimes even coding a small shader to invert the texture map used.

I’d say as a first step this can be a feature request for the engine. If you would like you can submit this to the engine repo. If the engine supports this, then it can be exposed as an option to the editor.

1 Like

I agree a tickbox on material would be nice, but in the meantime you could start with this fragment shader chunk which handles opacity:

invert the value you read from texture perhaps, and use this new custom chunk on a material that needs it.

Not a convenient way to do it though!