I need an advice to achieve a LERP inside a decal material.
What I’m looking for, is to make a linear interpolation between the left decal to the riht one (my goal is to control the thickness of a vynil stickers). The purpose is to LERP between underlying surface NM and a flatten NM.
When nothing is connected in the input normal, I get the normal map from the underlying material, which is what I’m looking for. But I would use a LERP in a single material, and I need a value to connect in the A LERP input to keep this underlying normal map… In terms of theory, I would use the value wich is used in the shader when nothing is connected but I don’t know this value.
Would anyone have an idea to achieve this?
Thanks,
No, this doesn’t work, since the 0,0,0 value is a value that covers the bottom surface.
It appears Unreal checks if normal pin is connected when compiling the material. If not, this is another DecalBlendMode that is used. In this case, if there is no Normal input, this is DBuffer Translucent Color, Roughness that is used in place of DBuffer Translucent, Color, Normal, Roughness.
So, the way would be to have a separate opacity input just for the normal channel.
But you said that you want to flatten the surface right? I am kinda too busy now, I will see what could the solution be later today if you are still struggling on this.
wild thought: can decals sample the world normal node? this way you could blend between your normal and the world normal behind the decal (you’d need to transform from world to tangent or disable tangent space normalmaps)
The reason you cannot read from the world normal scene texture in a decal material that outputs world normal is that decal materials are actually a special type of translucent material that is blended directly against the g-buffers (diffuse, normal, roughness, etc.), and it’s not (usually) possible for a fragment shader to read from the same buffer it’s writing to.
You wouldn’t need any kind of workarounds if decal materials supported independent opacity values for each output.
@NasteX , yep in this way it works, but this is a specific case since the decals should hold the same normal map that is used on the underlying surface.
I’m looking to do something more versatile.
Definitly, I think we need a multi opacity input to tweak each input like @Manoel.Neto said.
So let’s wait, hoping team dev from Epic will work on…
Just an idea, you could change the normal map at runtime based on which surface you place the stickies. For example by using line trace to detect the surface and then to pick the normal map from an array with different normal maps and change it. Its sounds complicated but when you have limitations, sometimes is better to walk around the limitations by making stuff a little bit more complicated.
On another note Epic Games doesnt really care what you as dev wants inside UE4. They only care what their games needs as a feature to be implemented. Its the sad truth…