x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

Unoccluded area

Product Version: UE 4.14
Tags:
more ▼

asked Nov 26 '16 at 04:59 AM in Rendering

avatar image

BananasGoMoo
41 2 6 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

alt text

The result :

Purple jelly will always in front of pink jelly!

alt text

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

sortpiority.png (56.2 kB)
result.png (380.3 kB)
more ▼

answered Nov 26 '16 at 07:11 AM

avatar image

Smomo
179 13 17 33

avatar image BananasGoMoo Nov 26 '16 at 08:03 PM

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.

avatar image Smomo Nov 26 '16 at 08:24 PM

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

alt text

1.png (77.1 kB)
avatar image BananasGoMoo Nov 26 '16 at 08:29 PM

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?

avatar image Smomo Nov 26 '16 at 08:33 PM

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

avatar image BananasGoMoo Nov 26 '16 at 08:35 PM

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

avatar image Smomo Nov 26 '16 at 08:48 PM

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)

avatar image BananasGoMoo Nov 26 '16 at 08:49 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

First, create a UMG. That call it "Occlude Image" alt text

In your character blueprint, add a Widget component alt text

Set up the widget, Space set to "Screen" so it will act like billboard alt text

Result alt text

mask.png (108.9 kB)
giveitawidget.png (37.1 kB)
result.png (175.4 kB)
more ▼

answered Nov 26 '16 at 09:04 PM

avatar image

Smomo
179 13 17 33

avatar image BananasGoMoo Nov 26 '16 at 09:14 PM

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 - https://www.youtube.com/watch?v=XYPPd5oLoPM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question