Highlighting an area/rectangle on the floor

In my game I want the player to be able to highlight an area on the floor.
When he clicks and holds the mouse while moving it, I want to hightlight that area he is “painting”.
For example to show where something would be built.

Something like this:

295615-highlight-area.png

Unfortunately I have no clue how to achieve that, as I have basically no experience with materials.
Or do I even need a material?

Can you guys guide me into the right direction?

the simplest highlight is just a two sided additive material with a solid color. though your pic looks more like a one sided opaque material on a mesh that has the normal facing inwards(or a normal cube that has the reverse culling checkbox selected).

Thanks for the hint with the two sided additive material. But how can I define the rectangle to use, or in other words, how do I define the bounds where this material should be applied? An on to what should it be applied?

I was thinking you could use a cube with that two sided additive material and just scale it to whatever dimensions you need. So the area the material is applied is just the cube itself.
I may not understand what you’re trying to do though.

This can be easily achieved with a deferred decal actor. What you need are:

A simple translucent unlit deferred decal material:

A deferred decal actor:

295688-decalactor.png

Set your material to the decal then you have a piece of highlighted floor, and you can scale it to any size:

Docs on deferred decal: Decal Actor User Guide | Unreal Engine Documentation

I’m pretty sure you could use either custom depth or stencils to filter what receives decals.

Since you may want to use custom depth for something else i’d tend to go with stencils. (They’ll need to be turned on in the project settings.)
https://forums.unrealengine.com/development-discussion/rendering/1540297-can-we-not-apply-a-decal-to-a-single-actor

Ok, that looks very promising, thanks. There is one catch, however: I want that only the floor receivces that decal. Now I can set decals for all other objects in my game to False, but then they would receive no decals at all.

Is there a way to achieve this maybe via the material?

Awesome, thanks a lot!