float _Threshold;
//float _Intensity;
TEXTURE2D_X(_MainTex);
float4 CustomPostProcess(Varyings input) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
// Note that if HDUtils.DrawFullScreen is used to render the post process, use ClampAndScaleUVForBilinearPostProcessTexture(input.texcoord.xy) to get the correct UVs
float3 sourceColor = SAMPLE_TEXTURE2D_X(_MainTex, s_linear_clamp_sampler, input.texcoord).xyz;
// Calculate grayscale value using Rec. 709 formula
float luminance = dot(sourceColor, float3(0.2126, 0.7152, 0.0722));
// Determine whether color is bright or dark
float isBright = step(luminance, 0.07);
// Convert to black or white
float3 color = lerp(float3(1, 1, 1), float3(0, 0, 0), isBright);
float3 oc = color* float3(1.0, 0.0, 0.0);
return float4(oc, 1);
}