How can i make a Range material that shows blocked areas?

I am making a Tower Defense game and its my first game, so i don’t really know how to make it.

What i am trying to make is a range material that appears in the ground showing the tower range, like in Bloons TD.

The areas that are current block turn red, showing that this tower cannot attack there.

The tower can already detect if a enemy is behind something and doesn’t shoot, and i already made a circle that shows the tower range

I just don’t have any idea how to make the red shows up. I tried using ChatGPT and he told to use Arctangent2 node or Render Target, but i didn’t really understand.

This is the current “code” of range material:

Hey there @Gravilyt2! I think a method somewhat like this could work for your use case, let me know if it works out!

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

2 Likes

Thank you so much. I was trying to solve it for about 4 hours. It’s almost exactly what i was trying to make, i just need to adapt some things to my case. Just one last question. How did you find this video? I can never find what i want and never know how to search it

1 Like

No problem! I think for this search I used “Unreal Engine Line of Sight Material”, though I’ve implemented this a couple times, if I couldn’t find a video on it I would have made a demo for it, but this saves time and can be adapted pretty quickly to most use cases similar to it. These can also be used to make fog of war with a couple of changes.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.