Created
August 22, 2022 02:32
-
-
Save allanvobraun/7065ddd3372156a14c86b8a134938708 to your computer and use it in GitHub Desktop.
Shader preto e branco
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/preto_e_branco_shader" | |
{ | |
Properties | |
{ | |
_MainTex ("Texture", 2D) = "black" {} | |
} | |
SubShader | |
{ | |
Pass | |
{ | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
uniform sampler2D _MainTex; | |
struct VertexInput | |
{ | |
float4 vertex : POSITION; | |
float4 texCoord : TEXCOORD0; | |
}; | |
struct VertexOutput | |
{ | |
float4 pos : SV_POSITION; | |
float4 texCoord : TEXCOORD0; | |
}; | |
VertexOutput vert(VertexInput input) | |
{ | |
VertexOutput output; | |
output.pos = UnityObjectToClipPos(input.vertex); | |
output.texCoord = input.texCoord; | |
return output; | |
} | |
float4 frag(VertexInput input) : Color | |
{ | |
float4 color = tex2D(_MainTex, input.texCoord.xy); | |
float colorm = color.w *0.3 + 0.59 *color.x + 0.11* color.y; | |
return float4(colorm,colorm,colorm, color.z ); | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment