-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCombinedTextures.shader
More file actions
69 lines (58 loc) · 1.42 KB
/
CombinedTextures.shader
File metadata and controls
69 lines (58 loc) · 1.42 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
Shader "Hidden/CombinedTextures"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
}
CGINCLUDE
#include "UnityCG.cginc"
#include "Utils.cginc"
Texture2D _MainTex;
SamplerState my_trilinear_clamp_sampler;
float4 _MainTex_TexelSize;
Texture2D _darkTexture;
SamplerState sampler_darkTexture;
Texture2D _edgeTexture;
SamplerState sampler_edgeTexture;
struct Input
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};
Varyings vertex(in Input input)
{
Varyings output;
output.vertex = UnityObjectToClipPos(input.vertex.xyz);
output.uv = input.uv;
#if UNITY_UV_STARTS_AT_TOP
if (_MainTex_TexelSize.y < 0)
output.uv.y = 1. - input.uv.y;
#endif
return output;
}
float4 fragment(in Varyings input) : SV_Target
{
// Dark texture
float4 darkOutput = _darkTexture.SampleLevel(sampler_darkTexture, input.uv, 0);
// Edge detection texture
float4 edgeOutput = _edgeTexture.SampleLevel(sampler_edgeTexture, input.uv, 0);
return float4((darkOutput + edgeOutput).rgb, 1);
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vertex
#pragma fragment fragment
ENDCG
}
}
}