Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
2.9 KiB

  1. ; DYNAMIC: "MODE" "0..8"
  2. ps.1.1
  3. //HALF Grey( HALF3 input )
  4. //{
  5. // return dot( ( float3 )( 1.0f / 3.0f ), input );
  6. //}
  7. #if MODE == 0
  8. // negative greyscale of scene * gman
  9. // float scale = 1.0f / 3.0f;
  10. // scene.xyz = dot( float3( scale, scale, scale), scene.xyz );
  11. // scene = 1.0f - scene;
  12. // return float4( scene * gman, g_Alpha );
  13. def c1, 0.333333343, 0.333333343, 0.333333343, 1
  14. def c2, 1, 0, 0, 0
  15. tex t0
  16. tex t1
  17. dp3 r0, c1, t0
  18. add r0.w, -r0.w, c1.w
  19. mul r0.xyz, t1, r0.w
  20. dp3 r1, c2, c0
  21. mov r0.w, r1.w
  22. #endif
  23. #if MODE == 1
  24. //if( Grey( gman ) < 0.3 )
  25. // return float4( 1.0f - gman, g_Alpha );
  26. //else
  27. // return float4( ( 1.0f - gman ) * scene, g_Alpha );
  28. def c1, 0.333333343, 0.333333343, 0.333333343, 0.300000012
  29. def c2, 1, 1, 1, 1
  30. def c3, 1, 0, 0, 0.5
  31. tex t0
  32. tex t1
  33. dp3 r1, c1, t1
  34. add t0.w, r1.w, -c1.w
  35. + add r1.xyz, -t1, c2
  36. dp3 t1, c3, c0
  37. mov t1.w, t1.w
  38. + mul t1.xyz, t0, r1
  39. dp3 t2, c3, c0
  40. mov r1.w, t2.w
  41. mad r0.w, t0.w, -c2.w, c3.w
  42. cnd r0, r0.w, r1, t1
  43. #endif
  44. #if MODE == 2
  45. // return float4( lerp( scene, gman, g_Alpha ), g_Alpha );
  46. def c1, 1, 0, 0, 1
  47. def c2, 0, 0, 0, 1
  48. tex t0
  49. tex t1
  50. dp3 r0, c1, c0
  51. mul r0.w, r0.w, -c1.w
  52. add r0.w, r0.w, c2.w
  53. add r1.w, -r0.w, c2.w
  54. + mul r0.xyz, t0, r0.w
  55. mad r0.xyz, t1, r1.w, r0
  56. dp3 r1, c1, c0
  57. mov r0.w, r1.w
  58. #endif
  59. #if MODE == 3
  60. // return float4( lerp( scene, Grey( gman ), Grey( gman ) ), g_Alpha );
  61. def c1, 0.333333343, 0.333333343, 0.333333343, 1
  62. def c2, 1, 0, 0, 0
  63. tex t0
  64. tex t1
  65. dp3 r0, c1, t1
  66. add r1.w, -r0.w, c1.w
  67. mul r1.xyz, t0, r1.w
  68. mad r0.xyz, r0, r0, r1
  69. dp3 r1, c2, c0
  70. mov r0.w, r1.w
  71. #endif
  72. #if MODE == 4
  73. // return float4( lerp( scene, gman, g_Alpha ), g_Alpha );
  74. def c1, 1, 0, 0, 1
  75. def c2, 0, 0, 0, 1
  76. tex t0
  77. tex t1
  78. dp3 r0, c1, c0
  79. mul r0.w, r0.w, -c1.w
  80. add r0.w, r0.w, c2.w
  81. add r1.w, -r0.w, c2.w
  82. + mul r0.xyz, t0, r0.w
  83. mad r0.xyz, t1, r1.w, r0
  84. dp3 r1, c1, c0
  85. mov r0.w, r1.w
  86. #endif
  87. #if MODE == 5
  88. //float sceneLum = scene.r;
  89. //if( sceneLum > 0.0f )
  90. // return float4( scene, g_Alpha );
  91. //else
  92. // return float4( gman, g_Alpha );
  93. def c1, 1, 0, 0, 1
  94. def c2, 0, 0, 0, 0.45
  95. tex t0 ; gman (sceneLum)
  96. tex t1 ; scene
  97. dp3 r1, c1, c0
  98. mov t1.w, r1.w ; t1.w = alpha
  99. dp3 r1, c1, c0
  100. mov t0.w, r1.w ; t0.w = alpha
  101. dp3 r1, c1, t0 ; r1.w = gman.r
  102. add r0, r1.w, c2.w
  103. cnd r0, r0.w, t0, t1
  104. #endif
  105. #if MODE == 6
  106. // return float4( scene + gman, g_Alpha );
  107. def c1, 1, 0, 0, 0
  108. tex t0
  109. tex t1
  110. add r0.xyz, t0, t1
  111. dp3 r1, c1, c0
  112. mov r0.w, r1.w
  113. #endif
  114. #if MODE == 7
  115. // return float4( lerp( scene, gman, g_Alpha ), g_Alpha );
  116. def c1, 1, 0, 0, 1
  117. def c2, 0, 0, 0, 1
  118. tex t0
  119. tex t1
  120. dp3 r0, c1, c0
  121. mul r0.w, r0.w, -c1.w
  122. add r0.w, r0.w, c2.w
  123. add r1.w, -r0.w, c2.w
  124. + mul r0.xyz, t0, r0.w
  125. mad r0.xyz, t1, r1.w, r0
  126. dp3 r1, c1, c0
  127. mov r0.w, r1.w
  128. #endif
  129. #if MODE == 8
  130. // return float4( lerp( scene, gman, g_Alpha ), g_Alpha );
  131. def c1, 1, 0, 0, 1
  132. def c2, 0, 0, 0, 1
  133. tex t0
  134. tex t1
  135. dp3 r0, c1, c0
  136. mul r0.w, r0.w, -c1.w
  137. add r0.w, r0.w, c2.w
  138. add r1.w, -r0.w, c2.w
  139. + mul r0.xyz, t0, r0.w
  140. mad r0.xyz, t1, r1.w, r0
  141. dp3 r1, c1, c0
  142. mov r0.w, r1.w
  143. #endif