I add shadows/grime where the metal meets the wood. Similar to ambient occlusion, but way more pronounced.
However, I have gotten to the point where some of my assets are for modular use, for instance placing a torch on a wall.
This means I cannot pre-paint this effect, as their placement isn’t pre-planned.
So I am trying to see if I can figure out a way to darken the area around where I place objects dynamically.
I do not want depthfade, as they are depth-based and will show the objects behind what I’m trying to shade.
I seem to remember have been able to do something similar when experimenting with a water shader using distance fields. But I haven’t quite figured out how to use them this time, and are they resource expensive? Is perhaps a blueprint object with a decal better?
A few other ways:
Material only: You check Distance between the wall and the material - in absolute world position. - object position is a node, for the wall position you’d have to pass to the object via vector parameter - or simply create material instances and instance them for each set of assets based on the wall location.
BP to Material.
The BP does the math, the Material implements the shader based on the math.
In BP you can expose a couple variables that you can then select from within the level - say actor static mesh as type (or similar, it’s an actual entry if you type static mesh, and it’s whatever a static mesh becomes when dragged into the level. A wall, is usually this type).
Do the calculations with BP on the Begin Play node (lower performance impact). and pass the values required to a dynamic material instance.
The other material only techniques would be based on transparency - you don’t want to do that for non transparent objects. it’s way too expensive performance wise.
And the way you were talking about seems more like a Post Process effect.
I suppose you could always go that route too
But mesh distance fields weren’t working last time I tried it.
I want just to add to what [USER=“3140864”]MostHost LA[/USER] have already suggested. You can use the AO pass inside a postprocess material and use custom stencil of the barrels to mask out the AO effect to be only on the barrels.
You can develop more the math after the AO for more finer control on look. In terms of performance I am a bit unsure how big is the impact compared to decals.
Fantastic suggestions from both of you, thanks! I’ll definitely get something going with this.
I also got distance fields working now, but found landscape distance field extremely strong and not usable in combination with distance fields from static meshes. But it gave me some ideas of how to use it as a mask for other purposes.