Skip to content

Instantly share code, notes, and snippets.

@smokelore
Created July 26, 2016 11:51
Show Gist options
  • Select an option

  • Save smokelore/55d4b499ceae94da9e6e1689caf0c7d6 to your computer and use it in GitHub Desktop.

Select an option

Save smokelore/55d4b499ceae94da9e6e1689caf0c7d6 to your computer and use it in GitHub Desktop.
Shader "CookbookShaders/Multiply"
{
Properties
{
_Color ("Color", Color) = (1, 0, 0, 1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 _Color;
sampler2D _MainTex;
struct vertInput
{
float4 pos : POSITION;
float2 texcoord : TEXCOORD0;
};
struct vertOutput
{
float4 pos : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
vertOutput vert(vertInput input)
{
vertOutput o;
o.pos = mul(UNITY_MATRIX_MVP, input.pos);
o.texcoord = input.texcoord;
return o;
}
half4 frag(vertOutput output) : COLOR
{
half4 mainColor = tex2D(_MainTex, output.texcoord);
return mainColor * _Color;
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment