#(Bi)tangents in Shader Graph with Vertex distortion

1 messages · Page 1 of 1 (latest)

grand rivet
#

How do you actually use shader graph to distort a mesh or compute UVs correctly when it happens to use normal mapping

My current shader makes a linear road mesh follow a bezier, and also is supposed to allow for both normal uv mapping and worldspace mapping
I tried to distord the normals and tangents along with the mesh, but I notice that shading is wrong sometimes

#

I determined that my distortion code correctly rotates the normals and tangents along with the positions
The problem is that part of my mesh is mirrored, which makes the .w component of the tangent vector relevant (to flip the bitangent)

For whatever reason though, the vertex output in shader graph only takes a Tangent(3) and no Bitangent, which I assume is the reason my normal mapping is messed up

#

Similarly, manually overriding UVs messes up shading, since it likely uses the mesh tangents instead of allowing you to override tangents (In my case those would just be (1,0,0)!)

#

(Bi)tangents in Shader Graph with Vertex distortion