1. // Adrian Cruceru
    2. // Redshift Rendering Technologies 2020
    3. // channel shuffler
    4. // This file is licensed under Apache 2.0 license
    5. shader ColorShuffle
    6. [[ string help = "Shuffles Channels",
    7. string label = "Shuffle Channels",
    8. string category = "Color" ]]
    9. (
    10. color inColor = color(0,0,0)
    11. [[ string label="Input" ]],
    12. int inR = 0
    13. [[ string label= "Red Channel",
    14. string widget = "mapper",
    15. string options = "Red:0|Green:1|Blue:2" ]],
    16. float redScale = 1
    17. [[ string label = "Red Scale",
    18. float min = 0,
    19. float max = 1]],
    20. int inG = 1
    21. [[ string label= "Green Channel",
    22. string widget = "mapper",
    23. string options = "Red:0|Green:1|Blue:2" ]],
    24. float greenScale = 1
    25. [[ string label = "Green Scale",
    26. float min = 0,
    27. float max = 1]],
    28. int inB = 2
    29. [[ string label= "Blue Channel",
    30. string widget = "mapper",
    31. string options = "Red:0|Green:1|Blue:2" ]],
    32. float blueScale = 1
    33. [[ string label = "Blue Scale",
    34. float min = 0,
    35. float max = 1]],
    36. output float outRed = 1
    37. [[ string label = "Red Output"]],
    38. output float outGreen = 1
    39. [[ string label = "Green Output"]],
    40. output float outBlue = 1
    41. [[ string label = "Blue Output"]],
    42. output color outColor = 1
    43. [[ string label = "Out Color"]]
    44. )
    45. {
    46. outRed = inColor[inR]*redScale;
    47. outGreen = inColor[inG]*greenScale;
    48. outBlue = inColor[inB]*blueScale;
    49. outColor = color(outRed,outGreen,outBlue);
    50. }