SteamVR_Fade.shader
1.81 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
// UNITY_SHADER_NO_UPGRADE
Shader "Custom/SteamVR_Fade"
{
SubShader
{
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
ZTest Always
Cull Off
ZWrite Off
CGPROGRAM
#pragma vertex MainVS
#pragma fragment MainPS
// Includes -------------------------------------------------------------------------------------------------------------------------------------------------
#include "UnityCG.cginc"
#if UNITY_VERSION >= 201810
// Structs --------------------------------------------------------------------------------------------------------------------------------------------------
struct VertexInput
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput
{
float4 vertex : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
// Globals --------------------------------------------------------------------------------------------------------------------------------------------------
UNITY_INSTANCING_BUFFER_START( Props )
UNITY_DEFINE_INSTANCED_PROP( float4, fadeColor )
UNITY_INSTANCING_BUFFER_END( Props )
VertexOutput MainVS( VertexInput i )
{
VertexOutput o;
UNITY_SETUP_INSTANCE_ID( i );
UNITY_INITIALIZE_OUTPUT( VertexOutput, o );
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
o.vertex = i.vertex;
return o;
}
float4 MainPS( VertexOutput i ) : SV_Target
{
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( i );
return UNITY_ACCESS_INSTANCED_PROP( Props, fadeColor.rgba );
}
#else
float4 fadeColor;
float4 MainVS( float4 vertex : POSITION ) : SV_POSITION
{
return vertex.xyzw;
}
float4 MainPS() : SV_Target
{
return fadeColor.rgba;
}
#endif
ENDCG
}
}
}