A game about forced loneliness, made by TACStudios
1// UNITY_SHADER_NO_UPGRADE
2#ifndef UNITY_GRAPHFUNCTIONS_INCLUDED
3#define UNITY_GRAPHFUNCTIONS_INCLUDED
4
5// ----------------------------------------------------------------------------
6// Included in generated graph shaders
7// ----------------------------------------------------------------------------
8
9#ifndef BUILTIN_TARGET_API
10bool IsGammaSpace()
11{
12 #ifdef UNITY_COLORSPACE_GAMMA
13 return true;
14 #else
15 return false;
16 #endif
17}
18#endif
19
20float4 ComputeScreenPos (float4 pos, float projectionSign)
21{
22 float4 o = pos * 0.5f;
23 o.xy = float2(o.x, o.y * projectionSign) + o.w;
24 o.zw = pos.zw;
25 return o;
26}
27
28struct Gradient
29{
30 int type;
31 int colorsLength;
32 int alphasLength;
33 float4 colors[8];
34 float2 alphas[8];
35};
36
37Gradient NewGradient(int type, int colorsLength, int alphasLength,
38 float4 colors0, float4 colors1, float4 colors2, float4 colors3, float4 colors4, float4 colors5, float4 colors6, float4 colors7,
39 float2 alphas0, float2 alphas1, float2 alphas2, float2 alphas3, float2 alphas4, float2 alphas5, float2 alphas6, float2 alphas7)
40{
41 Gradient output =
42 {
43 type, colorsLength, alphasLength,
44 {colors0, colors1, colors2, colors3, colors4, colors5, colors6, colors7},
45 {alphas0, alphas1, alphas2, alphas3, alphas4, alphas5, alphas6, alphas7}
46 };
47 return output;
48}
49
50// https://bottosson.github.io/posts/oklab/ for perceptual blend mode in gradients
51float3 LinearToOklab(float3 rgb)
52{
53 float l = 0.4122214708f * rgb.r + 0.5363325363f * rgb.g + 0.0514459929f * rgb.b;
54 float m = 0.2119034982f * rgb.r + 0.6806995451f * rgb.g + 0.1073969566f * rgb.b;
55 float s = 0.0883024619f * rgb.r + 0.2817188376f * rgb.g + 0.6299787005f * rgb.b;
56
57 float l_ = pow(l, 0.333333f);
58 float m_ = pow(m, 0.333333f);
59 float s_ = pow(s, 0.333333f);
60
61 return float3(
62 0.2104542553f * l_ + 0.7936177850f * m_ - 0.0040720468f * s_,
63 1.9779984951f * l_ - 2.4285922050f * m_ + 0.4505937099f * s_,
64 0.0259040371f * l_ + 0.7827717662f * m_ - 0.8086757660f * s_);
65}
66
67float3 OklabToLinear(float3 lab)
68{
69 float l_ = lab.r + 0.3963377774f * lab.g + 0.2158037573f * lab.b;
70 float m_ = lab.r - 0.1055613458f * lab.g - 0.0638541728f * lab.b;
71 float s_ = lab.r - 0.0894841775f * lab.g - 1.2914855480f * lab.b;
72
73 float l = l_ * l_ * l_;
74 float m = m_ * m_ * m_;
75 float s = s_ * s_ * s_;
76
77 return float3(
78 4.0767416621f * l - 3.3077115913f * m + 0.2309699292f * s,
79 -1.2684380046f * l + 2.6097574011f * m - 0.3413193965f * s,
80 -0.0041960863f * l - 0.7034186147f * m + 1.7076147010f * s);
81}
82
83#ifndef SHADERGRAPH_SAMPLE_SCENE_DEPTH
84 #define SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv) shadergraph_SampleSceneDepth(uv)
85#endif
86
87#ifndef SHADERGRAPH_SAMPLE_SCENE_COLOR
88 #define SHADERGRAPH_SAMPLE_SCENE_COLOR(uv) shadergraph_SampleSceneColor(uv)
89#endif
90
91#ifndef SHADERGRAPH_SAMPLE_SCENE_NORMAL
92 #define SHADERGRAPH_SAMPLE_SCENE_NORMAL(uv) shadergraph_SampleSceneNormal(uv)
93#endif
94
95#ifndef SHADERGRAPH_BAKED_GI
96 #define SHADERGRAPH_BAKED_GI(positionWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap, applyScaling) shadergraph_BakedGI(positionWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap, applyScaling)
97#endif
98
99#ifndef SHADERGRAPH_REFLECTION_PROBE
100 #define SHADERGRAPH_REFLECTION_PROBE(viewDir, normalOS, lod) shadergraph_ReflectionProbe(viewDir, normalOS, lod)
101#endif
102
103#ifndef SHADERGRAPH_FOG
104 #define SHADERGRAPH_FOG(position, color, density) shadergraph_Fog(position, color, density)
105#endif
106
107#ifndef SHADERGRAPH_AMBIENT_SKY
108 #define SHADERGRAPH_AMBIENT_SKY float3(0,0,0)
109#endif
110
111#ifndef SHADERGRAPH_AMBIENT_EQUATOR
112 #define SHADERGRAPH_AMBIENT_EQUATOR float3(0,0,0)
113#endif
114
115#ifndef SHADERGRAPH_AMBIENT_GROUND
116 #define SHADERGRAPH_AMBIENT_GROUND float3(0,0,0)
117#endif
118
119#ifndef SHADERGRAPH_OBJECT_POSITION
120 #define SHADERGRAPH_OBJECT_POSITION GetAbsolutePositionWS(UNITY_MATRIX_M._m03_m13_m23)
121#endif
122
123#ifndef SHADERGRAPH_RENDERER_BOUNDS_MIN
124 #define SHADERGRAPH_RENDERER_BOUNDS_MIN float3(0, 0, 0)
125#endif
126#ifndef SHADERGRAPH_RENDERER_BOUNDS_MAX
127 #define SHADERGRAPH_RENDERER_BOUNDS_MAX float3(0, 0, 0)
128#endif
129
130float shadergraph_SampleSceneDepth(float2 uv)
131{
132 return 1;
133}
134
135float3 shadergraph_SampleSceneColor(float2 uv)
136{
137 return 0;
138}
139
140float3 shadergraph_SampleSceneNormal(float2 uv)
141{
142 return 0;
143}
144
145float3 shadergraph_BakedGI(float3 positionWS, float3 normalWS, uint2 positionSS, float2 uvStaticLightmap, float2 uvDynamicLightmap, bool applyScaling)
146{
147 return 0;
148}
149
150float3 shadergraph_ReflectionProbe(float3 viewDir, float3 normalOS, float lod)
151{
152 return 0;
153}
154
155void shadergraph_Fog(float3 position, out float4 color, out float density)
156{
157 color = 0;
158 density = 0;
159}
160
161#endif // UNITY_GRAPHFUNCTIONS_INCLUDED