FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Unity3D-CG-programming/binormals.shader at master · ParsGameLab/Unity3D-CG-programming · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ParsGameLab
/
Unity3D-CG-programming
Public
forked from
przemyslawzaworski/Unity3D-CG-programming
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Unity3D-CG-programming
/
binormals.shader
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (36 loc) · 807 Bytes
Breadcrumbs
Unity3D-CG-programming
/
binormals.shader
Copy path
File metadata and controls
43 lines (36 loc) · 807 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//Debug binormals (called also bitangents
)
Shader
"Binormals"
{
Subshader
{
Pass
{
CGPROGRAM
#pragma
vertex vertex_shader
#pragma
fragment pixel_shader
#pragma
target
2.0
struct
structure
{
float4
vertex :
SV_POSITION
;
float4
color :
COLOR
;
};
float3
cross
(
float3
a,
float3
b)
{
return
a.yzx*b.zxy-a.zxy*b.yzx;
}
structure
vertex_shader
(
float4
vertex:
POSITION
,
float3
normal:
NORMAL
,
float4
tangent:
TANGENT
)
{
structure vs;
vs.vertex =
UnityObjectToClipPos
(vertex);
float3
binormal =
cross
(normal,tangent.xyz)*tangent.w;
vs.color =
float4
(binormal*
0.5
+
0.5
,
1.0
);
return
vs;
}
float4
pixel_shader
(structure ps ) :
SV_TARGET
{
return
ps.color;
}
ENDCG
}
}
}
Back
|
FazBrowse Home
|
New Git URL