Created
September 6, 2015 14:51
-
-
Save EsProgram/b5a03832807fc4ac539a to your computer and use it in GitHub Desktop.
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/GrayScaleVF" { | |
Properties{ | |
_MainTex("Main", 2D) = "white" {} | |
} | |
SubShader{ | |
Lighting Off | |
Pass{ | |
CGPROGRAM | |
#pragma vertex vert_img | |
#pragma fragment frag | |
#include "UnityCG.cginc" | |
sampler2D _MainTex; | |
float4 frag(v2f_img i) :COLOR{ | |
float4 tex_col = tex2D(_MainTex, i.uv); | |
//NTSC Coef. methodによるグレースケーリング | |
tex_col.rgb = (2 * tex_col.r + 4 * tex_col.g + tex_col.b) / 7; | |
return tex_col; | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
グレースケールするシェーダ