summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader
blob: 9d2f407721cb0196425a37451e6e8a12bebe65e9 (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
Shader "Hidden/DiffuseAndSpecularFromMetallicNode"
{
	Properties
	{
		_A ("_A", 2D) = "white" {}
		_B ("_B", 2D) = "white" {}
	}
	SubShader
	{
		Pass
		{
			CGPROGRAM
			#include "UnityCG.cginc"
			#include "UnityStandardUtils.cginc"
			#pragma vertex vert_img
			#pragma fragment frag

			sampler2D _A;
		
			float4 frag( v2f_img i ) : SV_Target
			{
				float4 albedo = tex2D( _A, i.uv );
				float metallic = tex2D( _A, i.uv ).r;
				float3 specColor = 0;
				float oneMinusReflectivity;
				float3 albedoFinal = DiffuseAndSpecularFromMetallic(albedo,metallic,specColor,oneMinusReflectivity);
				return float4( albedoFinal , 1 );
			}
			ENDCG
		}
	}
}