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"

Line trace an opacity mask

Is there a way for a line trace to determine whether it's hitting an opaque (white) or transparent (black) part of a masked material applied to a plane?
I need it to hit the image in the centre of a plane, but ignore the transparent area surrounding it. Any thoughts?

Product Version: UE 4.15
Tags:
more ▼

asked Jul 21 '17 at 03:54 PM in Rendering

avatar image

Kibblesticks
151 3 12 19

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

1 answer: sort voted first

option 1. Add some collision primitive(s) (box or sphere) to this actor just on desired part, and detect line trace with it.

option 2. Model mesh that have the same shape as desired image, turn on per poly collision (use complex collision as simple) for it, place it over that mesh as hidden, and detect line trace with it.

more ▼

answered Jul 21 '17 at 05:00 PM

avatar image

redbox
4.2k 80 17 103

avatar image Kibblesticks Jul 22 '17 at 01:02 PM

Thanks for the suggestions redbox, unfortunately I don't know how big the images are going to be so I can't create a coll box. Modelling is a work around but it's an awful lot more work as we'll be using this for tens, maybe hundreds of different shapes.

avatar image redbox Jul 22 '17 at 05:30 PM

UE3 had a feature called "Physical Material Mask", that allows you to set black/white texture and apply 2 physical materials to surface. In UE4 its still in backlog, but maybe you can develop it on your own.

https://docs.unrealengine.com/udk/Three/PhysicalMaterialMask.html

One more option is to detect color of hit surface by getting it from color buffer. So the invisible part of image will be filled with solid color, like (0.5,0.5,0.5), and you will ignore line trace when it hit.

https://wiki.unrealengine.com/Render_Target_Lookup

avatar image Kibblesticks Jul 22 '17 at 07:39 PM

Really interesting avenue to explore, thanks very much Redbox!

(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