File tree 1 file changed +43
-0
lines changed
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ //Debug binormals (called also bitangents)
2
+
3
+ Shader "Binormals"
4
+ {
5
+ Subshader
6
+ {
7
+ Pass
8
+ {
9
+ CGPROGRAM
10
+ #pragma vertex vertex_shader
11
+ #pragma fragment pixel_shader
12
+ #pragma target 2.0
13
+
14
+ struct structure
15
+ {
16
+ float4 vertex : SV_POSITION ;
17
+ float4 color : COLOR ;
18
+ };
19
+
20
+ float3 cross (float3 a, float3 b)
21
+ {
22
+ return a.yzx*b.zxy-a.zxy*b.yzx;
23
+ }
24
+
25
+ structure vertex_shader (float4 vertex:POSITION ,float3 normal:NORMAL ,float4 tangent:TANGENT )
26
+ {
27
+ structure vs;
28
+ vs.vertex = UnityObjectToClipPos (vertex);
29
+ float3 binormal = cross (normal,tangent.xyz)*tangent.w;
30
+ vs.color = float4 (binormal*0.5 +0.5 ,1.0 );
31
+ return vs;
32
+ }
33
+
34
+ float4 pixel_shader (structure ps ) : SV_TARGET
35
+ {
36
+ return ps.color;
37
+ }
38
+
39
+ ENDCG
40
+
41
+ }
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments