Erasing Images

Hi, I am trying to make erasing mechanic in playcanvas. See below video

As far as I can think, I will need to change the alpha of pixels under my point to 0. That will erase that texture, but how this is possible is a question.

Hi @Faiq_Laiq,

To erase an image, what you need is a dynamic mask applied to the opacity channel of a material. Initially the mask is fully white, and as you paint on the mask black colors, those pixels that match these images get erased.

To paint on the mask you can use an canvas (hidden DOM element canvas).

But I was thinking based on what I am seeing here, do you truly need per pixel masking / erasing pixels from an image? If the objects you can paint over are specific, you may be able to just fade them out when the user touch/gestures over them.

2 Likes