Question 1- If the polygon has a random or changeable shape then I don't know but a simple general procedure for Question 2 is:
Figure out the size of the rectangle of overlap (using a rectangle around each shape). Check pixels in the relevant area of each shape - if both are set increase your counter. I made a diagram to better explain :smiley: but this would be a very expensive procedure if repeated frequently of the shapes were large.
I'm making the assumption that you can grab part of your viewport into a texture (don't know Godot well enough yet!) but image.get_pixel(x, y) allows you to read pixels directly.
