Advertisement
Guest User

Untitled

a guest
Jan 26th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float4 mainImage(VertData v_in) : TARGET
  2. {
  3.  float4 base = image.Sample(textureSampler, v_in.uv);
  4.  
  5.  float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
  6.  float4 p = lerp(float4(base.bg, K.wz), float4(base.gb, K.xy), step(base.b, base.g));
  7.  float4 q = lerp(float4(p.xyw, base.r), float4(base.r, p.yzx), step(p.x, base.r));
  8.  float d = q.x - min(q.w, q.y);
  9.  float e = 1.0e-10;
  10.  float3 hsv = float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
  11.  
  12.  hsv[0] += 0.5;
  13.  
  14.  float4 N = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
  15.  float3 f = abs(frac(hsv.xxx + N.xyz) * 6.0 - N.www);
  16.  float3 rgb = hsv.z * lerp(N.xxx, clamp(f - N.xxx, 0.0, 1.0), hsv.y);
  17.  
  18.  base.rgb = rgb;
  19.  
  20.  return base;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement