pixelgon/Assets/Materials/Shaders/Quad.shader
2020-06-05 11:54:36 -07:00

62 lines
No EOL
1.2 KiB
Text

Shader "Custom/Quad"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Cull Off
Pass
{
CGPROGRAM
#pragma vertex VertexProgram
#pragma fragment FragmentProgram
// #include "UnityCG.cginc"
#include "UnityStandardBRDF.cginc"
struct VertexData
{
fixed4 position : POSITION;
// fixed3 normal : NORMAL;
fixed4 color : COLOR;
float2 uv : TEXCOORD0;
};
struct Interpolators
{
fixed4 position : SV_POSITION;
// fixed3 normal : TEXCOORD1;
fixed4 color : COLOR0;
float2 uv : TEXCOORD0;
// fixed attenuation : TEXCOORD2;
};
sampler2D _MainTex;
float4 _MainTex_ST;
Interpolators VertexProgram (VertexData v)
{
Interpolators i;
i.position = UnityObjectToClipPos(v.position);
// i.normal = UnityObjectToWorldNormal(v.normal);
i.uv = TRANSFORM_TEX(v.uv, _MainTex);
i.color = v.color;
return i;
}
fixed4 FragmentProgram (Interpolators i) : SV_TARGET
{
fixed4 col = tex2D(_MainTex, i.uv);
return i.color * col;
}
ENDCG
}
}
}