-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathConfigurablePropertyDrawers.shader
102 lines (90 loc) · 2.26 KB
/
ConfigurablePropertyDrawers.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigurablePropertyDrawers.shader" company="Supyrb">
// Copyright (c) 2018 Supyrb. All rights reserved.
// </copyright>
// <repository>
// https://github.com/supyrb/ConfigurableShaders
// </repository>
// <author>
// Johannes Deml
// public@deml.io
// </author>
// <documentation>
// https://github.com/supyrb/ConfigurableShaders/wiki/PropertyDrawers
// </documentation>
// --------------------------------------------------------------------------------------------------------------------
Shader "Configurable/Reference/PropertyDrawers"
{
Properties
{
[HeaderHelpURL(HeaderHelp URL, https, github.com supyrb ConfigurableShaders wiki PropertyDrawers)]
[EightBit] _EightBit ("EightBit", Int) = 0
[RangeMapper01] _RangeMapper01("RangeMapper01", Vector) = (0,1,0,1)
[RangeMapper] _RangeMapper("RangeMapper", Vector) = (0,1,0,1)
[SimpleToggle] _SimpleToggle("SimpleToggle", Float) = 0.0
[Tooltip(Tooltip Text)] _Tooltip("Tooltip", Float) = 0.0
[Ramp] _RampTex ("Color Ramp (RGBA)", 2D) = "white" {}
}
CGINCLUDE
#include "UnityCG.cginc"
struct v2f
{
float4 vertex : SV_POSITION;
};
v2f vert (float4 vertex : POSITION)
{
v2f o;
o.vertex = UnityObjectToClipPos(vertex);
return o;
}
half4 frag (v2f i) : SV_Target
{
return half4(1,1,1,1);
}
struct v2fShadow {
V2F_SHADOW_CASTER;
UNITY_VERTEX_OUTPUT_STEREO
};
v2fShadow vertShadow( appdata_base v )
{
v2fShadow o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
return o;
}
float4 fragShadow( v2fShadow i ) : SV_Target
{
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
SubShader
{
Tags { "RenderType"="Opaque" "Queue" = "Geometry" }
LOD 100
Cull Off
ZWrite On
ZTest LEqual
ColorMask RGBA
Pass
{
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
ENDCG
}
// Pass to render object as a shadow caster
Pass
{
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
CGPROGRAM
#pragma vertex vertShadow
#pragma fragment fragShadow
#pragma target 2.0
#pragma multi_compile_shadowcaster
ENDCG
}
}
}