Derive vertex normal WS from normal map

Within the context of the vertex shader and a mesh having no UVs (using triplanar mapping), I cannot use the VertexNormalWS material node. I need to derive an equivalent value from the normal map. I have tried a few things but none of them really worked so far. Any idea?

Have you tried using the Pixel Normal WS node?

cannot be used on the vertex shader!

I don’t think I’m getting the gist of the question. What stops you from using VertexNormalWS?

I don’t have UVs, so this does not return a valid value. The point is to use tri-planar mapping with tesselation and I need the vertex normal to orient my tesselation direction.

I think the problem I am facing is the same as this one : https://forums.unrealengine.com/development-discussion/rendering/72451-tesselation-and-triplanar-mapping-issues
Apparently the guy found a workaround but it is not clear to me what it is…

That seems wrong. Not having UVs only means that you don’t have tangent space defined. It has nothing to do with vertex normals.

What are you using to blend between 3 different projections in tri-plannar mapping ?

I am not entirely sure of that one indeed :slight_smile: I thought this could be the reason, maybe it is not.

I am using the technique described in this video to apply tri-planar (at about 3:15): https://www.youtube.com/watch?v=8aYe54XrZYI
This gives UVs I am applying to the diffuse and normal. Then when applying the tesselation scale, I multiply the height map (which has been UVed by the triplanar calculations too) by a scale factor then multiply it by the vertex normal WS to orient it.

UPDATE: I actually seem to have the desired result when using VertexNormalWS, sorry I got confused through the many tests I made. So the actual swimming problem I have is when adapting the tesselation multiplier using distance from camera (with meshes only). I cannot use PixelDepth node on the vertex shader so I am using Camera Position minus Absolute World Position which should provide the same result. I can adapt tesselation multipler this way fine for landscape textures, but not on meshes, there I have a swimming effect. I have the impression that either Camera Position or Absolute World Position doesn’t return valid results when used on meshes.

CameraPosition minus absolute world position is float3. You need to take Distance from CameraPosition to Absolute world position.(or just calculate length of camera relative world position). So you are probably just using x axis distance.

yes yes I am calculating the length between both, I didn’t mention the whole calculation, just the main items. But for some reason this tesselation multiplier modulation with distance is producing swimming on meshes and not on landscape. Am I alone to have this problem really?