-
-
Notifications
You must be signed in to change notification settings - Fork 233
/
Copy pathDebug Bitangents.shader
45 lines (39 loc) · 1.02 KB
/
Debug Bitangents.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Shader "Procedural Toolkit/Debug/Binormals"
{
SubShader
{
Pass
{
Fog { Mode Off }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 position : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
};
struct v2f
{
float4 position : SV_POSITION;
float4 color : COLOR;
};
v2f vert (appdata v)
{
v2f o;
o.position = UnityObjectToClipPos(v.position);
float3 binormal = cross(v.normal, v.tangent.xyz) * v.tangent.w;
o.color.rgb = binormal * 0.5 + 0.5;
o.color.a = 1;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return i.color;
}
ENDCG
}
}
}