Advertisement
Guest User

Shadery04_HueShift01

a guest
Mar 1st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. half3 HueShift01(half3 c, half shift)
  2. {
  3.     half3 result = c;
  4.     half u = cos(shift*3.14/180);
  5.     half w = sin(shift*3.14/180);
  6.     result.r =  (0.29 + 0.701*u + 0.168*w)*c.r +
  7.                 (0.587 - 0.587*u + 0.330*w)*c.g +
  8.                 (0.114 - 0.114*u - 0.497*w)*c.b;
  9.     result.g =  (0.299 - 0.299*u - 0.328*w)*c.r +
  10.                 (0.587 + 0.413*u + 0.035*w)*c.g +
  11.                 (0.114 - 0.114*u + 0.292*w)*c.b;
  12.     result.b =  (0.299 - 0.3*u + 1.25*w)*c.r +
  13.                 (0.587 - 0.588*u - 1.05*w)*c.g +
  14.                 (0.114 + 0.886*u - 0.203*w)*c.b;
  15.     return result;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement