Bump offset in decal material

Hello!

I’ve made a decal material with a normal map attached, and I’m now attempting to get that normal map to distort using a parallax heightmap. However, for some reason, this seems to have no effect on the material. The height map appears to be totally ignored. I’ve set up a bump offset node, and am feeding the heightmap into it, but there is no change to the resulting decal. I have no idea why this would be, since the parallax node is independent of the rendering pipeline, I’m merely stating what I’m seeing.

Here is the material graph:

The TextureScale node scales and offsets the UV coordinates (useful for using instanced materials at multiple scales). Otherwise all these parameters are set via blueprints (though I have also tested with texture samplers directly in the graph, with no change).

I find it extremely odd that this would cause a problem, but hopefully it’s just something stupid I’ve done.

Hey Hoeloe -

What is your Bump Offset Height Ratio set at in the details panel of your Bump Offset Node?

Thank You

Eric Ketchum

I have not changed it from the default value.

Hey Hoeloe -

I was able to get the decal to correctly render with the BumpOffset_Advanced Material Function. Can you try replacing the your Bump Offset node with the Material Function and see if you rendering corrects itself, for reference, I used a reference plane of 0.5 and a straight camera vector WS node.

Let me know -

Eric Ketchum

Well, I tried that, but I’m not sure how to use the results of the BumpOffset_Advanced function - they all seem to produce odd results.

Hey Hoeloe -

I’m trying to get a good example for you, but I wanted to know what your Texture Scale Material Function math is doing?

Thank You

Eric Ketchum

Ah, sorry about that! Here’s the material graph:

As you can see, it alters the UVs to allow multiple loops of the material. I find this is useful when instancing materials to place them on multiple meshes with different UV maps.

Hey Hoeloe -

Try this setup and see if it gives your the parallax distortion you are after.

Thank You

Eric Ketchum

I applied this to a simple vertical gradient height map and associated normal map, and this is the result:

When in the world, it looks somewhat like it is reflecting the inside of a sphere with darker stripes around it, and not at all like it is displaced.

Hey Hoeloe -

Thank You for your patience. I was able to finally track this down and it is indeed a bug with Decals not being able to read the tangent space defined in the Bump Offset. I have entered a bug report, TTP# 339889, and will keep you informed as our Engineers work toward a resolution.

Thank You

Eric Ketchum

Thank you very much! It’s good to know that the source of the issue has been discovered, at least!

I’m not sure if this is related, but world aligned textures don’t seem to work on decals, either. I’ve just tried adding a world-aligned normal map, and they don’t read correctly on one axis. If this is related, it might be useful to know, if not, I’ll ask in another question about how to resolve this.

Old thread update time…

If you modify

.\Engine\Shaders\DeferredDecal.usf block of MATERIAL_TANGENTSPACENORMAL to

// tangent/decal space to world space
#if MATERIAL_TANGENTSPACENORMAL		
		float3x3 Flip =	{ 
							float3(0,0,1), 
							float3(0,1,0),
							float3(-1,0,0)
						};

		MaterialParameters.TangentToWorld = mul(Flip, (float3x3)DecalToWorld );
		MaterialParameters.TangentNormal = GetMaterialNormal(MaterialParameters);
		MaterialParameters.WorldNormal = normalize(TransformTangentVectorToWorld(MaterialParameters.TangentToWorld, MaterialParameters.TangentNormal));
#else
		float3 Normal = GetMaterialNormal(MaterialParameters);
		MaterialParameters.WorldNormal = normalize(Normal);
#endif

It should now include the critical TangentToWorld transform utilized in the material expression.

Hi sleeper -

This looks like it would fix the issue, have you entered a pull request on GitHub to integrate this change with the engine source code? If so please let me know the pull request number and I will bring it to our engineeer’s attention. If not (or even if you have), put a note that this pull request will fix the issue reported as UE-3738.

Thank You -

Eric Kethcum

The problem still seems to be active. Is there any fix arriving soon maybe?