Advertisement
Guest User

shader

a guest
Dec 28th, 2014
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. /*
  2. [configuration]
  3. [OptionBool]
  4. GUIName = Smoothing
  5. OptionName = SmoothToggle
  6. DefaultValue = true
  7.  
  8. [OptionRangeFloat]
  9. GUIName = Smoothness
  10. OptionName = Smoothness
  11. MinValue = 0.0
  12. MaxValue = 3.0
  13. StepAmount = 0.05
  14. DefaultValue = 1.0
  15. DependantOption = SmoothToggle
  16.  
  17. [OptionBool]
  18. GUIName = Lines
  19. OptionName = LineToggle
  20. DefaultValue = true
  21.  
  22. [OptionRangeFloat]
  23. GUIName = Line Thickness
  24. OptionName = Thick
  25. MinValue = 2.0
  26. MaxValue = 3.0
  27. StepAmount = 0.01
  28. DefaultValue = 2.0
  29. DependentOption = LineToggle
  30.  
  31. [OptionRangeFloat]
  32. GUIName = Line Brightness
  33. OptionName = Bright
  34. MinValue = 25
  35. MaxValue = 100
  36. StepAmount = 1
  37. DefaultValue = 50
  38. DependentOption = LineToggle
  39.  
  40. [/configuration]
  41. */
  42.  
  43. void main()
  44. {
  45. //variables
  46. float4 c0 = Sample();
  47. //Smooth
  48. if (OptionEnabled(SmoothToggle))
  49. {
  50. float4 smoothing_total = float4(0.0, 0.0, 0.0, 0.0);
  51. float smoothing_size = GetOption(Smoothness);
  52. smoothing_total += SampleLocation(GetCoordinates() + float2(-smoothing_size, -smoothing_size) * GetInvResolution());
  53. smoothing_total += SampleLocation(GetCoordinates() + float2(-smoothing_size, smoothing_size) * GetInvResolution());
  54. smoothing_total += SampleLocation(GetCoordinates() + float2( smoothing_size, -smoothing_size) * GetInvResolution());
  55. smoothing_total += SampleLocation(GetCoordinates() + float2( smoothing_size, smoothing_size) * GetInvResolution());
  56. smoothing_total += SampleLocation(GetCoordinates() + float2(-smoothing_size, 0.0) * GetInvResolution());
  57. smoothing_total += SampleLocation(GetCoordinates() + float2( smoothing_size, 0.0) * GetInvResolution());
  58. smoothing_total += SampleLocation(GetCoordinates() + float2( 0.0, -smoothing_size) * GetInvResolution());
  59. smoothing_total += SampleLocation(GetCoordinates() + float2( 0.0, smoothing_size) * GetInvResolution());
  60. smoothing_total *= 0.125;
  61. c0 = smoothing_total;
  62. }
  63. // Horizontal Scanlines
  64. if (OptionEnabled(LineToggle))
  65. {
  66. float vPos = GetCoordinates().y*GetResolution().y / GetOption(Thick);
  67. float line_intensity = (((vPos - floor(vPos)) * 9) - 4) / GetOption(Bright);
  68. c0.rgb += line_intensity;
  69. }
  70. SetOutput(c0);
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement