This new Mesh Decal feature in 4.13, how does it work?

This Mesh Decal feature which supposedly lets me wrap a decal around a specific mesh.
It’s new so obviously there isn’t any documentation, and unfortunately there was no content example I could find.

Has anyone had any success in using it, and if so would you mind posting an example? I’m no expert on shaders and projection so I haven’t been able to figure it out

-HuntaKiller

From what i’m trying so far, it doesn’t work. I’ve found a material function called StaticMeshDecal_Function, but it causes my material to stop compiling. And no errors are shown, so i can’t even reason about what’s wrong.

Edit: wait’ it does compile now, material should be translucent. Still, without any info it’s hard to figure out how to use it.

Edit2: Okay, so i’ve got it working like this:

And the material:

hey guys, maybe this will help?

Polycount thread:
http://polycount.com/discussion/155894/decal-technique-from-star-citizen/p1

He is actually not using the new mesh decal at all. He is simply adding a Channel of normal details onto his mesh through a separate material ID. You can see in the video that he still uses it as a deferred decal, meaning he is not taking advantage of the new feature. Same seems to be for the material you posted @Elocator. If you see the commenting for the new mesh decal no, it mentions that it should not be used for deferred decals.

Mesh decals in 4.13 are just a material where you’ve set the MaterialDomain to ‘Deferred Decal’, and then assigned that material to a regular static or skeletal mesh (rather than placing a deferred decal using it). Mesh decals allow blending in of GBuffer attributes like BaseColor, Roughness, Normal, with access to the mesh’s attributes like UV, without having those layers present in the underlying material. They do not ‘wrap’ or project onto anything, unlike regular deferred decals, so you have to place them in a way that they always stay in front of the surface you want them to affect. This can be a challenge with LOD and long view distances / limited depth buffer precision.

So, is the only way to do this by making a second material ID on the mesh, allowing you to make another material that acts as the decals over the first one? You could always do that with a mask, could you not? How did 4.13 change that, and what does the StaticMeshDecal function do.

Technically you can use any mesh, not just a second material id, but yes that’s the most useful. It’s not the same as a mask, you can blend with the underlying material attributes.

Mesh decal on the left, masked on the right. Notice the hard transition with masked.

I’m not familiar with StaticMeshDecal, it’s some random material function created by an artist, not an engine code feature.

Oh, so i’ve gone off the wrong way from the start then. Thanks @DanielW! Now it at least makes sense. Is it faster/more efficient to use these decals instead of material layers through masks? Or is the effect purely visual?

Also, could you elaborate a bit on how to setup this? Just through UVs laid out specifically for this decal? What do you mean by them staying in front?

EDIT: I thought that it would be cool to use procedural geometry to project meshes with StaticMeshDecals on them. Do you think it possible? Like raytracing a plane onto static meshes in the scene and then use Merge Actors to bake it into a static mesh for example.

, I’m curious about this material function you found, even though it has nothing to do with mesh decals. I tried to get it working, but I can’t figure it out. Can you post a screenshot of the Details Panel of your material? Thanks.

Sure, here you go:
Properties.jpg

I’m not sure it’ll help you since i just set it as Surface - Translucent - Default Lit. Now, the function also says you should use box mesh that you can find in Engine/Content folder. Make sure you do that as well, i did. Mesh is called “1x1x1_Box_Pivot_-XYZ”.

currently there seem to be limitations in what can be done with Mesh Decals:

> Node: BumpOffset is not working(only tested in preview release so far) (awesome localized depth effect, very pixel shader friendly due to usage via mesh decals)
> Node: WorldAlignedTexture is not working (We use worldalignedTexture+PrecomputedAOMask for Dirt and currently our mesh decals are on top of the dirt always appearing weirdly clean. would be great if we could feed the same dirt into the mat/uvs into the mesh decal for continuity)
> Metallic: is overriden when Color is set in Dbuffer, creating discrepancy between base mesh material and decal in metallic cases

would be great to get some insight into what other limitations there are and if some of those could be worked on in upcoming updates.

Is there a was to get it working with parallax occlusion mapping?

Really wish there was parallax/bump offset support for this stuff :frowning:

there other problems too. you can merge this meshes but you cant merge the materials to one material. or do someone know a way for it?

The material image (second image) does not work, giving me Transparent.png. Anyone knows how to use the function?