Download

How to transform normal from tangent space to world space?

Background:
I am working on shader for landscape with virtual heightfield mesh (VHM). It consists of two parts: static (RVT cache) and dynamic (weather). For the second part I need to blend snow with RVT cache based on collection parameter. I create snow material, it has normals in tangent space so I convert it into world space with help of “TransformVector” node. It works with landscape but does not work with VHM. My guess VHM is just plane and does not have same information about normals and tangents.
So I came up with idea to pipe normals and tangets with help of another RVT.

Question:
How to transform normal from tangent space to world space by using vertex normals and vertex tangents?
I found this formula:
float3 ws_normal = tangent * ts_normal.x + binormal * ts_normal.y + normal * ts_normal.z;
and implemented function:


This is my test setup:

But it does not work same as “TransformVector” node. What am I missing?