Download

Combine normals on Dbuffer deferred decals.

Is there a way to combine the normal map of the deferred decal with the normal of the underlying material?
I basically have a texture Atlas with a bunch of normals on it, projecting onto meshes, it’s getting the color,metalness and roughness values of the underlying material but the normal of the decal is overriding the normal of the material.
Anyone know of some voodoo i can do to combine the normals?

51e79158d9f9f9d0191fdd3f7f2b418e0f8a655c.png

Settings you’re looking for are found on the side, near the buffer blend settings. One of those options will be what you’re looking for :slight_smile:

+1 is appreciated

I’m already blending by Dbuffer translucent normal, I’m after some sort of extended functionality to read the underlying normal map and combine it with the decal shader.

You can read the normal that is already in the gbuffer using a SceneTexture node. You will then need to transform the normal from world space to tangent space with a TransformVector node so you can mix it with your map.

The engine doesn’t seem to allow you to both read and output the world normals when using the Gbuffer decals, and the Dbuffer decals don’t allow the use of the SceneTexture node at all. I think it was one of the git commits that mentioned this was just the first iteration of mesh decals, so maybe we’ll see some normal blending functionality put in at some point.

For a situational solution, if your decal is only doing normal blending and not affecting any other channels, you can use the inverse blue channel of your decal normal map as an opacity map. It’ll basically make the unmodified flat normal color (128,128,255) parts of your decal normals transparent, which will allow the underlying normal’s to show through.

blend.gif
351e33f7f81ed5956368f659e4ce2a9ad0ec7c22.jpeg

Multiplying the normal helps it show through a bit more.

If you needed to also blend a matching roughness and/or diffuse texture, I suppose you could have two decal meshes on top of each other. The normal only one using this technique, and then another copy above it without the opacity map and instead blending just diffuse and roughness channels. Of your course then you’re dealing with two separate materials and probably a bunch of overdraw so maybe not the best solution.

Oh snap, I was really excited for Owens method but yeah, as you said the scene texture node is off limits to the deferred decal system.
Hopefully a dev can chime in and let us know if we can expect some normal blending in the future.

Ah yes, I forgot that the DBuffer pass comes before the base pass, so that it can affect static lighting. So probably anything that mixes normals would have to happen during the base pass somehow, and right now would require modifying the built in shaders.

The SceneTexture approach might work for non-DBuffer deferred decals though, with the caveat that it only affects dynamic lighting.

I tried around and this is a little hack which works okeyish: Reduce Decal-Opacity and Increase Normal Strength: