bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-Hidden_Grayscale_Effect-in.txt

42 lines
968 B
Text
Raw Normal View History

2012-04-03 23:30:07 -04:00
struct v2f_vertex_lit {
vec2 uv;
vec4 diff;
vec4 spec;
};
struct v2f_img {
vec4 pos;
vec2 uv;
};
struct appdata_img {
vec4 vertex;
vec2 texcoord;
};
uniform sampler2D _MainTex;
uniform float _RampOffset;
uniform sampler2D _RampTex;
float Luminance( in vec3 c );
vec4 frag( in v2f_img i );
float Luminance( in vec3 c ) {
return dot( c, vec3( 0.220000, 0.707000, 0.0710000));
}
vec4 frag( in v2f_img i ) {
vec4 original;
float grayscale;
vec2 remap;
vec4 xlat_var_output;
original = texture2D( _MainTex, i.uv);
grayscale = Luminance( original.xyz );
remap = vec2( (grayscale + _RampOffset), 0.500000);
xlat_var_output = texture2D( _RampTex, remap);
xlat_var_output.w = original.w ;
return xlat_var_output;
}
void main() {
vec4 xl_retval;
v2f_img xlt_i;
xlt_i.pos = vec4(0.0);
xlt_i.uv = vec2( gl_TexCoord[0]);
xl_retval = frag( xlt_i);
gl_FragData[0] = vec4( xl_retval);
}