Hi there,
Lately i’ve been working on a mini-game in which you remove condensation from a window. The idea is to allow the player to draw/write on a window with his finger/cursor (brush).
As i see it, i need to be able to select Pixels in a given zone and fade alpha to 0.
I spent some time looking for a way to do it and quickly found several options :
1 - Shaders
—> Nop, beyond my coding competence
2 - Get/SetPixels with render textures
I found a nice asset on the asset store, but soon i realized it didn’t fit my needs : this asset as most of “painting” assets just add sprites based on UV coordinates.
What i’m trying to do is different : i need to fade alpha from a given range of texture coordinates.
Here is how i think i should do it :
STEP 1:
So first : mouse raycast hit → convert to UV coordinates
This way i know where the player is pointing his finger.
STEP 2 : Select UV coordinates based on a brush texture
My Brush :

This is where i struggle… How can i tell the program :
" Here is my texture, place it on the UV coordinate (inherited from STEP 1) of the canvas, then getpixels (uv coordinates) that are inside the black dot ?"
My guess :
1 - Apply brush on canvas texture
2 - Check all pixels color, get black ones and add to array…
3 - Change alpha of the model uv based on this array…
Is this a way to do it ? It feels… Is it going to be fast enough ?
STEP 3 : Use SetPixel to set alpha to 0.
I should be able to code step 1 and 3, but how can i achieve step 2 ?
Thank you,