Advertisement
Guest User

Color ramp shader

a guest
Jun 6th, 2018
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 0.65 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.    RAMP SHADER
  4.    -->
  5. <shader language="HLSL">
  6.   <source><![CDATA[
  7.  //These variables will get set automatically
  8. texture rubyTexture;
  9.  
  10. sampler s0 = sampler_state { texture = <rubyTexture>; };
  11.  
  12. float ramp(float c)
  13. {
  14.     return c > 0.5 ? c : 0.24*c + 2.22*c*c - 1.4*c*c*c;
  15. }
  16.  
  17. float4 NormalColourPass( in float2 Tex : TEXCOORD0 ) : COLOR0
  18. {
  19.     float4 color = tex2D( s0, Tex );
  20.     color.a = 1;
  21.    
  22.     color.r = ramp(color.r);
  23.     color.g = ramp(color.g);
  24.     color.b = ramp(color.b);
  25.  
  26.     return color;
  27. }
  28.  
  29. Technique T0
  30. {
  31.    pass p0 { PixelShader = compile ps_2_0 NormalColourPass(); }
  32. }
  33.  ]]></source>
  34. </shader>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement