Download

Drawing Polygon on Screen

Hi,

I have four vectors as locations. I would like to draw anything that can make that area black but I’m not sure what the best way to go about it is.

It must not be able to overlap itself regardless of which points go where which means chucking four joints on a plane will not work.

It must be able to be occluded by objects. Though, nothing will interact with it.

What are my options?

Bump… surely there’s a way to draw a black rectangle/polygon by defining 4 points?

You could just use blueprints to reposition/rescale a plane

As I said quite specifically, this isn’t going to work.

How would a plane overlap itself?

Where’s the confusion?

Re-positioning and scaling indicates you think they’re going to be uniform, or even remotely predictable.

A plane is a piece of geometry, if I move the vertices to each location unless they happen to go in the same direction as the plane, it’ll overlap itself and break.


I have a feeling I could do it with post-processing by drawing any object that should be visible with custom depth - assuming I can switch it on/off at runtime.

Thing is, I have very little experience with it and not sure where to begin with such a specific task. Also it seems to be different for finding locations from an orthographic camera (I can’t use perspective since its an isometric RPG).

You would face the same issue as you would trying to draw a polygon. In any case, you’d have to do some scripting. If you wanted to draw a polygon you’d have to develop something for it. How decals work would probably be dealing with the same issues.

What about using a post process to do this? Compare the 4 points against the world position of each pixel to draw a black area. This should also handle the occlusion.

That’s what I was thinking, but I haven’t delved into post processing much… yet.

Can you elaborate with a small example of how you’d do this? If you can spare the time :slight_smile:

Cheers