简体   繁体   中英

How to transform normal map from tangent space to world space using Unity Shader Graph?

I'm creating a custom lighting shader using the Unity Shader Graph and I want to add support for normal maps. I've read a bit and from what I understand I need to transform my normal map from tangent space to world space. I've watched this video , where around 8:00 mark there is a formula for calculating this: Red * Tangent + Green * Bitangent + Blue * Normal . I've tried to recreate it like this: 着色图

And here is how the normal is read: 普通的

This issue is that it doesn't seem to work. The normals are correct only if the object has no rotation (look at the position of the reflections): 诺罗

However if I rotate it upside down the lighting is also upside down:

腐烂

What am I doing wrong?

If you want to translate a vector from tangent to world space, you could use the Transform Node:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM