Hello,
We’re working on a drawing style app for children, and have gotten the drawing mechanics working nicely. However, we now need to implement an “eraser”, which should clear what has been drawn by adjusting the alpha value, but we are struggling to find a way to do this.
The way we have implemented drawing is as follows:
Initial Setup
- Create a Texture Render Target 2D to draw on
- Put it into a material so it can be shown on a Plane in the world.
When Drawing
- Find where to draw on the Plane by using a line trace and finding the collision UV
- Call Begin Draw Canvas to Render Target on the Texture Render Target 2D
- This returns a Canvas that we can draw on
- Use Draw Material on the Canvas to draw a spot,
- We use a texture that has nice faded edges
- Finally, call End Draw Canvas to Render Target
I had hoped I could call “Draw Material” with a different texture for “erasing”, but alpha values of 1 are ignored. This is perfect when drawing onto the Canvas, but when we are erasing, we need the alpha values to be applied. It would be great if there was a way to apply “alpha only”.
This has been implemented in Blueprints. We have been playing around with C++ to expose more of the engine features, but have not found a solution yet.
Thanks for the help.