Advertisement
bb94

Untitled

Apr 12th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. sampler sampler0_: register(s0);
  2.  
  3. static const float RENDER_WIDTH = 1024;
  4. static const float RENDER_HEIGHT = 1024;
  5.  
  6. float frame;
  7.  
  8. struct PSInput {
  9. float4 diffuse: COLOR0;
  10. float2 texCoord: TEXCOORD0;
  11. float2 vPos: VPOS;
  12. };
  13.  
  14. struct PSOutput {
  15. float4 color: COLOR0;
  16. };
  17.  
  18. // Thanks to http://www.chilliant.com/rgb2hsv.html
  19. float3 HUEtoRGB(in float H) {
  20. float R = abs(H * 6 - 3) - 1;
  21. float G = 2 - abs(H * 6 - 2);
  22. float B = 2 - abs(H * 6 - 4);
  23. return saturate(float3(R, G, B));
  24. }
  25.  
  26. PSOutput PSColorful(PSInput In): COLOR0 {
  27. PSOutput Out;
  28. float hue = frac((2 * (In.vPos.x - In.vPos.y) + 5 * frame) / 360);
  29. float3 color = HUEtoRGB(hue);
  30. Out.color.a = In.diffuse.a;
  31. Out.color.rgb = 0.5 * color;
  32. return Out;
  33. }
  34.  
  35. technique TecColorful {
  36. pass P0 {
  37. PixelShader = compile ps_3_0 PSColorful();
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement