FontPixelShader.hlsl 432 B

123456789101112131415161718192021222324252627
  1. Texture2D ShaderTexture : register(t2);
  2. SamplerState SampleType : register(s0);
  3. struct PS_INPUT
  4. {
  5. float4 Position : SV_POSITION;
  6. float2 Tex : TEXCOORD0;
  7. float4 Color : COLOR0;
  8. };
  9. struct PS_OUTPUT
  10. {
  11. float4 RGBColor : SV_TARGET;
  12. };
  13. PS_OUTPUT main(PS_INPUT In)
  14. {
  15. PS_OUTPUT Output;
  16. float t = ShaderTexture.Sample(SampleType, In.Tex).r;
  17. if (t < 0.5)
  18. discard;
  19. Output.RGBColor = float4(In.Color.rgb, t);
  20. return Output;
  21. }