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"

Get Coordinates Based on a Material Instance

Hi there,

I just watched this video here and created my own landscape map.

Basically I have used three material functions (grass, stone and soil) and blended / masked them together into one material which gives me smooth transitions from grass to dirt to rock. I have then made and instance of that material and applied it to my terrain mesh.

What I need to know:

In a blueprint script I am using a LineTraceByChannel to get a bunch of random hit locations on the terrain. For each of these hits I would like to know what material is being displayed at that location, is it grass, rock or dirt? I don't suppose this is even possible when using an instance of such a highly masked and blended material?

Thanks for your help!

Product Version: UE 4.12
more ▼

asked Jul 25 '16 at 01:15 PM in Using UE4

avatar image

133 31 30 34

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

1 answer: sort voted first

Okay the only way I found possible to achieve my goal is like that:

I got the normal vector from the LineTraceByChannel at the specified location on the terrain. I now have to check whether it has the normal value at an acceptable angle or not.

My grass is located on more or less flat ground, as defined in the material. Since the normal value on the z axis at 1 defines a flat surface I have made a branch that checks if the z value < 0.9 and if that's true then, at this location, the terrain must be too steep for grass (must be rock or dirt).

Hope this will help someone else in the future!

more ▼

answered Jul 26 '16 at 07:35 AM

avatar image

133 31 30 34

(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