blob: 86a2adcc5b703f5d313a939ee010fad0031260e1 (
plain)
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
|
Shader "Hidden/SubstanceSamplerNode"
{
Properties
{
_A ("_UV", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert_img
#pragma fragment frag
sampler2D _A;
sampler2D _GenTex;
int _CustomUVs;
float4 frag( v2f_img i ) : SV_Target
{
float2 uvs = i.uv;
if( _CustomUVs == 1 )
uvs = tex2D( _A, i.uv ).xy;
float4 genTex = tex2D( _GenTex, uvs);
return genTex;
}
ENDCG
}
Pass
{
CGPROGRAM
#include "UnityCG.cginc"
#pragma vertex vert_img
#pragma fragment frag
sampler2D _A;
sampler2D _GenTex;
int _CustomUVs;
float4 frag( v2f_img i ) : SV_Target
{
float2 uvs = i.uv;
if( _CustomUVs == 1 )
uvs = tex2D( _A, i.uv ).xy;
float3 genTex = UnpackNormal( tex2D( _GenTex, uvs ) );
return float4( genTex, 0 );
}
ENDCG
}
}
}
|