Material intersection

Hi. Is there any way to paint some texture along intersection of 2 actors?
I need to paint some color or texture(red) on this gray plane but only in intersection points with blue sphere.

Hello FiftyStars,

There are a couple of ways to achieve this effect through material creation which I have illustrated below. Aside from the two approaches mentioned below, you could also vertex paint directly onto the objects but this does not allow for dynamic modification.

Ambient Occlusion Material Mask

This approach is fairly new to the engine, and uses the baked AO term to define where the texture will be applied. This set up takes a bit more effort and explicit instructions, and comes with its own set of limitations. Follow the link below and scroll down until you see the New: Ambient Occlusion Material Mask section to see how use this feature.

Unreal Engine 4.9 Release notes

Be sure to closely follow the instructions paying close attention to the settings applied in the ‘World Settings’ tab. Below is how your material should be set up, and the final result after baking your lighting.

The next approach is using ‘DepthFade’ to set the color where an object with a translucent material intersects an object with an opaque material. This approach is simpler and will allow for customization in regards to the range of the blend. Below is an example of the material I used and its result.

Depth Fade

Be sure to set your ‘Blend Mode’ to ‘Translucent’ as this is required to use the ‘DepthFade’ node. If you notice I have created parameters within my materials so I can create material instances for fast editing and updating the materials to get the correct look and feel.

Let me know if you have further questions, but this should get you on the right path.

Cheers,

Hi, my sphere should actually be completely transparent and that color should appear on a landscape and any other objects.

I achieved a result which is close to what i want with depthfade but its a bit problematic. Here you can see one of two problems. Real edge of the sphere is very close to camera but fake edge is far far away. It causes problems with collision events.

Yeah, i can add a bigger 100% transparent shpere for event generating. But there is still 1 more problem. This is how depthfade looks from outside. So looks like depthfade is not what I need here.

About AO Mask. As I see it works with lightmass but my sphere and lights are movable.

maybe there is a way to create a custom shape for decal actor? something like 2 spheres with different radiuses and everything between them is painted by decals. Is there any chance to achieve this?

You can’t create a custom decal shape at runtime, but you could import a texture and use it as a mask. This is possible, but you will need to have the shape correct.