Draw an area through other objects?

Hello,

I’m trying to draw an area (or an object) through other objects, so it always appears in front.

I was hoping I could make some kind of shape that I could drag through the level, that only some objects could be seen through, but I’m not sure how to do that.

Basically in this area, it would draw everything except the occluding object(s). I was thinking of having a second camera that would draw everything except the object but I’m not sure how I would display just a small section of that camera on the viewport I already have, or how I would prevent drawing the occluding object(s) but draw everything else.

Here is a picture, it isn’t a great picture but it should get the point across:

http://i.imgur.com/fMRINQj.png

You can use “Translucency Sort Priority” option in detail panel under Rendering category

But this option only work if object has translucent material.
Give your occluding object a translucent material, than set “Translucency Sort Priority” to a value greater than 0 or higher

116442-sortpiority.png

The result :

Purple jelly will always in front of pink jelly!

116443-result.png

Attach a large object (plane is best I think) with a circle transparent material and attach to your player.
The object will follow the player and occlude everything except the transparent area on the object

Hi. Thanks for the suggestion, but it didn’t really work at all. It drew the circle above everything else, but not the character or the other objects being occluded.

Ok, this seems like it would work, but having everything be translucent materials causes a lot of lag, which won’t work for the game. Do you think there’s any other way to do it?

Sorry about unclear answer

I am saying that make a plane with a hole(use translucent material)
and attach to player as a child, so it will move together.

This plane can occlude everything that in front of or behind it because of the Translucency Sort Priority.

But the disadvantage is that all objects must have translucent materials

116483-1.png

Or use a mask image(a “hole” image ) in UMG and follow the player position.

Convert the world location to screen point then move the image.

But it’s hard to calculate the coordinate between world and screen because of DPI scale

Does your camera always face player? If so, use widget component in actor will work perfectly and need no code.

(I may post a new answer to explain how to set up)

Do you have an example of how to set that up? That sound like what I want.

yeah the camera always faces the player. We’re using the camera setup from the topdown template.

Ok, the problem with this is that the object is always occluding the screen. the problem I have is that I have some random 3D objects in the world, and sometimes they get between the player and the camera. I want the parts of the models that are between the player and the camera to not be drawn. It’s not that I want an object with a hole in it, it’s that I want basically a cylinder from the camera to the player to prevent objects being rendered inside that area.

Basically like this - - YouTube

The problem with that is that it’s always a sphere and I want to make it more of a cylinder, which I wouldn’t know how to do.

First, create a UMG. That call it “Occlude Image”

116484-mask.png

In your character blueprint, add a Widget component

116485-giveitawidget.png

Set up the widget, Space set to “Screen” so it will act like billboard

Result