How to properly expose Normal map input in a material function?

I got stuck on an issue for a good hour now, maybe anyone knows what am I missing? I am trying to create a generic “blend object with landscape” material based on mesh vertex color, and I have a material function which blends input textures with world oriented landscape textures. All works well except for normal input:

When blending the original normal only (A), everything looks good. But I can’t have a hard-coded sample in a function that’s supposed to be used in different materials with different normals tho, so I thought to replace it with an input which I then sample (sampler set to normal) and blend with landscape’s world aligned normal. The result of the input (B) is all kinds of screwed up.

Am I doing something wrong in the setup? Replacing the B input with param removes the issue, but then I can’t use the function inside other materials as param is accessible only in instances.

I haven’t done a blend like this, but I did some RVT based blending.

In this case, you need to get the normals of the Z plane only. Then try to blend only the bottom of the tree. Also, make sure your tiling size is the same on both ground and in the tree.

That’s second time I hear about RVT today lol, probably a hint I should look into it, thanks! Although just getting z-plane only doesn’t really affect anything.

Quixel has a nice little rundown on RVT blending.

Bump, nobody knows what’s up with the normals? Looking at the world normals buffer, it seems the normal map, which can be seen through normal material on the right tree, is not applied properly at all in my vertex blend material rather than being inverted as I originally thought.

As far, as i know, LERPing normals is not the best way to blend them. Instead try this method here for blending, it seems to produce accurate results.

1 Like

Thanks for the tip, that’s a cool technique to know! Although the issue doesn’t seem to be caused by lerping two normals - video also does it earlier in the process. I did try it tho, and the issue is still there. Although it seems that the normal that is applied from the Input is completely broken as can be seen in the preview - it’s single color instead of actual supplied preview.

The normal that Texture Sample outputs is not same as preview I feed into Input Normal and I am not sure where it goes wrong.

EDIT: Nvm, after some… random attempts switching stuff the setup from video suddenly started working. Thanks a lot! :smiley:

My only 2c on it is…
Convert it from using texture objects to using V3 inputs, so you can place it inside anything without having to go back to the original texture.

You could break material attributes at any point and just pass any value into the function…

Allows you to also manually blend landscape layers potentially (except not because it’s vertex paint based, but that’s another story).