Getting pixel normal from normal map


I have an interesting problem. Funny thing is, I would have thought this had been answered already, but try as I might to search using various terms, I don’t see this anywhere.

The short version is, I am trying to get the pixel normal at a given point in my graph, knowing I will be using the results to change the final pixel normal. I can’t use the pixelnormalWS constant node, since that creates a circular reference exception when I then use the result to try to blend two normal maps into the normal node.

So here’s what I am trying to do: I have a rock face texture which gets much of its detail from normal and displacement maps. I need to be able to take the “up” facing ledges and cracks and apply things like gravel/dust or grass. These, of course, will have their own normal maps which will be blended into the FINAL normal node.

My present attempts are to take the normal map’s BLUE channel and multiply it by the BLUE channel of the vertexnormalWS. It’s not turning out right. I think it’s because the “BLUE” channel in the normal map is what faces straight OUT, correct? How would I determine which channel faces UP in world space once applied to the surface?

Note that I am using normal maps created from Substance. Not sure how much that matters.

So my basic requirement is: be able to use the world-space pixel normal of a point on the material as an alpha which will determine the final actual normal.

Plug the tangent normal there and transform it to world space.

Thank you! I will give this a try!

That was exactly what I needed. Thanks again!