There is probably not much more I can say about that. I'm trying to get the tangent space view direction in a surface shader (in the surf() function) but I can't seem to figure out how, so after searching for a solution for quite some time I'm coming back here to ask you guys.
------
The last thing I got (after a few other iterations that didn't work) is this:
struct Input {
// [...]
float3 worldTangentDir : TEXCOORD0;
};
void vert (inout appdata_full v, out Input o) {
// [...]
TANGENT_SPACE_ROTATION; // create rotation matrix
o.worldTangentDir = mul( rotation, ObjSpaceViewDir( v.vertex ) );
}
void surf (Input IN, inout SurfaceOutputStandard o) {
// [...]
o.Albedo = abs(IN.worldTangentDir);
}
What I expect would be to see different colors on my mesh representing the tangent view direction *(kind of like when you map the normals to the output Albedo so each pixel gets colored accordingly)*. But what I get is just black. Any ideas on this one?
---
Thanks in advance!
↧