Home Unreal Engine

Blending Z-axis WorldDirectionNormal with other Normal Map

polycounter lvl 14
Offline / Send Message
chrisradsby polycounter lvl 14
Hey guys!

I'm having some difficulties with my current snow shader. I've tried to figure it out myself but I've hit a wall. My current lack of complete understanding of the nodes is probably to blame here...

I've incorporated snow functionality into my already made 2-way blend shader (that is using vertex paint).

Basically, I can apply Z-axis snow on top of my Diffuse1 alternativly my Diffuse2 if I want to. But it's an option. So for my first test I wanted to get it working for one of the two textures I can blend in-between. (the reasoning why I did this is so that if I'm ever in a scenario where I don't want the Z-Axis snow to be applied to both textures)

And I actually managed to do it, wasn't all that hard. However this seems to only be working with my diffuse/spec, as soon as I try to do the exact same operation to the normal map part, ie blending a tangent space normal map (Normalmap1 + detailnormal1) with the Z-axis it doesn't work. My snow normal map gets applied to the whole mesh instead of the already Snow-Masked area.

Here is a shot:
DI_WIP06_Shader.jpg

What you see above:

The rust is basically my current Texture2 that I can blend in wherever without the snow option if I want.

The big metal panels with the bolts is my underlying metal paneling texture ie Texture1. This has a flat normal map with bolts and some tiny chipped areas. This is also the main texture-set that my snow and rust considers (heightmap and normal-information that goes into the snow)

The wavy red specular shows that my snow normal map is actually being applied to the snow and the harsh rectangular lines is the detail normal that rests on top. (I'm going to have big wavy snow and frequent prickly detail in my detail normal map)As you can see, the snow stops when the wall becomes 90* but the normalmap from the snow still creeps up the wall even though it's using the same masking.

Here is the masking-section:
DI_WIP07_Shader.jpg

I'd appreciate any insight to this guys and if you have the time, I'd love to hear a more technical explanation as well to satisfy my curiosity as to why it's not working. :thumbup:

Thanks for checking this out and reading it through!

Replies

  • mAlkAv!An
    Options
    Offline / Send Message
    mAlkAv!An polycounter lvl 5
    One issue I can spot at first glance is the normal map Lerp alpha input which is not within the [0,1] range but 0-2 (depending on the mask texture). Use a constant clamp right before it goes into the Lerp node.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Try this instead: Plug the "snow direction" into the transform node. Set it from world to tangent. Then plug that result into the dot product along with the DIffuse1_Normal. Do not transform the normal.
    Make sure you work in one coordinate space only. Since the vast majority of things you do texture wise are in tangent space, always convert into tangent if its in some other space.

    Also what malkavian says is true. Adding the dot product to the multiply makes the range from 0-2 where its white, thus breaking your lerp more easily.
Sign In or Register to comment.