three-stdlib 2.35.4 → 2.35.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (514) hide show
  1. package/_polyfill/CapsuleGeometry.cjs +17 -20
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +17 -20
  4. package/_polyfill/CapsuleGeometry.js.map +1 -1
  5. package/_polyfill/constants.cjs +1 -1
  6. package/_polyfill/constants.cjs.map +1 -1
  7. package/_polyfill/constants.js +1 -1
  8. package/_polyfill/constants.js.map +1 -1
  9. package/animation/AnimationClipCreator.cjs +13 -13
  10. package/animation/AnimationClipCreator.cjs.map +1 -1
  11. package/animation/AnimationClipCreator.js +13 -13
  12. package/animation/AnimationClipCreator.js.map +1 -1
  13. package/animation/CCDIKSolver.cjs +11 -11
  14. package/animation/CCDIKSolver.cjs.map +1 -1
  15. package/animation/CCDIKSolver.js +12 -12
  16. package/animation/CCDIKSolver.js.map +1 -1
  17. package/animation/MMDAnimationHelper.cjs +1 -1
  18. package/animation/MMDAnimationHelper.cjs.map +1 -1
  19. package/animation/MMDAnimationHelper.js +1 -1
  20. package/animation/MMDAnimationHelper.js.map +1 -1
  21. package/animation/MMDPhysics.cjs +4 -4
  22. package/animation/MMDPhysics.cjs.map +1 -1
  23. package/animation/MMDPhysics.js +4 -4
  24. package/animation/MMDPhysics.js.map +1 -1
  25. package/controls/ArcballControls.cjs +2 -2
  26. package/controls/ArcballControls.cjs.map +1 -1
  27. package/controls/ArcballControls.js +3 -3
  28. package/controls/ArcballControls.js.map +1 -1
  29. package/controls/FirstPersonControls.cjs +1 -1
  30. package/controls/FirstPersonControls.cjs.map +1 -1
  31. package/controls/FirstPersonControls.js +1 -1
  32. package/controls/FirstPersonControls.js.map +1 -1
  33. package/controls/OrbitControls.cjs +2 -2
  34. package/controls/OrbitControls.cjs.map +1 -1
  35. package/controls/OrbitControls.js +3 -3
  36. package/controls/OrbitControls.js.map +1 -1
  37. package/controls/PointerLockControls.cjs +2 -2
  38. package/controls/PointerLockControls.cjs.map +1 -1
  39. package/controls/PointerLockControls.js +3 -3
  40. package/controls/PointerLockControls.js.map +1 -1
  41. package/csm/CSM.cjs +4 -4
  42. package/csm/CSM.cjs.map +1 -1
  43. package/csm/CSM.js +5 -5
  44. package/csm/CSM.js.map +1 -1
  45. package/csm/CSMFrustum.cjs +1 -1
  46. package/csm/CSMFrustum.cjs.map +1 -1
  47. package/csm/CSMFrustum.js +2 -2
  48. package/csm/CSMFrustum.js.map +1 -1
  49. package/deprecated/Geometry.cjs +715 -722
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +716 -723
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +1 -2
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +2 -3
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +1 -2
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +2 -3
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +1 -2
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +2 -3
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +122 -133
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +21 -23
  68. package/exporters/DRACOExporter.js +122 -133
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +167 -170
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +167 -170
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +515 -524
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +515 -524
  77. package/geometries/LightningStrike.js.map +1 -1
  78. package/geometries/RoundedBoxGeometry.cjs +1 -1
  79. package/geometries/RoundedBoxGeometry.cjs.map +1 -1
  80. package/geometries/RoundedBoxGeometry.js +2 -2
  81. package/geometries/RoundedBoxGeometry.js.map +1 -1
  82. package/helpers/RaycasterHelper.cjs +2 -2
  83. package/helpers/RaycasterHelper.cjs.map +1 -1
  84. package/helpers/RaycasterHelper.js +3 -3
  85. package/helpers/RaycasterHelper.js.map +1 -1
  86. package/helpers/VertexNormalsHelper.cjs +3 -3
  87. package/helpers/VertexNormalsHelper.cjs.map +1 -1
  88. package/helpers/VertexNormalsHelper.js +4 -4
  89. package/helpers/VertexNormalsHelper.js.map +1 -1
  90. package/helpers/VertexTangentsHelper.cjs +2 -2
  91. package/helpers/VertexTangentsHelper.cjs.map +1 -1
  92. package/helpers/VertexTangentsHelper.js +3 -3
  93. package/helpers/VertexTangentsHelper.js.map +1 -1
  94. package/interactive/InteractiveGroup.cjs +1 -1
  95. package/interactive/InteractiveGroup.cjs.map +1 -1
  96. package/interactive/InteractiveGroup.js +2 -2
  97. package/interactive/InteractiveGroup.js.map +1 -1
  98. package/interactive/SelectionBox.cjs +15 -15
  99. package/interactive/SelectionBox.cjs.map +1 -1
  100. package/interactive/SelectionBox.js +16 -16
  101. package/interactive/SelectionBox.js.map +1 -1
  102. package/libs/chevrotain.cjs +1 -1
  103. package/libs/chevrotain.cjs.map +1 -1
  104. package/libs/chevrotain.js +1 -1
  105. package/libs/chevrotain.js.map +1 -1
  106. package/libs/lottie.cjs +1 -1
  107. package/libs/lottie.cjs.map +1 -1
  108. package/libs/lottie.js +1 -1
  109. package/libs/lottie.js.map +1 -1
  110. package/libs/opentype.cjs +1 -1
  111. package/libs/opentype.cjs.map +1 -1
  112. package/libs/opentype.js +1 -1
  113. package/libs/opentype.js.map +1 -1
  114. package/lights/LightProbeGenerator.cjs +5 -5
  115. package/lights/LightProbeGenerator.cjs.map +1 -1
  116. package/lights/LightProbeGenerator.js +5 -5
  117. package/lights/LightProbeGenerator.js.map +1 -1
  118. package/lights/RectAreaLightUniformsLib.cjs +3 -3
  119. package/lights/RectAreaLightUniformsLib.cjs.map +1 -1
  120. package/lights/RectAreaLightUniformsLib.js +3 -3
  121. package/lights/RectAreaLightUniformsLib.js.map +1 -1
  122. package/lines/LineMaterial.cjs +1 -2
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +2 -3
  125. package/lines/LineMaterial.js.map +1 -1
  126. package/lines/LineSegments2.cjs +13 -13
  127. package/lines/LineSegments2.cjs.map +1 -1
  128. package/lines/LineSegments2.js +14 -14
  129. package/lines/LineSegments2.js.map +1 -1
  130. package/lines/LineSegmentsGeometry.cjs +2 -2
  131. package/lines/LineSegmentsGeometry.cjs.map +1 -1
  132. package/lines/LineSegmentsGeometry.js +3 -3
  133. package/lines/LineSegmentsGeometry.js.map +1 -1
  134. package/lines/Wireframe.cjs +3 -3
  135. package/lines/Wireframe.cjs.map +1 -1
  136. package/lines/Wireframe.js +4 -4
  137. package/lines/Wireframe.js.map +1 -1
  138. package/loaders/BasisTextureLoader.cjs +435 -441
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +435 -441
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +1 -2
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +2 -3
  145. package/loaders/EXRLoader.js.map +1 -1
  146. package/loaders/FBXLoader.cjs +2 -2
  147. package/loaders/FBXLoader.cjs.map +1 -1
  148. package/loaders/FBXLoader.js +2 -2
  149. package/loaders/FBXLoader.js.map +1 -1
  150. package/loaders/FontLoader.cjs +2 -2
  151. package/loaders/FontLoader.cjs.map +1 -1
  152. package/loaders/FontLoader.d.ts +2 -2
  153. package/loaders/FontLoader.js +2 -2
  154. package/loaders/FontLoader.js.map +1 -1
  155. package/loaders/GLTFLoader.cjs +2 -2
  156. package/loaders/GLTFLoader.cjs.map +1 -1
  157. package/loaders/GLTFLoader.js +2 -2
  158. package/loaders/GLTFLoader.js.map +1 -1
  159. package/loaders/KTX2Loader.cjs +374 -377
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +374 -377
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +4 -5
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +5 -6
  166. package/loaders/LDrawLoader.js.map +1 -1
  167. package/loaders/OBJLoader.cjs +5 -5
  168. package/loaders/OBJLoader.cjs.map +1 -1
  169. package/loaders/OBJLoader.js +6 -6
  170. package/loaders/OBJLoader.js.map +1 -1
  171. package/loaders/PRWMLoader.cjs +43 -46
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +43 -46
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1688 -1694
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1688 -1694
  178. package/loaders/SVGLoader.js.map +1 -1
  179. package/loaders/XLoader.cjs +1 -1
  180. package/loaders/XLoader.cjs.map +1 -1
  181. package/loaders/XLoader.js +1 -1
  182. package/loaders/XLoader.js.map +1 -1
  183. package/math/Capsule.cjs +3 -3
  184. package/math/Capsule.cjs.map +1 -1
  185. package/math/Capsule.js +3 -3
  186. package/math/Capsule.js.map +1 -1
  187. package/math/ColorConverter.cjs +9 -9
  188. package/math/ColorConverter.cjs.map +1 -1
  189. package/math/ColorConverter.js +9 -9
  190. package/math/ColorConverter.js.map +1 -1
  191. package/math/ConvexHull.cjs +50 -53
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +50 -53
  194. package/math/ConvexHull.js.map +1 -1
  195. package/math/ImprovedNoise.cjs +1 -1
  196. package/math/ImprovedNoise.cjs.map +1 -1
  197. package/math/ImprovedNoise.js +1 -1
  198. package/math/ImprovedNoise.js.map +1 -1
  199. package/math/MeshSurfaceSampler.cjs +2 -2
  200. package/math/MeshSurfaceSampler.cjs.map +1 -1
  201. package/math/MeshSurfaceSampler.js +2 -2
  202. package/math/MeshSurfaceSampler.js.map +1 -1
  203. package/math/OBB.cjs +14 -14
  204. package/math/OBB.cjs.map +1 -1
  205. package/math/OBB.js +15 -15
  206. package/math/OBB.js.map +1 -1
  207. package/math/Octree.cjs +7 -7
  208. package/math/Octree.cjs.map +1 -1
  209. package/math/Octree.js +8 -8
  210. package/math/Octree.js.map +1 -1
  211. package/misc/ConvexObjectBreaker.cjs +268 -271
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +269 -272
  214. package/misc/ConvexObjectBreaker.js.map +1 -1
  215. package/misc/Gyroscope.cjs +6 -6
  216. package/misc/Gyroscope.cjs.map +1 -1
  217. package/misc/Gyroscope.js +7 -7
  218. package/misc/Gyroscope.js.map +1 -1
  219. package/modifiers/CurveModifier.cjs +1 -1
  220. package/modifiers/CurveModifier.cjs.map +1 -1
  221. package/modifiers/CurveModifier.js +2 -2
  222. package/modifiers/CurveModifier.js.map +1 -1
  223. package/modifiers/SimplifyModifier.cjs +2 -2
  224. package/modifiers/SimplifyModifier.cjs.map +1 -1
  225. package/modifiers/SimplifyModifier.js +2 -2
  226. package/modifiers/SimplifyModifier.js.map +1 -1
  227. package/objects/BatchedMesh.cjs +2 -2
  228. package/objects/BatchedMesh.cjs.map +1 -1
  229. package/objects/BatchedMesh.js +3 -3
  230. package/objects/BatchedMesh.js.map +1 -1
  231. package/objects/GroundProjectedEnv.cjs +1 -2
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +2 -3
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +206 -209
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +206 -209
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +146 -154
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +146 -154
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +180 -183
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +180 -183
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +161 -164
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +161 -164
  250. package/objects/Refractor.js.map +1 -1
  251. package/objects/ShadowMesh.cjs +1 -1
  252. package/objects/ShadowMesh.cjs.map +1 -1
  253. package/objects/ShadowMesh.js +2 -2
  254. package/objects/ShadowMesh.js.map +1 -1
  255. package/objects/Sky.cjs +32 -35
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +6 -100
  258. package/objects/Sky.js +32 -35
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +1 -2
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +2 -3
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +140 -143
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +140 -143
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +264 -267
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +264 -267
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +250 -253
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +250 -253
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +376 -379
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +376 -379
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +202 -205
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +202 -205
  284. package/postprocessing/UnrealBloomPass.js.map +1 -1
  285. package/renderers/CSS2DRenderer.cjs +5 -5
  286. package/renderers/CSS2DRenderer.cjs.map +1 -1
  287. package/renderers/CSS2DRenderer.js +5 -5
  288. package/renderers/CSS2DRenderer.js.map +1 -1
  289. package/renderers/CSS3DRenderer.cjs +5 -5
  290. package/renderers/CSS3DRenderer.cjs.map +1 -1
  291. package/renderers/CSS3DRenderer.js +6 -6
  292. package/renderers/CSS3DRenderer.js.map +1 -1
  293. package/shaders/ACESFilmicToneMappingShader.cjs +46 -71
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +46 -71
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +22 -41
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +22 -41
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +6 -20
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +6 -20
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +26 -46
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +26 -46
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +19 -33
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +19 -33
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +90 -117
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +90 -117
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +232 -333
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +232 -333
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +22 -38
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +22 -38
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +21 -35
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +21 -35
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +19 -34
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +19 -34
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +24 -43
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +24 -43
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +16 -30
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +16 -30
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +21 -38
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +21 -38
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +69 -98
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +69 -98
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +59 -70
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +59 -70
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +28 -49
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +28 -49
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1089 -1098
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1089 -1098
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +29 -57
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +29 -57
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +43 -70
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +43 -70
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +53 -74
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +53 -74
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +35 -55
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +35 -55
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +19 -33
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +19 -33
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +116 -193
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +116 -193
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +192 -270
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +192 -270
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +27 -43
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +27 -43
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +31 -47
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +31 -47
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +24 -37
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +24 -37
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +24 -43
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +24 -43
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +17 -34
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +17 -34
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +26 -39
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +26 -39
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +21 -36
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +21 -36
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +97 -147
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +97 -147
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +18 -31
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +18 -31
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +20 -33
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +20 -33
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +117 -154
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +117 -154
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +270 -358
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +270 -358
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +142 -236
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +142 -236
  440. package/shaders/SSAOShader.js.map +1 -1
  441. package/shaders/SSRShader.cjs +4 -4
  442. package/shaders/SSRShader.cjs.map +1 -1
  443. package/shaders/SSRShader.js +4 -4
  444. package/shaders/SSRShader.js.map +1 -1
  445. package/shaders/SepiaShader.cjs +20 -36
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +20 -36
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +37 -64
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +37 -64
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +16 -29
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +16 -29
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +35 -55
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +35 -55
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +165 -275
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +165 -275
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +27 -50
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +27 -50
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +17 -32
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +17 -32
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +27 -43
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +27 -43
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +27 -43
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +27 -43
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +213 -264
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +213 -264
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +35 -63
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +35 -63
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +1 -2
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +2 -3
  492. package/utils/GeometryCompressionUtils.js.map +1 -1
  493. package/utils/RoughnessMipmapper.cjs +3 -3
  494. package/utils/RoughnessMipmapper.cjs.map +1 -1
  495. package/utils/RoughnessMipmapper.js +4 -4
  496. package/utils/RoughnessMipmapper.js.map +1 -1
  497. package/webxr/ARButton.cjs +106 -109
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +3 -4
  500. package/webxr/ARButton.js +106 -109
  501. package/webxr/ARButton.js.map +1 -1
  502. package/webxr/OculusHandPointerModel.cjs +2 -2
  503. package/webxr/OculusHandPointerModel.cjs.map +1 -1
  504. package/webxr/OculusHandPointerModel.js +2 -2
  505. package/webxr/OculusHandPointerModel.js.map +1 -1
  506. package/webxr/VRButton.cjs +95 -98
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +5 -6
  509. package/webxr/VRButton.js +95 -98
  510. package/webxr/VRButton.js.map +1 -1
  511. package/webxr/XRHandPrimitiveModel.cjs +2 -2
  512. package/webxr/XRHandPrimitiveModel.cjs.map +1 -1
  513. package/webxr/XRHandPrimitiveModel.js +3 -3
  514. package/webxr/XRHandPrimitiveModel.js.map +1 -1
@@ -4,1105 +4,1096 @@ const THREE = require("three");
4
4
  const FXAAShader = {
5
5
  uniforms: {
6
6
  tDiffuse: { value: null },
7
- resolution: { value: /* @__PURE__ */ new THREE.Vector2(1 / 1024, 1 / 512) }
7
+ resolution: { value: new THREE.Vector2(1 / 1024, 1 / 512) }
8
8
  },
9
- vertexShader: (
10
- /* glsl */
11
- `
12
- varying vec2 vUv;
13
-
14
- void main() {
15
-
16
- vUv = uv;
17
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
18
-
19
- }
20
- `
21
- ),
22
- fragmentShader: (
23
- /* glsl */
24
- `
25
- precision highp float;
26
-
27
- uniform sampler2D tDiffuse;
28
-
29
- uniform vec2 resolution;
30
-
31
- varying vec2 vUv;
32
-
33
- // FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)
34
-
35
- //----------------------------------------------------------------------------------
36
- // File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag
37
- // SDK Version: v3.00
38
- // Email: gameworks@nvidia.com
39
- // Site: http://developer.nvidia.com/
40
- //
41
- // Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
42
- //
43
- // Redistribution and use in source and binary forms, with or without
44
- // modification, are permitted provided that the following conditions
45
- // are met:
46
- // * Redistributions of source code must retain the above copyright
47
- // notice, this list of conditions and the following disclaimer.
48
- // * Redistributions in binary form must reproduce the above copyright
49
- // notice, this list of conditions and the following disclaimer in the
50
- // documentation and/or other materials provided with the distribution.
51
- // * Neither the name of NVIDIA CORPORATION nor the names of its
52
- // contributors may be used to endorse or promote products derived
53
- // from this software without specific prior written permission.
54
- //
55
- "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AS IS AND ANY",
56
- // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58
- // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
59
- // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
60
- // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
61
- // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
62
- // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
63
- // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
64
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
65
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66
- //
67
- //----------------------------------------------------------------------------------
68
-
69
- #define FXAA_PC 1
70
- #define FXAA_GLSL_100 1
71
- #define FXAA_QUALITY_PRESET 12
72
-
73
- #define FXAA_GREEN_AS_LUMA 1
74
-
75
- /*--------------------------------------------------------------------------*/
76
- #ifndef FXAA_PC_CONSOLE
77
- //
78
- // The console algorithm for PC is included
79
- // for developers targeting really low spec machines.
80
- // Likely better to just run FXAA_PC, and use a really low preset.
81
- //
82
- #define FXAA_PC_CONSOLE 0
83
- #endif
84
- /*--------------------------------------------------------------------------*/
85
- #ifndef FXAA_GLSL_120
86
- #define FXAA_GLSL_120 0
87
- #endif
88
- /*--------------------------------------------------------------------------*/
89
- #ifndef FXAA_GLSL_130
90
- #define FXAA_GLSL_130 0
91
- #endif
92
- /*--------------------------------------------------------------------------*/
93
- #ifndef FXAA_HLSL_3
94
- #define FXAA_HLSL_3 0
95
- #endif
96
- /*--------------------------------------------------------------------------*/
97
- #ifndef FXAA_HLSL_4
98
- #define FXAA_HLSL_4 0
99
- #endif
100
- /*--------------------------------------------------------------------------*/
101
- #ifndef FXAA_HLSL_5
102
- #define FXAA_HLSL_5 0
103
- #endif
104
- /*==========================================================================*/
105
- #ifndef FXAA_GREEN_AS_LUMA
106
- //
107
- // For those using non-linear color,
108
- // and either not able to get luma in alpha, or not wanting to,
109
- // this enables FXAA to run using green as a proxy for luma.
110
- // So with this enabled, no need to pack luma in alpha.
111
- //
112
- // This will turn off AA on anything which lacks some amount of green.
113
- // Pure red and blue or combination of only R and B, will get no AA.
114
- //
115
- // Might want to lower the settings for both,
116
- // fxaaConsoleEdgeThresholdMin
117
- // fxaaQualityEdgeThresholdMin
118
- // In order to insure AA does not get turned off on colors
119
- // which contain a minor amount of green.
120
- //
121
- // 1 = On.
122
- // 0 = Off.
123
- //
124
- #define FXAA_GREEN_AS_LUMA 0
125
- #endif
126
- /*--------------------------------------------------------------------------*/
127
- #ifndef FXAA_EARLY_EXIT
128
- //
129
- " // Controls algorithms early exit path.",
130
- // On PS3 turning this ON adds 2 cycles to the shader.
131
- // On 360 turning this OFF adds 10ths of a millisecond to the shader.
132
- // Turning this off on console will result in a more blurry image.
133
- // So this defaults to on.
134
- //
135
- // 1 = On.
136
- // 0 = Off.
137
- //
138
- #define FXAA_EARLY_EXIT 1
139
- #endif
140
- /*--------------------------------------------------------------------------*/
141
- #ifndef FXAA_DISCARD
142
- //
143
- // Only valid for PC OpenGL currently.
144
- // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
145
- //
146
- " // 1 = Use discard on pixels which dont need AA.",
147
- // For APIs which enable concurrent TEX+ROP from same surface.
148
- " // 0 = Return unchanged color on pixels which dont need AA.",
149
- //
150
- #define FXAA_DISCARD 0
151
- #endif
152
- /*--------------------------------------------------------------------------*/
153
- #ifndef FXAA_FAST_PIXEL_OFFSET
154
- //
155
- // Used for GLSL 120 only.
156
- //
157
- // 1 = GL API supports fast pixel offsets
158
- // 0 = do not use fast pixel offsets
159
- //
160
- #ifdef GL_EXT_gpu_shader4
161
- #define FXAA_FAST_PIXEL_OFFSET 1
162
- #endif
163
- #ifdef GL_NV_gpu_shader5
164
- #define FXAA_FAST_PIXEL_OFFSET 1
165
- #endif
166
- #ifdef GL_ARB_gpu_shader5
167
- #define FXAA_FAST_PIXEL_OFFSET 1
168
- #endif
169
- #ifndef FXAA_FAST_PIXEL_OFFSET
170
- #define FXAA_FAST_PIXEL_OFFSET 0
171
- #endif
172
- #endif
173
- /*--------------------------------------------------------------------------*/
174
- #ifndef FXAA_GATHER4_ALPHA
175
- //
176
- // 1 = API supports gather4 on alpha channel.
177
- // 0 = API does not support gather4 on alpha channel.
178
- //
179
- #if (FXAA_HLSL_5 == 1)
180
- #define FXAA_GATHER4_ALPHA 1
181
- #endif
182
- #ifdef GL_ARB_gpu_shader5
183
- #define FXAA_GATHER4_ALPHA 1
184
- #endif
185
- #ifdef GL_NV_gpu_shader5
186
- #define FXAA_GATHER4_ALPHA 1
187
- #endif
188
- #ifndef FXAA_GATHER4_ALPHA
189
- #define FXAA_GATHER4_ALPHA 0
190
- #endif
191
- #endif
192
-
193
-
194
- /*============================================================================
195
- FXAA QUALITY - TUNING KNOBS
196
- ------------------------------------------------------------------------------
197
- NOTE the other tuning knobs are now in the shader function inputs!
198
- ============================================================================*/
199
- #ifndef FXAA_QUALITY_PRESET
200
- //
201
- // Choose the quality preset.
202
- // This needs to be compiled into the shader as it effects code.
203
- // Best option to include multiple presets is to
204
- // in each shader define the preset, then include this file.
205
- //
206
- // OPTIONS
207
- // -----------------------------------------------------------------------
208
- // 10 to 15 - default medium dither (10=fastest, 15=highest quality)
209
- // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
210
- // 39 - no dither, very expensive
211
- //
212
- // NOTES
213
- // -----------------------------------------------------------------------
214
- // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
215
- // 13 = about same speed as FXAA 3.9 and better than 12
216
- // 23 = closest to FXAA 3.9 visually and performance wise
217
- // _ = the lowest digit is directly related to performance
218
- // _ = the highest digit is directly related to style
219
- //
220
- #define FXAA_QUALITY_PRESET 12
221
- #endif
222
-
223
-
224
- /*============================================================================
225
-
226
- FXAA QUALITY - PRESETS
227
-
228
- ============================================================================*/
229
-
230
- /*============================================================================
231
- FXAA QUALITY - MEDIUM DITHER PRESETS
232
- ============================================================================*/
233
- #if (FXAA_QUALITY_PRESET == 10)
234
- #define FXAA_QUALITY_PS 3
235
- #define FXAA_QUALITY_P0 1.5
236
- #define FXAA_QUALITY_P1 3.0
237
- #define FXAA_QUALITY_P2 12.0
238
- #endif
239
- /*--------------------------------------------------------------------------*/
240
- #if (FXAA_QUALITY_PRESET == 11)
241
- #define FXAA_QUALITY_PS 4
242
- #define FXAA_QUALITY_P0 1.0
243
- #define FXAA_QUALITY_P1 1.5
244
- #define FXAA_QUALITY_P2 3.0
245
- #define FXAA_QUALITY_P3 12.0
246
- #endif
247
- /*--------------------------------------------------------------------------*/
248
- #if (FXAA_QUALITY_PRESET == 12)
249
- #define FXAA_QUALITY_PS 5
250
- #define FXAA_QUALITY_P0 1.0
251
- #define FXAA_QUALITY_P1 1.5
252
- #define FXAA_QUALITY_P2 2.0
253
- #define FXAA_QUALITY_P3 4.0
254
- #define FXAA_QUALITY_P4 12.0
255
- #endif
256
- /*--------------------------------------------------------------------------*/
257
- #if (FXAA_QUALITY_PRESET == 13)
258
- #define FXAA_QUALITY_PS 6
259
- #define FXAA_QUALITY_P0 1.0
260
- #define FXAA_QUALITY_P1 1.5
261
- #define FXAA_QUALITY_P2 2.0
262
- #define FXAA_QUALITY_P3 2.0
263
- #define FXAA_QUALITY_P4 4.0
264
- #define FXAA_QUALITY_P5 12.0
265
- #endif
266
- /*--------------------------------------------------------------------------*/
267
- #if (FXAA_QUALITY_PRESET == 14)
268
- #define FXAA_QUALITY_PS 7
269
- #define FXAA_QUALITY_P0 1.0
270
- #define FXAA_QUALITY_P1 1.5
271
- #define FXAA_QUALITY_P2 2.0
272
- #define FXAA_QUALITY_P3 2.0
273
- #define FXAA_QUALITY_P4 2.0
274
- #define FXAA_QUALITY_P5 4.0
275
- #define FXAA_QUALITY_P6 12.0
276
- #endif
277
- /*--------------------------------------------------------------------------*/
278
- #if (FXAA_QUALITY_PRESET == 15)
279
- #define FXAA_QUALITY_PS 8
280
- #define FXAA_QUALITY_P0 1.0
281
- #define FXAA_QUALITY_P1 1.5
282
- #define FXAA_QUALITY_P2 2.0
283
- #define FXAA_QUALITY_P3 2.0
284
- #define FXAA_QUALITY_P4 2.0
285
- #define FXAA_QUALITY_P5 2.0
286
- #define FXAA_QUALITY_P6 4.0
287
- #define FXAA_QUALITY_P7 12.0
288
- #endif
289
-
290
- /*============================================================================
291
- FXAA QUALITY - LOW DITHER PRESETS
292
- ============================================================================*/
293
- #if (FXAA_QUALITY_PRESET == 20)
294
- #define FXAA_QUALITY_PS 3
295
- #define FXAA_QUALITY_P0 1.5
296
- #define FXAA_QUALITY_P1 2.0
297
- #define FXAA_QUALITY_P2 8.0
298
- #endif
299
- /*--------------------------------------------------------------------------*/
300
- #if (FXAA_QUALITY_PRESET == 21)
301
- #define FXAA_QUALITY_PS 4
302
- #define FXAA_QUALITY_P0 1.0
303
- #define FXAA_QUALITY_P1 1.5
304
- #define FXAA_QUALITY_P2 2.0
305
- #define FXAA_QUALITY_P3 8.0
306
- #endif
307
- /*--------------------------------------------------------------------------*/
308
- #if (FXAA_QUALITY_PRESET == 22)
309
- #define FXAA_QUALITY_PS 5
310
- #define FXAA_QUALITY_P0 1.0
311
- #define FXAA_QUALITY_P1 1.5
312
- #define FXAA_QUALITY_P2 2.0
313
- #define FXAA_QUALITY_P3 2.0
314
- #define FXAA_QUALITY_P4 8.0
315
- #endif
316
- /*--------------------------------------------------------------------------*/
317
- #if (FXAA_QUALITY_PRESET == 23)
318
- #define FXAA_QUALITY_PS 6
319
- #define FXAA_QUALITY_P0 1.0
320
- #define FXAA_QUALITY_P1 1.5
321
- #define FXAA_QUALITY_P2 2.0
322
- #define FXAA_QUALITY_P3 2.0
323
- #define FXAA_QUALITY_P4 2.0
324
- #define FXAA_QUALITY_P5 8.0
325
- #endif
326
- /*--------------------------------------------------------------------------*/
327
- #if (FXAA_QUALITY_PRESET == 24)
328
- #define FXAA_QUALITY_PS 7
329
- #define FXAA_QUALITY_P0 1.0
330
- #define FXAA_QUALITY_P1 1.5
331
- #define FXAA_QUALITY_P2 2.0
332
- #define FXAA_QUALITY_P3 2.0
333
- #define FXAA_QUALITY_P4 2.0
334
- #define FXAA_QUALITY_P5 3.0
335
- #define FXAA_QUALITY_P6 8.0
336
- #endif
337
- /*--------------------------------------------------------------------------*/
338
- #if (FXAA_QUALITY_PRESET == 25)
339
- #define FXAA_QUALITY_PS 8
340
- #define FXAA_QUALITY_P0 1.0
341
- #define FXAA_QUALITY_P1 1.5
342
- #define FXAA_QUALITY_P2 2.0
343
- #define FXAA_QUALITY_P3 2.0
344
- #define FXAA_QUALITY_P4 2.0
345
- #define FXAA_QUALITY_P5 2.0
346
- #define FXAA_QUALITY_P6 4.0
347
- #define FXAA_QUALITY_P7 8.0
348
- #endif
349
- /*--------------------------------------------------------------------------*/
350
- #if (FXAA_QUALITY_PRESET == 26)
351
- #define FXAA_QUALITY_PS 9
352
- #define FXAA_QUALITY_P0 1.0
353
- #define FXAA_QUALITY_P1 1.5
354
- #define FXAA_QUALITY_P2 2.0
355
- #define FXAA_QUALITY_P3 2.0
356
- #define FXAA_QUALITY_P4 2.0
357
- #define FXAA_QUALITY_P5 2.0
358
- #define FXAA_QUALITY_P6 2.0
359
- #define FXAA_QUALITY_P7 4.0
360
- #define FXAA_QUALITY_P8 8.0
361
- #endif
362
- /*--------------------------------------------------------------------------*/
363
- #if (FXAA_QUALITY_PRESET == 27)
364
- #define FXAA_QUALITY_PS 10
365
- #define FXAA_QUALITY_P0 1.0
366
- #define FXAA_QUALITY_P1 1.5
367
- #define FXAA_QUALITY_P2 2.0
368
- #define FXAA_QUALITY_P3 2.0
369
- #define FXAA_QUALITY_P4 2.0
370
- #define FXAA_QUALITY_P5 2.0
371
- #define FXAA_QUALITY_P6 2.0
372
- #define FXAA_QUALITY_P7 2.0
373
- #define FXAA_QUALITY_P8 4.0
374
- #define FXAA_QUALITY_P9 8.0
375
- #endif
376
- /*--------------------------------------------------------------------------*/
377
- #if (FXAA_QUALITY_PRESET == 28)
378
- #define FXAA_QUALITY_PS 11
379
- #define FXAA_QUALITY_P0 1.0
380
- #define FXAA_QUALITY_P1 1.5
381
- #define FXAA_QUALITY_P2 2.0
382
- #define FXAA_QUALITY_P3 2.0
383
- #define FXAA_QUALITY_P4 2.0
384
- #define FXAA_QUALITY_P5 2.0
385
- #define FXAA_QUALITY_P6 2.0
386
- #define FXAA_QUALITY_P7 2.0
387
- #define FXAA_QUALITY_P8 2.0
388
- #define FXAA_QUALITY_P9 4.0
389
- #define FXAA_QUALITY_P10 8.0
390
- #endif
391
- /*--------------------------------------------------------------------------*/
392
- #if (FXAA_QUALITY_PRESET == 29)
393
- #define FXAA_QUALITY_PS 12
394
- #define FXAA_QUALITY_P0 1.0
395
- #define FXAA_QUALITY_P1 1.5
396
- #define FXAA_QUALITY_P2 2.0
397
- #define FXAA_QUALITY_P3 2.0
398
- #define FXAA_QUALITY_P4 2.0
399
- #define FXAA_QUALITY_P5 2.0
400
- #define FXAA_QUALITY_P6 2.0
401
- #define FXAA_QUALITY_P7 2.0
402
- #define FXAA_QUALITY_P8 2.0
403
- #define FXAA_QUALITY_P9 2.0
404
- #define FXAA_QUALITY_P10 4.0
405
- #define FXAA_QUALITY_P11 8.0
406
- #endif
407
-
408
- /*============================================================================
409
- FXAA QUALITY - EXTREME QUALITY
410
- ============================================================================*/
411
- #if (FXAA_QUALITY_PRESET == 39)
412
- #define FXAA_QUALITY_PS 12
413
- #define FXAA_QUALITY_P0 1.0
414
- #define FXAA_QUALITY_P1 1.0
415
- #define FXAA_QUALITY_P2 1.0
416
- #define FXAA_QUALITY_P3 1.0
417
- #define FXAA_QUALITY_P4 1.0
418
- #define FXAA_QUALITY_P5 1.5
419
- #define FXAA_QUALITY_P6 2.0
420
- #define FXAA_QUALITY_P7 2.0
421
- #define FXAA_QUALITY_P8 2.0
422
- #define FXAA_QUALITY_P9 2.0
423
- #define FXAA_QUALITY_P10 4.0
424
- #define FXAA_QUALITY_P11 8.0
425
- #endif
426
-
427
-
428
-
429
- /*============================================================================
430
-
431
- API PORTING
432
-
433
- ============================================================================*/
434
- #if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)
435
- #define FxaaBool bool
436
- #define FxaaDiscard discard
437
- #define FxaaFloat float
438
- #define FxaaFloat2 vec2
439
- #define FxaaFloat3 vec3
440
- #define FxaaFloat4 vec4
441
- #define FxaaHalf float
442
- #define FxaaHalf2 vec2
443
- #define FxaaHalf3 vec3
444
- #define FxaaHalf4 vec4
445
- #define FxaaInt2 ivec2
446
- #define FxaaSat(x) clamp(x, 0.0, 1.0)
447
- #define FxaaTex sampler2D
448
- #else
449
- #define FxaaBool bool
450
- #define FxaaDiscard clip(-1)
451
- #define FxaaFloat float
452
- #define FxaaFloat2 float2
453
- #define FxaaFloat3 float3
454
- #define FxaaFloat4 float4
455
- #define FxaaHalf half
456
- #define FxaaHalf2 half2
457
- #define FxaaHalf3 half3
458
- #define FxaaHalf4 half4
459
- #define FxaaSat(x) saturate(x)
460
- #endif
461
- /*--------------------------------------------------------------------------*/
462
- #if (FXAA_GLSL_100 == 1)
463
- #define FxaaTexTop(t, p) texture2D(t, p, 0.0)
464
- #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)
465
- #endif
466
- /*--------------------------------------------------------------------------*/
467
- #if (FXAA_GLSL_120 == 1)
468
- // Requires,
469
- // #version 120
470
- // And at least,
471
- // #extension GL_EXT_gpu_shader4 : enable
472
- // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
473
- #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
474
- #if (FXAA_FAST_PIXEL_OFFSET == 1)
475
- #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
476
- #else
477
- #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
478
- #endif
479
- #if (FXAA_GATHER4_ALPHA == 1)
480
- // use #extension GL_ARB_gpu_shader5 : enable
481
- #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
482
- #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
483
- #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
484
- #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
485
- #endif
486
- #endif
487
- /*--------------------------------------------------------------------------*/
488
- #if (FXAA_GLSL_130 == 1)
489
- // Requires "#version 130" or better
490
- #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
491
- #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
492
- #if (FXAA_GATHER4_ALPHA == 1)
493
- // use #extension GL_ARB_gpu_shader5 : enable
494
- #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
495
- #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
496
- #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
497
- #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
498
- #endif
499
- #endif
500
- /*--------------------------------------------------------------------------*/
501
- #if (FXAA_HLSL_3 == 1)
502
- #define FxaaInt2 float2
503
- #define FxaaTex sampler2D
504
- #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
505
- #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
506
- #endif
507
- /*--------------------------------------------------------------------------*/
508
- #if (FXAA_HLSL_4 == 1)
509
- #define FxaaInt2 int2
510
- struct FxaaTex { SamplerState smpl; Texture2D tex; };
511
- #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
512
- #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
513
- #endif
514
- /*--------------------------------------------------------------------------*/
515
- #if (FXAA_HLSL_5 == 1)
516
- #define FxaaInt2 int2
517
- struct FxaaTex { SamplerState smpl; Texture2D tex; };
518
- #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
519
- #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
520
- #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)
521
- #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)
522
- #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)
523
- #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)
524
- #endif
525
-
526
-
527
- /*============================================================================
528
- GREEN AS LUMA OPTION SUPPORT FUNCTION
529
- ============================================================================*/
530
- #if (FXAA_GREEN_AS_LUMA == 0)
531
- FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
532
- #else
533
- FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
534
- #endif
535
-
536
-
537
-
538
-
539
- /*============================================================================
540
-
541
- FXAA3 QUALITY - PC
542
-
543
- ============================================================================*/
544
- #if (FXAA_PC == 1)
545
- /*--------------------------------------------------------------------------*/
546
- FxaaFloat4 FxaaPixelShader(
547
- //
548
- // Use noperspective interpolation here (turn off perspective interpolation).
549
- // {xy} = center of pixel
550
- FxaaFloat2 pos,
551
- //
552
- // Used only for FXAA Console, and not used on the 360 version.
553
- // Use noperspective interpolation here (turn off perspective interpolation).
554
- // {xy_} = upper left of pixel
555
- // {_zw} = lower right of pixel
556
- FxaaFloat4 fxaaConsolePosPos,
557
- //
558
- // Input color texture.
559
- // {rgb_} = color in linear or perceptual color space
560
- // if (FXAA_GREEN_AS_LUMA == 0)
561
- // {__a} = luma in perceptual color space (not linear)
562
- FxaaTex tex,
563
- //
564
- // Only used on the optimized 360 version of FXAA Console.
565
- // For everything but 360, just use the same input here as for "tex".
566
- // For 360, same texture, just alias with a 2nd sampler.
567
- // This sampler needs to have an exponent bias of -1.
568
- FxaaTex fxaaConsole360TexExpBiasNegOne,
569
- //
570
- // Only used on the optimized 360 version of FXAA Console.
571
- // For everything but 360, just use the same input here as for "tex".
572
- // For 360, same texture, just alias with a 3nd sampler.
573
- // This sampler needs to have an exponent bias of -2.
574
- FxaaTex fxaaConsole360TexExpBiasNegTwo,
575
- //
576
- // Only used on FXAA Quality.
577
- // This must be from a constant/uniform.
578
- // {x_} = 1.0/screenWidthInPixels
579
- // {_y} = 1.0/screenHeightInPixels
580
- FxaaFloat2 fxaaQualityRcpFrame,
581
- //
582
- // Only used on FXAA Console.
583
- // This must be from a constant/uniform.
584
- // This effects sub-pixel AA quality and inversely sharpness.
585
- // Where N ranges between,
586
- // N = 0.50 (default)
587
- // N = 0.33 (sharper)
588
- // {x__} = -N/screenWidthInPixels
589
- // {_y_} = -N/screenHeightInPixels
590
- // {_z_} = N/screenWidthInPixels
591
- // {__w} = N/screenHeightInPixels
592
- FxaaFloat4 fxaaConsoleRcpFrameOpt,
593
- //
594
- // Only used on FXAA Console.
595
- // Not used on 360, but used on PS3 and PC.
596
- // This must be from a constant/uniform.
597
- // {x__} = -2.0/screenWidthInPixels
598
- // {_y_} = -2.0/screenHeightInPixels
599
- // {_z_} = 2.0/screenWidthInPixels
600
- // {__w} = 2.0/screenHeightInPixels
601
- FxaaFloat4 fxaaConsoleRcpFrameOpt2,
602
- //
603
- // Only used on FXAA Console.
604
- // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.
605
- // This must be from a constant/uniform.
606
- // {x__} = 8.0/screenWidthInPixels
607
- // {_y_} = 8.0/screenHeightInPixels
608
- // {_z_} = -4.0/screenWidthInPixels
609
- // {__w} = -4.0/screenHeightInPixels
610
- FxaaFloat4 fxaaConsole360RcpFrameOpt2,
611
- //
612
- // Only used on FXAA Quality.
613
- // This used to be the FXAA_QUALITY_SUBPIX define.
614
- // It is here now to allow easier tuning.
615
- // Choose the amount of sub-pixel aliasing removal.
616
- // This can effect sharpness.
617
- // 1.00 - upper limit (softer)
618
- // 0.75 - default amount of filtering
619
- // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
620
- // 0.25 - almost off
621
- // 0.00 - completely off
622
- FxaaFloat fxaaQualitySubpix,
623
- //
624
- // Only used on FXAA Quality.
625
- // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
626
- // It is here now to allow easier tuning.
627
- // The minimum amount of local contrast required to apply algorithm.
628
- // 0.333 - too little (faster)
629
- // 0.250 - low quality
630
- // 0.166 - default
631
- // 0.125 - high quality
632
- // 0.063 - overkill (slower)
633
- FxaaFloat fxaaQualityEdgeThreshold,
634
- //
635
- // Only used on FXAA Quality.
636
- // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
637
- // It is here now to allow easier tuning.
638
- // Trims the algorithm from processing darks.
639
- // 0.0833 - upper limit (default, the start of visible unfiltered edges)
640
- // 0.0625 - high quality (faster)
641
- // 0.0312 - visible limit (slower)
642
- // Special notes when using FXAA_GREEN_AS_LUMA,
643
- // Likely want to set this to zero.
644
- // As colors that are mostly not-green
645
- // will appear very dark in the green channel!
646
- // Tune by looking at mostly non-green content,
647
- // then start at zero and increase until aliasing is a problem.
648
- FxaaFloat fxaaQualityEdgeThresholdMin,
649
- //
650
- // Only used on FXAA Console.
651
- // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.
652
- // It is here now to allow easier tuning.
653
- // This does not effect PS3, as this needs to be compiled in.
654
- // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.
655
- // Due to the PS3 being ALU bound,
656
- // there are only three safe values here: 2 and 4 and 8.
657
- // These options use the shaders ability to a free *|/ by 2|4|8.
658
- // For all other platforms can be a non-power of two.
659
- // 8.0 is sharper (default!!!)
660
- // 4.0 is softer
661
- // 2.0 is really soft (good only for vector graphics inputs)
662
- FxaaFloat fxaaConsoleEdgeSharpness,
663
- //
664
- // Only used on FXAA Console.
665
- // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.
666
- // It is here now to allow easier tuning.
667
- // This does not effect PS3, as this needs to be compiled in.
668
- // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.
669
- // Due to the PS3 being ALU bound,
670
- // there are only two safe values here: 1/4 and 1/8.
671
- // These options use the shaders ability to a free *|/ by 2|4|8.
672
- // The console setting has a different mapping than the quality setting.
673
- // Other platforms can use other values.
674
- // 0.125 leaves less aliasing, but is softer (default!!!)
675
- // 0.25 leaves more aliasing, and is sharper
676
- FxaaFloat fxaaConsoleEdgeThreshold,
677
- //
678
- // Only used on FXAA Console.
679
- // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.
680
- // It is here now to allow easier tuning.
681
- // Trims the algorithm from processing darks.
682
- // The console setting has a different mapping than the quality setting.
683
- // This only applies when FXAA_EARLY_EXIT is 1.
684
- // This does not apply to PS3,
685
- // PS3 was simplified to avoid more shader instructions.
686
- // 0.06 - faster but more aliasing in darks
687
- // 0.05 - default
688
- // 0.04 - slower and less aliasing in darks
689
- // Special notes when using FXAA_GREEN_AS_LUMA,
690
- // Likely want to set this to zero.
691
- // As colors that are mostly not-green
692
- // will appear very dark in the green channel!
693
- // Tune by looking at mostly non-green content,
694
- // then start at zero and increase until aliasing is a problem.
695
- FxaaFloat fxaaConsoleEdgeThresholdMin,
696
- //
697
- // Extra constants for 360 FXAA Console only.
698
- // Use zeros or anything else for other platforms.
699
- // These must be in physical constant registers and NOT immediates.
700
- // Immediates will result in compiler un-optimizing.
701
- // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)
702
- FxaaFloat4 fxaaConsole360ConstDir
703
- ) {
704
- /*--------------------------------------------------------------------------*/
705
- FxaaFloat2 posM;
706
- posM.x = pos.x;
707
- posM.y = pos.y;
708
- #if (FXAA_GATHER4_ALPHA == 1)
709
- #if (FXAA_DISCARD == 0)
710
- FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
711
- #if (FXAA_GREEN_AS_LUMA == 0)
712
- #define lumaM rgbyM.w
713
- #else
714
- #define lumaM rgbyM.y
715
- #endif
716
- #endif
717
- #if (FXAA_GREEN_AS_LUMA == 0)
718
- FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);
719
- FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));
720
- #else
721
- FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
722
- FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
723
- #endif
724
- #if (FXAA_DISCARD == 1)
725
- #define lumaM luma4A.w
726
- #endif
727
- #define lumaE luma4A.z
728
- #define lumaS luma4A.x
729
- #define lumaSE luma4A.y
730
- #define lumaNW luma4B.w
731
- #define lumaN luma4B.z
732
- #define lumaW luma4B.x
733
- #else
734
- FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
735
- #if (FXAA_GREEN_AS_LUMA == 0)
736
- #define lumaM rgbyM.w
737
- #else
738
- #define lumaM rgbyM.y
739
- #endif
740
- #if (FXAA_GLSL_100 == 1)
741
- FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));
742
- FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));
743
- FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));
744
- FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));
745
- #else
746
- FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
747
- FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
748
- FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
749
- FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
750
- #endif
751
- #endif
752
- /*--------------------------------------------------------------------------*/
753
- FxaaFloat maxSM = max(lumaS, lumaM);
754
- FxaaFloat minSM = min(lumaS, lumaM);
755
- FxaaFloat maxESM = max(lumaE, maxSM);
756
- FxaaFloat minESM = min(lumaE, minSM);
757
- FxaaFloat maxWN = max(lumaN, lumaW);
758
- FxaaFloat minWN = min(lumaN, lumaW);
759
- FxaaFloat rangeMax = max(maxWN, maxESM);
760
- FxaaFloat rangeMin = min(minWN, minESM);
761
- FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
762
- FxaaFloat range = rangeMax - rangeMin;
763
- FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
764
- FxaaBool earlyExit = range < rangeMaxClamped;
765
- /*--------------------------------------------------------------------------*/
766
- if(earlyExit)
767
- #if (FXAA_DISCARD == 1)
768
- FxaaDiscard;
769
- #else
770
- return rgbyM;
771
- #endif
772
- /*--------------------------------------------------------------------------*/
773
- #if (FXAA_GATHER4_ALPHA == 0)
774
- #if (FXAA_GLSL_100 == 1)
775
- FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));
776
- FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));
777
- FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));
778
- FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));
779
- #else
780
- FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
781
- FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
782
- FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
783
- FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
784
- #endif
785
- #else
786
- FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
787
- FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
788
- #endif
789
- /*--------------------------------------------------------------------------*/
790
- FxaaFloat lumaNS = lumaN + lumaS;
791
- FxaaFloat lumaWE = lumaW + lumaE;
792
- FxaaFloat subpixRcpRange = 1.0/range;
793
- FxaaFloat subpixNSWE = lumaNS + lumaWE;
794
- FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
795
- FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
796
- /*--------------------------------------------------------------------------*/
797
- FxaaFloat lumaNESE = lumaNE + lumaSE;
798
- FxaaFloat lumaNWNE = lumaNW + lumaNE;
799
- FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
800
- FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
801
- /*--------------------------------------------------------------------------*/
802
- FxaaFloat lumaNWSW = lumaNW + lumaSW;
803
- FxaaFloat lumaSWSE = lumaSW + lumaSE;
804
- FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
805
- FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
806
- FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
807
- FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
808
- FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
809
- FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
810
- /*--------------------------------------------------------------------------*/
811
- FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
812
- FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
813
- FxaaBool horzSpan = edgeHorz >= edgeVert;
814
- FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
815
- /*--------------------------------------------------------------------------*/
816
- if(!horzSpan) lumaN = lumaW;
817
- if(!horzSpan) lumaS = lumaE;
818
- if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
819
- FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
820
- /*--------------------------------------------------------------------------*/
821
- FxaaFloat gradientN = lumaN - lumaM;
822
- FxaaFloat gradientS = lumaS - lumaM;
823
- FxaaFloat lumaNN = lumaN + lumaM;
824
- FxaaFloat lumaSS = lumaS + lumaM;
825
- FxaaBool pairN = abs(gradientN) >= abs(gradientS);
826
- FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
827
- if(pairN) lengthSign = -lengthSign;
828
- FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
829
- /*--------------------------------------------------------------------------*/
830
- FxaaFloat2 posB;
831
- posB.x = posM.x;
832
- posB.y = posM.y;
833
- FxaaFloat2 offNP;
834
- offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
835
- offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
836
- if(!horzSpan) posB.x += lengthSign * 0.5;
837
- if( horzSpan) posB.y += lengthSign * 0.5;
838
- /*--------------------------------------------------------------------------*/
839
- FxaaFloat2 posN;
840
- posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
841
- posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
842
- FxaaFloat2 posP;
843
- posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
844
- posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
845
- FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
846
- FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
847
- FxaaFloat subpixE = subpixC * subpixC;
848
- FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
849
- /*--------------------------------------------------------------------------*/
850
- if(!pairN) lumaNN = lumaSS;
851
- FxaaFloat gradientScaled = gradient * 1.0/4.0;
852
- FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
853
- FxaaFloat subpixF = subpixD * subpixE;
854
- FxaaBool lumaMLTZero = lumaMM < 0.0;
855
- /*--------------------------------------------------------------------------*/
856
- lumaEndN -= lumaNN * 0.5;
857
- lumaEndP -= lumaNN * 0.5;
858
- FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
859
- FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
860
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
861
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
862
- FxaaBool doneNP = (!doneN) || (!doneP);
863
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
864
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
865
- /*--------------------------------------------------------------------------*/
866
- if(doneNP) {
867
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
868
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
869
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
870
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
871
- doneN = abs(lumaEndN) >= gradientScaled;
872
- doneP = abs(lumaEndP) >= gradientScaled;
873
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
874
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
875
- doneNP = (!doneN) || (!doneP);
876
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
877
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
878
- /*--------------------------------------------------------------------------*/
879
- #if (FXAA_QUALITY_PS > 3)
880
- if(doneNP) {
881
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
882
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
883
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
884
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
885
- doneN = abs(lumaEndN) >= gradientScaled;
886
- doneP = abs(lumaEndP) >= gradientScaled;
887
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
888
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
889
- doneNP = (!doneN) || (!doneP);
890
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
891
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
892
- /*--------------------------------------------------------------------------*/
893
- #if (FXAA_QUALITY_PS > 4)
894
- if(doneNP) {
895
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
896
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
897
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
898
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
899
- doneN = abs(lumaEndN) >= gradientScaled;
900
- doneP = abs(lumaEndP) >= gradientScaled;
901
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
902
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
903
- doneNP = (!doneN) || (!doneP);
904
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
905
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
906
- /*--------------------------------------------------------------------------*/
907
- #if (FXAA_QUALITY_PS > 5)
908
- if(doneNP) {
909
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
910
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
911
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
912
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
913
- doneN = abs(lumaEndN) >= gradientScaled;
914
- doneP = abs(lumaEndP) >= gradientScaled;
915
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
916
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
917
- doneNP = (!doneN) || (!doneP);
918
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
919
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
920
- /*--------------------------------------------------------------------------*/
921
- #if (FXAA_QUALITY_PS > 6)
922
- if(doneNP) {
923
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
924
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
925
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
926
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
927
- doneN = abs(lumaEndN) >= gradientScaled;
928
- doneP = abs(lumaEndP) >= gradientScaled;
929
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
930
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
931
- doneNP = (!doneN) || (!doneP);
932
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
933
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
934
- /*--------------------------------------------------------------------------*/
935
- #if (FXAA_QUALITY_PS > 7)
936
- if(doneNP) {
937
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
938
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
939
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
940
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
941
- doneN = abs(lumaEndN) >= gradientScaled;
942
- doneP = abs(lumaEndP) >= gradientScaled;
943
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
944
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
945
- doneNP = (!doneN) || (!doneP);
946
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
947
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
948
- /*--------------------------------------------------------------------------*/
949
- #if (FXAA_QUALITY_PS > 8)
950
- if(doneNP) {
951
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
952
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
953
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
954
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
955
- doneN = abs(lumaEndN) >= gradientScaled;
956
- doneP = abs(lumaEndP) >= gradientScaled;
957
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
958
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
959
- doneNP = (!doneN) || (!doneP);
960
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
961
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
962
- /*--------------------------------------------------------------------------*/
963
- #if (FXAA_QUALITY_PS > 9)
964
- if(doneNP) {
965
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
966
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
967
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
968
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
969
- doneN = abs(lumaEndN) >= gradientScaled;
970
- doneP = abs(lumaEndP) >= gradientScaled;
971
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
972
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
973
- doneNP = (!doneN) || (!doneP);
974
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
975
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
976
- /*--------------------------------------------------------------------------*/
977
- #if (FXAA_QUALITY_PS > 10)
978
- if(doneNP) {
979
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
980
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
981
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
982
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
983
- doneN = abs(lumaEndN) >= gradientScaled;
984
- doneP = abs(lumaEndP) >= gradientScaled;
985
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
986
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
987
- doneNP = (!doneN) || (!doneP);
988
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
989
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
990
- /*--------------------------------------------------------------------------*/
991
- #if (FXAA_QUALITY_PS > 11)
992
- if(doneNP) {
993
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
994
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
995
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
996
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
997
- doneN = abs(lumaEndN) >= gradientScaled;
998
- doneP = abs(lumaEndP) >= gradientScaled;
999
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
1000
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
1001
- doneNP = (!doneN) || (!doneP);
1002
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
1003
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
1004
- /*--------------------------------------------------------------------------*/
1005
- #if (FXAA_QUALITY_PS > 12)
1006
- if(doneNP) {
1007
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
1008
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
1009
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
1010
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
1011
- doneN = abs(lumaEndN) >= gradientScaled;
1012
- doneP = abs(lumaEndP) >= gradientScaled;
1013
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
1014
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
1015
- doneNP = (!doneN) || (!doneP);
1016
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
1017
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
1018
- /*--------------------------------------------------------------------------*/
1019
- }
1020
- #endif
1021
- /*--------------------------------------------------------------------------*/
1022
- }
1023
- #endif
1024
- /*--------------------------------------------------------------------------*/
1025
- }
1026
- #endif
1027
- /*--------------------------------------------------------------------------*/
1028
- }
1029
- #endif
1030
- /*--------------------------------------------------------------------------*/
1031
- }
1032
- #endif
1033
- /*--------------------------------------------------------------------------*/
1034
- }
1035
- #endif
1036
- /*--------------------------------------------------------------------------*/
1037
- }
1038
- #endif
1039
- /*--------------------------------------------------------------------------*/
1040
- }
1041
- #endif
1042
- /*--------------------------------------------------------------------------*/
1043
- }
1044
- #endif
1045
- /*--------------------------------------------------------------------------*/
1046
- }
1047
- #endif
1048
- /*--------------------------------------------------------------------------*/
1049
- }
1050
- /*--------------------------------------------------------------------------*/
1051
- FxaaFloat dstN = posM.x - posN.x;
1052
- FxaaFloat dstP = posP.x - posM.x;
1053
- if(!horzSpan) dstN = posM.y - posN.y;
1054
- if(!horzSpan) dstP = posP.y - posM.y;
1055
- /*--------------------------------------------------------------------------*/
1056
- FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
1057
- FxaaFloat spanLength = (dstP + dstN);
1058
- FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
1059
- FxaaFloat spanLengthRcp = 1.0/spanLength;
1060
- /*--------------------------------------------------------------------------*/
1061
- FxaaBool directionN = dstN < dstP;
1062
- FxaaFloat dst = min(dstN, dstP);
1063
- FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
1064
- FxaaFloat subpixG = subpixF * subpixF;
1065
- FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
1066
- FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
1067
- /*--------------------------------------------------------------------------*/
1068
- FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
1069
- FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
1070
- if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
1071
- if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
1072
- #if (FXAA_DISCARD == 1)
1073
- return FxaaTexTop(tex, posM);
1074
- #else
1075
- return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
1076
- #endif
1077
- }
1078
- /*==========================================================================*/
1079
- #endif
1080
-
1081
- void main() {
1082
- gl_FragColor = FxaaPixelShader(
1083
- vUv,
1084
- vec4(0.0),
1085
- tDiffuse,
1086
- tDiffuse,
1087
- tDiffuse,
1088
- resolution,
1089
- vec4(0.0),
1090
- vec4(0.0),
1091
- vec4(0.0),
1092
- 0.75,
1093
- 0.166,
1094
- 0.0833,
1095
- 0.0,
1096
- 0.0,
1097
- 0.0,
1098
- vec4(0.0)
1099
- );
1100
-
1101
- // TODO avoid querying texture twice for same texel
1102
- gl_FragColor.a = texture2D(tDiffuse, vUv).a;
1103
- }
1104
- `
1105
- )
9
+ vertexShader: [
10
+ "varying vec2 vUv;",
11
+ "void main() {",
12
+ " vUv = uv;",
13
+ " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
14
+ "}"
15
+ ].join("\n"),
16
+ fragmentShader: [
17
+ "precision highp float;",
18
+ "",
19
+ "uniform sampler2D tDiffuse;",
20
+ "",
21
+ "uniform vec2 resolution;",
22
+ "",
23
+ "varying vec2 vUv;",
24
+ "",
25
+ "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)",
26
+ "",
27
+ "//----------------------------------------------------------------------------------",
28
+ "// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag",
29
+ "// SDK Version: v3.00",
30
+ "// Email: gameworks@nvidia.com",
31
+ "// Site: http://developer.nvidia.com/",
32
+ "//",
33
+ "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.",
34
+ "//",
35
+ "// Redistribution and use in source and binary forms, with or without",
36
+ "// modification, are permitted provided that the following conditions",
37
+ "// are met:",
38
+ "// * Redistributions of source code must retain the above copyright",
39
+ "// notice, this list of conditions and the following disclaimer.",
40
+ "// * Redistributions in binary form must reproduce the above copyright",
41
+ "// notice, this list of conditions and the following disclaimer in the",
42
+ "// documentation and/or other materials provided with the distribution.",
43
+ "// * Neither the name of NVIDIA CORPORATION nor the names of its",
44
+ "// contributors may be used to endorse or promote products derived",
45
+ "// from this software without specific prior written permission.",
46
+ "//",
47
+ "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY",
48
+ "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE",
49
+ "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR",
50
+ "// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR",
51
+ "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,",
52
+ "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,",
53
+ "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR",
54
+ "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY",
55
+ "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
56
+ "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE",
57
+ "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
58
+ "//",
59
+ "//----------------------------------------------------------------------------------",
60
+ "",
61
+ "#define FXAA_PC 1",
62
+ "#define FXAA_GLSL_100 1",
63
+ "#define FXAA_QUALITY_PRESET 12",
64
+ "",
65
+ "#define FXAA_GREEN_AS_LUMA 1",
66
+ "",
67
+ "/*--------------------------------------------------------------------------*/",
68
+ "#ifndef FXAA_PC_CONSOLE",
69
+ " //",
70
+ " // The console algorithm for PC is included",
71
+ " // for developers targeting really low spec machines.",
72
+ " // Likely better to just run FXAA_PC, and use a really low preset.",
73
+ " //",
74
+ " #define FXAA_PC_CONSOLE 0",
75
+ "#endif",
76
+ "/*--------------------------------------------------------------------------*/",
77
+ "#ifndef FXAA_GLSL_120",
78
+ " #define FXAA_GLSL_120 0",
79
+ "#endif",
80
+ "/*--------------------------------------------------------------------------*/",
81
+ "#ifndef FXAA_GLSL_130",
82
+ " #define FXAA_GLSL_130 0",
83
+ "#endif",
84
+ "/*--------------------------------------------------------------------------*/",
85
+ "#ifndef FXAA_HLSL_3",
86
+ " #define FXAA_HLSL_3 0",
87
+ "#endif",
88
+ "/*--------------------------------------------------------------------------*/",
89
+ "#ifndef FXAA_HLSL_4",
90
+ " #define FXAA_HLSL_4 0",
91
+ "#endif",
92
+ "/*--------------------------------------------------------------------------*/",
93
+ "#ifndef FXAA_HLSL_5",
94
+ " #define FXAA_HLSL_5 0",
95
+ "#endif",
96
+ "/*==========================================================================*/",
97
+ "#ifndef FXAA_GREEN_AS_LUMA",
98
+ " //",
99
+ " // For those using non-linear color,",
100
+ " // and either not able to get luma in alpha, or not wanting to,",
101
+ " // this enables FXAA to run using green as a proxy for luma.",
102
+ " // So with this enabled, no need to pack luma in alpha.",
103
+ " //",
104
+ " // This will turn off AA on anything which lacks some amount of green.",
105
+ " // Pure red and blue or combination of only R and B, will get no AA.",
106
+ " //",
107
+ " // Might want to lower the settings for both,",
108
+ " // fxaaConsoleEdgeThresholdMin",
109
+ " // fxaaQualityEdgeThresholdMin",
110
+ " // In order to insure AA does not get turned off on colors",
111
+ " // which contain a minor amount of green.",
112
+ " //",
113
+ " // 1 = On.",
114
+ " // 0 = Off.",
115
+ " //",
116
+ " #define FXAA_GREEN_AS_LUMA 0",
117
+ "#endif",
118
+ "/*--------------------------------------------------------------------------*/",
119
+ "#ifndef FXAA_EARLY_EXIT",
120
+ " //",
121
+ " // Controls algorithm's early exit path.",
122
+ " // On PS3 turning this ON adds 2 cycles to the shader.",
123
+ " // On 360 turning this OFF adds 10ths of a millisecond to the shader.",
124
+ " // Turning this off on console will result in a more blurry image.",
125
+ " // So this defaults to on.",
126
+ " //",
127
+ " // 1 = On.",
128
+ " // 0 = Off.",
129
+ " //",
130
+ " #define FXAA_EARLY_EXIT 1",
131
+ "#endif",
132
+ "/*--------------------------------------------------------------------------*/",
133
+ "#ifndef FXAA_DISCARD",
134
+ " //",
135
+ " // Only valid for PC OpenGL currently.",
136
+ " // Probably will not work when FXAA_GREEN_AS_LUMA = 1.",
137
+ " //",
138
+ " // 1 = Use discard on pixels which don't need AA.",
139
+ " // For APIs which enable concurrent TEX+ROP from same surface.",
140
+ " // 0 = Return unchanged color on pixels which don't need AA.",
141
+ " //",
142
+ " #define FXAA_DISCARD 0",
143
+ "#endif",
144
+ "/*--------------------------------------------------------------------------*/",
145
+ "#ifndef FXAA_FAST_PIXEL_OFFSET",
146
+ " //",
147
+ " // Used for GLSL 120 only.",
148
+ " //",
149
+ " // 1 = GL API supports fast pixel offsets",
150
+ " // 0 = do not use fast pixel offsets",
151
+ " //",
152
+ " #ifdef GL_EXT_gpu_shader4",
153
+ " #define FXAA_FAST_PIXEL_OFFSET 1",
154
+ " #endif",
155
+ " #ifdef GL_NV_gpu_shader5",
156
+ " #define FXAA_FAST_PIXEL_OFFSET 1",
157
+ " #endif",
158
+ " #ifdef GL_ARB_gpu_shader5",
159
+ " #define FXAA_FAST_PIXEL_OFFSET 1",
160
+ " #endif",
161
+ " #ifndef FXAA_FAST_PIXEL_OFFSET",
162
+ " #define FXAA_FAST_PIXEL_OFFSET 0",
163
+ " #endif",
164
+ "#endif",
165
+ "/*--------------------------------------------------------------------------*/",
166
+ "#ifndef FXAA_GATHER4_ALPHA",
167
+ " //",
168
+ " // 1 = API supports gather4 on alpha channel.",
169
+ " // 0 = API does not support gather4 on alpha channel.",
170
+ " //",
171
+ " #if (FXAA_HLSL_5 == 1)",
172
+ " #define FXAA_GATHER4_ALPHA 1",
173
+ " #endif",
174
+ " #ifdef GL_ARB_gpu_shader5",
175
+ " #define FXAA_GATHER4_ALPHA 1",
176
+ " #endif",
177
+ " #ifdef GL_NV_gpu_shader5",
178
+ " #define FXAA_GATHER4_ALPHA 1",
179
+ " #endif",
180
+ " #ifndef FXAA_GATHER4_ALPHA",
181
+ " #define FXAA_GATHER4_ALPHA 0",
182
+ " #endif",
183
+ "#endif",
184
+ "",
185
+ "",
186
+ "/*============================================================================",
187
+ " FXAA QUALITY - TUNING KNOBS",
188
+ "------------------------------------------------------------------------------",
189
+ "NOTE the other tuning knobs are now in the shader function inputs!",
190
+ "============================================================================*/",
191
+ "#ifndef FXAA_QUALITY_PRESET",
192
+ " //",
193
+ " // Choose the quality preset.",
194
+ " // This needs to be compiled into the shader as it effects code.",
195
+ " // Best option to include multiple presets is to",
196
+ " // in each shader define the preset, then include this file.",
197
+ " //",
198
+ " // OPTIONS",
199
+ " // -----------------------------------------------------------------------",
200
+ " // 10 to 15 - default medium dither (10=fastest, 15=highest quality)",
201
+ " // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)",
202
+ " // 39 - no dither, very expensive",
203
+ " //",
204
+ " // NOTES",
205
+ " // -----------------------------------------------------------------------",
206
+ " // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)",
207
+ " // 13 = about same speed as FXAA 3.9 and better than 12",
208
+ " // 23 = closest to FXAA 3.9 visually and performance wise",
209
+ " // _ = the lowest digit is directly related to performance",
210
+ " // _ = the highest digit is directly related to style",
211
+ " //",
212
+ " #define FXAA_QUALITY_PRESET 12",
213
+ "#endif",
214
+ "",
215
+ "",
216
+ "/*============================================================================",
217
+ "",
218
+ " FXAA QUALITY - PRESETS",
219
+ "",
220
+ "============================================================================*/",
221
+ "",
222
+ "/*============================================================================",
223
+ " FXAA QUALITY - MEDIUM DITHER PRESETS",
224
+ "============================================================================*/",
225
+ "#if (FXAA_QUALITY_PRESET == 10)",
226
+ " #define FXAA_QUALITY_PS 3",
227
+ " #define FXAA_QUALITY_P0 1.5",
228
+ " #define FXAA_QUALITY_P1 3.0",
229
+ " #define FXAA_QUALITY_P2 12.0",
230
+ "#endif",
231
+ "/*--------------------------------------------------------------------------*/",
232
+ "#if (FXAA_QUALITY_PRESET == 11)",
233
+ " #define FXAA_QUALITY_PS 4",
234
+ " #define FXAA_QUALITY_P0 1.0",
235
+ " #define FXAA_QUALITY_P1 1.5",
236
+ " #define FXAA_QUALITY_P2 3.0",
237
+ " #define FXAA_QUALITY_P3 12.0",
238
+ "#endif",
239
+ "/*--------------------------------------------------------------------------*/",
240
+ "#if (FXAA_QUALITY_PRESET == 12)",
241
+ " #define FXAA_QUALITY_PS 5",
242
+ " #define FXAA_QUALITY_P0 1.0",
243
+ " #define FXAA_QUALITY_P1 1.5",
244
+ " #define FXAA_QUALITY_P2 2.0",
245
+ " #define FXAA_QUALITY_P3 4.0",
246
+ " #define FXAA_QUALITY_P4 12.0",
247
+ "#endif",
248
+ "/*--------------------------------------------------------------------------*/",
249
+ "#if (FXAA_QUALITY_PRESET == 13)",
250
+ " #define FXAA_QUALITY_PS 6",
251
+ " #define FXAA_QUALITY_P0 1.0",
252
+ " #define FXAA_QUALITY_P1 1.5",
253
+ " #define FXAA_QUALITY_P2 2.0",
254
+ " #define FXAA_QUALITY_P3 2.0",
255
+ " #define FXAA_QUALITY_P4 4.0",
256
+ " #define FXAA_QUALITY_P5 12.0",
257
+ "#endif",
258
+ "/*--------------------------------------------------------------------------*/",
259
+ "#if (FXAA_QUALITY_PRESET == 14)",
260
+ " #define FXAA_QUALITY_PS 7",
261
+ " #define FXAA_QUALITY_P0 1.0",
262
+ " #define FXAA_QUALITY_P1 1.5",
263
+ " #define FXAA_QUALITY_P2 2.0",
264
+ " #define FXAA_QUALITY_P3 2.0",
265
+ " #define FXAA_QUALITY_P4 2.0",
266
+ " #define FXAA_QUALITY_P5 4.0",
267
+ " #define FXAA_QUALITY_P6 12.0",
268
+ "#endif",
269
+ "/*--------------------------------------------------------------------------*/",
270
+ "#if (FXAA_QUALITY_PRESET == 15)",
271
+ " #define FXAA_QUALITY_PS 8",
272
+ " #define FXAA_QUALITY_P0 1.0",
273
+ " #define FXAA_QUALITY_P1 1.5",
274
+ " #define FXAA_QUALITY_P2 2.0",
275
+ " #define FXAA_QUALITY_P3 2.0",
276
+ " #define FXAA_QUALITY_P4 2.0",
277
+ " #define FXAA_QUALITY_P5 2.0",
278
+ " #define FXAA_QUALITY_P6 4.0",
279
+ " #define FXAA_QUALITY_P7 12.0",
280
+ "#endif",
281
+ "",
282
+ "/*============================================================================",
283
+ " FXAA QUALITY - LOW DITHER PRESETS",
284
+ "============================================================================*/",
285
+ "#if (FXAA_QUALITY_PRESET == 20)",
286
+ " #define FXAA_QUALITY_PS 3",
287
+ " #define FXAA_QUALITY_P0 1.5",
288
+ " #define FXAA_QUALITY_P1 2.0",
289
+ " #define FXAA_QUALITY_P2 8.0",
290
+ "#endif",
291
+ "/*--------------------------------------------------------------------------*/",
292
+ "#if (FXAA_QUALITY_PRESET == 21)",
293
+ " #define FXAA_QUALITY_PS 4",
294
+ " #define FXAA_QUALITY_P0 1.0",
295
+ " #define FXAA_QUALITY_P1 1.5",
296
+ " #define FXAA_QUALITY_P2 2.0",
297
+ " #define FXAA_QUALITY_P3 8.0",
298
+ "#endif",
299
+ "/*--------------------------------------------------------------------------*/",
300
+ "#if (FXAA_QUALITY_PRESET == 22)",
301
+ " #define FXAA_QUALITY_PS 5",
302
+ " #define FXAA_QUALITY_P0 1.0",
303
+ " #define FXAA_QUALITY_P1 1.5",
304
+ " #define FXAA_QUALITY_P2 2.0",
305
+ " #define FXAA_QUALITY_P3 2.0",
306
+ " #define FXAA_QUALITY_P4 8.0",
307
+ "#endif",
308
+ "/*--------------------------------------------------------------------------*/",
309
+ "#if (FXAA_QUALITY_PRESET == 23)",
310
+ " #define FXAA_QUALITY_PS 6",
311
+ " #define FXAA_QUALITY_P0 1.0",
312
+ " #define FXAA_QUALITY_P1 1.5",
313
+ " #define FXAA_QUALITY_P2 2.0",
314
+ " #define FXAA_QUALITY_P3 2.0",
315
+ " #define FXAA_QUALITY_P4 2.0",
316
+ " #define FXAA_QUALITY_P5 8.0",
317
+ "#endif",
318
+ "/*--------------------------------------------------------------------------*/",
319
+ "#if (FXAA_QUALITY_PRESET == 24)",
320
+ " #define FXAA_QUALITY_PS 7",
321
+ " #define FXAA_QUALITY_P0 1.0",
322
+ " #define FXAA_QUALITY_P1 1.5",
323
+ " #define FXAA_QUALITY_P2 2.0",
324
+ " #define FXAA_QUALITY_P3 2.0",
325
+ " #define FXAA_QUALITY_P4 2.0",
326
+ " #define FXAA_QUALITY_P5 3.0",
327
+ " #define FXAA_QUALITY_P6 8.0",
328
+ "#endif",
329
+ "/*--------------------------------------------------------------------------*/",
330
+ "#if (FXAA_QUALITY_PRESET == 25)",
331
+ " #define FXAA_QUALITY_PS 8",
332
+ " #define FXAA_QUALITY_P0 1.0",
333
+ " #define FXAA_QUALITY_P1 1.5",
334
+ " #define FXAA_QUALITY_P2 2.0",
335
+ " #define FXAA_QUALITY_P3 2.0",
336
+ " #define FXAA_QUALITY_P4 2.0",
337
+ " #define FXAA_QUALITY_P5 2.0",
338
+ " #define FXAA_QUALITY_P6 4.0",
339
+ " #define FXAA_QUALITY_P7 8.0",
340
+ "#endif",
341
+ "/*--------------------------------------------------------------------------*/",
342
+ "#if (FXAA_QUALITY_PRESET == 26)",
343
+ " #define FXAA_QUALITY_PS 9",
344
+ " #define FXAA_QUALITY_P0 1.0",
345
+ " #define FXAA_QUALITY_P1 1.5",
346
+ " #define FXAA_QUALITY_P2 2.0",
347
+ " #define FXAA_QUALITY_P3 2.0",
348
+ " #define FXAA_QUALITY_P4 2.0",
349
+ " #define FXAA_QUALITY_P5 2.0",
350
+ " #define FXAA_QUALITY_P6 2.0",
351
+ " #define FXAA_QUALITY_P7 4.0",
352
+ " #define FXAA_QUALITY_P8 8.0",
353
+ "#endif",
354
+ "/*--------------------------------------------------------------------------*/",
355
+ "#if (FXAA_QUALITY_PRESET == 27)",
356
+ " #define FXAA_QUALITY_PS 10",
357
+ " #define FXAA_QUALITY_P0 1.0",
358
+ " #define FXAA_QUALITY_P1 1.5",
359
+ " #define FXAA_QUALITY_P2 2.0",
360
+ " #define FXAA_QUALITY_P3 2.0",
361
+ " #define FXAA_QUALITY_P4 2.0",
362
+ " #define FXAA_QUALITY_P5 2.0",
363
+ " #define FXAA_QUALITY_P6 2.0",
364
+ " #define FXAA_QUALITY_P7 2.0",
365
+ " #define FXAA_QUALITY_P8 4.0",
366
+ " #define FXAA_QUALITY_P9 8.0",
367
+ "#endif",
368
+ "/*--------------------------------------------------------------------------*/",
369
+ "#if (FXAA_QUALITY_PRESET == 28)",
370
+ " #define FXAA_QUALITY_PS 11",
371
+ " #define FXAA_QUALITY_P0 1.0",
372
+ " #define FXAA_QUALITY_P1 1.5",
373
+ " #define FXAA_QUALITY_P2 2.0",
374
+ " #define FXAA_QUALITY_P3 2.0",
375
+ " #define FXAA_QUALITY_P4 2.0",
376
+ " #define FXAA_QUALITY_P5 2.0",
377
+ " #define FXAA_QUALITY_P6 2.0",
378
+ " #define FXAA_QUALITY_P7 2.0",
379
+ " #define FXAA_QUALITY_P8 2.0",
380
+ " #define FXAA_QUALITY_P9 4.0",
381
+ " #define FXAA_QUALITY_P10 8.0",
382
+ "#endif",
383
+ "/*--------------------------------------------------------------------------*/",
384
+ "#if (FXAA_QUALITY_PRESET == 29)",
385
+ " #define FXAA_QUALITY_PS 12",
386
+ " #define FXAA_QUALITY_P0 1.0",
387
+ " #define FXAA_QUALITY_P1 1.5",
388
+ " #define FXAA_QUALITY_P2 2.0",
389
+ " #define FXAA_QUALITY_P3 2.0",
390
+ " #define FXAA_QUALITY_P4 2.0",
391
+ " #define FXAA_QUALITY_P5 2.0",
392
+ " #define FXAA_QUALITY_P6 2.0",
393
+ " #define FXAA_QUALITY_P7 2.0",
394
+ " #define FXAA_QUALITY_P8 2.0",
395
+ " #define FXAA_QUALITY_P9 2.0",
396
+ " #define FXAA_QUALITY_P10 4.0",
397
+ " #define FXAA_QUALITY_P11 8.0",
398
+ "#endif",
399
+ "",
400
+ "/*============================================================================",
401
+ " FXAA QUALITY - EXTREME QUALITY",
402
+ "============================================================================*/",
403
+ "#if (FXAA_QUALITY_PRESET == 39)",
404
+ " #define FXAA_QUALITY_PS 12",
405
+ " #define FXAA_QUALITY_P0 1.0",
406
+ " #define FXAA_QUALITY_P1 1.0",
407
+ " #define FXAA_QUALITY_P2 1.0",
408
+ " #define FXAA_QUALITY_P3 1.0",
409
+ " #define FXAA_QUALITY_P4 1.0",
410
+ " #define FXAA_QUALITY_P5 1.5",
411
+ " #define FXAA_QUALITY_P6 2.0",
412
+ " #define FXAA_QUALITY_P7 2.0",
413
+ " #define FXAA_QUALITY_P8 2.0",
414
+ " #define FXAA_QUALITY_P9 2.0",
415
+ " #define FXAA_QUALITY_P10 4.0",
416
+ " #define FXAA_QUALITY_P11 8.0",
417
+ "#endif",
418
+ "",
419
+ "",
420
+ "",
421
+ "/*============================================================================",
422
+ "",
423
+ " API PORTING",
424
+ "",
425
+ "============================================================================*/",
426
+ "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)",
427
+ " #define FxaaBool bool",
428
+ " #define FxaaDiscard discard",
429
+ " #define FxaaFloat float",
430
+ " #define FxaaFloat2 vec2",
431
+ " #define FxaaFloat3 vec3",
432
+ " #define FxaaFloat4 vec4",
433
+ " #define FxaaHalf float",
434
+ " #define FxaaHalf2 vec2",
435
+ " #define FxaaHalf3 vec3",
436
+ " #define FxaaHalf4 vec4",
437
+ " #define FxaaInt2 ivec2",
438
+ " #define FxaaSat(x) clamp(x, 0.0, 1.0)",
439
+ " #define FxaaTex sampler2D",
440
+ "#else",
441
+ " #define FxaaBool bool",
442
+ " #define FxaaDiscard clip(-1)",
443
+ " #define FxaaFloat float",
444
+ " #define FxaaFloat2 float2",
445
+ " #define FxaaFloat3 float3",
446
+ " #define FxaaFloat4 float4",
447
+ " #define FxaaHalf half",
448
+ " #define FxaaHalf2 half2",
449
+ " #define FxaaHalf3 half3",
450
+ " #define FxaaHalf4 half4",
451
+ " #define FxaaSat(x) saturate(x)",
452
+ "#endif",
453
+ "/*--------------------------------------------------------------------------*/",
454
+ "#if (FXAA_GLSL_100 == 1)",
455
+ " #define FxaaTexTop(t, p) texture2D(t, p, 0.0)",
456
+ " #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)",
457
+ "#endif",
458
+ "/*--------------------------------------------------------------------------*/",
459
+ "#if (FXAA_GLSL_120 == 1)",
460
+ " // Requires,",
461
+ " // #version 120",
462
+ " // And at least,",
463
+ " // #extension GL_EXT_gpu_shader4 : enable",
464
+ " // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)",
465
+ " #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)",
466
+ " #if (FXAA_FAST_PIXEL_OFFSET == 1)",
467
+ " #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)",
468
+ " #else",
469
+ " #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)",
470
+ " #endif",
471
+ " #if (FXAA_GATHER4_ALPHA == 1)",
472
+ " // use #extension GL_ARB_gpu_shader5 : enable",
473
+ " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)",
474
+ " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)",
475
+ " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)",
476
+ " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)",
477
+ " #endif",
478
+ "#endif",
479
+ "/*--------------------------------------------------------------------------*/",
480
+ "#if (FXAA_GLSL_130 == 1)",
481
+ ' // Requires "#version 130" or better',
482
+ " #define FxaaTexTop(t, p) textureLod(t, p, 0.0)",
483
+ " #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)",
484
+ " #if (FXAA_GATHER4_ALPHA == 1)",
485
+ " // use #extension GL_ARB_gpu_shader5 : enable",
486
+ " #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)",
487
+ " #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)",
488
+ " #define FxaaTexGreen4(t, p) textureGather(t, p, 1)",
489
+ " #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)",
490
+ " #endif",
491
+ "#endif",
492
+ "/*--------------------------------------------------------------------------*/",
493
+ "#if (FXAA_HLSL_3 == 1)",
494
+ " #define FxaaInt2 float2",
495
+ " #define FxaaTex sampler2D",
496
+ " #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))",
497
+ " #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))",
498
+ "#endif",
499
+ "/*--------------------------------------------------------------------------*/",
500
+ "#if (FXAA_HLSL_4 == 1)",
501
+ " #define FxaaInt2 int2",
502
+ " struct FxaaTex { SamplerState smpl; Texture2D tex; };",
503
+ " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)",
504
+ " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)",
505
+ "#endif",
506
+ "/*--------------------------------------------------------------------------*/",
507
+ "#if (FXAA_HLSL_5 == 1)",
508
+ " #define FxaaInt2 int2",
509
+ " struct FxaaTex { SamplerState smpl; Texture2D tex; };",
510
+ " #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)",
511
+ " #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)",
512
+ " #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)",
513
+ " #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)",
514
+ " #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)",
515
+ " #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)",
516
+ "#endif",
517
+ "",
518
+ "",
519
+ "/*============================================================================",
520
+ " GREEN AS LUMA OPTION SUPPORT FUNCTION",
521
+ "============================================================================*/",
522
+ "#if (FXAA_GREEN_AS_LUMA == 0)",
523
+ " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }",
524
+ "#else",
525
+ " FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }",
526
+ "#endif",
527
+ "",
528
+ "",
529
+ "",
530
+ "",
531
+ "/*============================================================================",
532
+ "",
533
+ " FXAA3 QUALITY - PC",
534
+ "",
535
+ "============================================================================*/",
536
+ "#if (FXAA_PC == 1)",
537
+ "/*--------------------------------------------------------------------------*/",
538
+ "FxaaFloat4 FxaaPixelShader(",
539
+ " //",
540
+ " // Use noperspective interpolation here (turn off perspective interpolation).",
541
+ " // {xy} = center of pixel",
542
+ " FxaaFloat2 pos,",
543
+ " //",
544
+ " // Used only for FXAA Console, and not used on the 360 version.",
545
+ " // Use noperspective interpolation here (turn off perspective interpolation).",
546
+ " // {xy_} = upper left of pixel",
547
+ " // {_zw} = lower right of pixel",
548
+ " FxaaFloat4 fxaaConsolePosPos,",
549
+ " //",
550
+ " // Input color texture.",
551
+ " // {rgb_} = color in linear or perceptual color space",
552
+ " // if (FXAA_GREEN_AS_LUMA == 0)",
553
+ " // {__a} = luma in perceptual color space (not linear)",
554
+ " FxaaTex tex,",
555
+ " //",
556
+ " // Only used on the optimized 360 version of FXAA Console.",
557
+ ' // For everything but 360, just use the same input here as for "tex".',
558
+ " // For 360, same texture, just alias with a 2nd sampler.",
559
+ " // This sampler needs to have an exponent bias of -1.",
560
+ " FxaaTex fxaaConsole360TexExpBiasNegOne,",
561
+ " //",
562
+ " // Only used on the optimized 360 version of FXAA Console.",
563
+ ' // For everything but 360, just use the same input here as for "tex".',
564
+ " // For 360, same texture, just alias with a 3nd sampler.",
565
+ " // This sampler needs to have an exponent bias of -2.",
566
+ " FxaaTex fxaaConsole360TexExpBiasNegTwo,",
567
+ " //",
568
+ " // Only used on FXAA Quality.",
569
+ " // This must be from a constant/uniform.",
570
+ " // {x_} = 1.0/screenWidthInPixels",
571
+ " // {_y} = 1.0/screenHeightInPixels",
572
+ " FxaaFloat2 fxaaQualityRcpFrame,",
573
+ " //",
574
+ " // Only used on FXAA Console.",
575
+ " // This must be from a constant/uniform.",
576
+ " // This effects sub-pixel AA quality and inversely sharpness.",
577
+ " // Where N ranges between,",
578
+ " // N = 0.50 (default)",
579
+ " // N = 0.33 (sharper)",
580
+ " // {x__} = -N/screenWidthInPixels",
581
+ " // {_y_} = -N/screenHeightInPixels",
582
+ " // {_z_} = N/screenWidthInPixels",
583
+ " // {__w} = N/screenHeightInPixels",
584
+ " FxaaFloat4 fxaaConsoleRcpFrameOpt,",
585
+ " //",
586
+ " // Only used on FXAA Console.",
587
+ " // Not used on 360, but used on PS3 and PC.",
588
+ " // This must be from a constant/uniform.",
589
+ " // {x__} = -2.0/screenWidthInPixels",
590
+ " // {_y_} = -2.0/screenHeightInPixels",
591
+ " // {_z_} = 2.0/screenWidthInPixels",
592
+ " // {__w} = 2.0/screenHeightInPixels",
593
+ " FxaaFloat4 fxaaConsoleRcpFrameOpt2,",
594
+ " //",
595
+ " // Only used on FXAA Console.",
596
+ " // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.",
597
+ " // This must be from a constant/uniform.",
598
+ " // {x__} = 8.0/screenWidthInPixels",
599
+ " // {_y_} = 8.0/screenHeightInPixels",
600
+ " // {_z_} = -4.0/screenWidthInPixels",
601
+ " // {__w} = -4.0/screenHeightInPixels",
602
+ " FxaaFloat4 fxaaConsole360RcpFrameOpt2,",
603
+ " //",
604
+ " // Only used on FXAA Quality.",
605
+ " // This used to be the FXAA_QUALITY_SUBPIX define.",
606
+ " // It is here now to allow easier tuning.",
607
+ " // Choose the amount of sub-pixel aliasing removal.",
608
+ " // This can effect sharpness.",
609
+ " // 1.00 - upper limit (softer)",
610
+ " // 0.75 - default amount of filtering",
611
+ " // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)",
612
+ " // 0.25 - almost off",
613
+ " // 0.00 - completely off",
614
+ " FxaaFloat fxaaQualitySubpix,",
615
+ " //",
616
+ " // Only used on FXAA Quality.",
617
+ " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.",
618
+ " // It is here now to allow easier tuning.",
619
+ " // The minimum amount of local contrast required to apply algorithm.",
620
+ " // 0.333 - too little (faster)",
621
+ " // 0.250 - low quality",
622
+ " // 0.166 - default",
623
+ " // 0.125 - high quality",
624
+ " // 0.063 - overkill (slower)",
625
+ " FxaaFloat fxaaQualityEdgeThreshold,",
626
+ " //",
627
+ " // Only used on FXAA Quality.",
628
+ " // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.",
629
+ " // It is here now to allow easier tuning.",
630
+ " // Trims the algorithm from processing darks.",
631
+ " // 0.0833 - upper limit (default, the start of visible unfiltered edges)",
632
+ " // 0.0625 - high quality (faster)",
633
+ " // 0.0312 - visible limit (slower)",
634
+ " // Special notes when using FXAA_GREEN_AS_LUMA,",
635
+ " // Likely want to set this to zero.",
636
+ " // As colors that are mostly not-green",
637
+ " // will appear very dark in the green channel!",
638
+ " // Tune by looking at mostly non-green content,",
639
+ " // then start at zero and increase until aliasing is a problem.",
640
+ " FxaaFloat fxaaQualityEdgeThresholdMin,",
641
+ " //",
642
+ " // Only used on FXAA Console.",
643
+ " // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.",
644
+ " // It is here now to allow easier tuning.",
645
+ " // This does not effect PS3, as this needs to be compiled in.",
646
+ " // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.",
647
+ " // Due to the PS3 being ALU bound,",
648
+ " // there are only three safe values here: 2 and 4 and 8.",
649
+ " // These options use the shaders ability to a free *|/ by 2|4|8.",
650
+ " // For all other platforms can be a non-power of two.",
651
+ " // 8.0 is sharper (default!!!)",
652
+ " // 4.0 is softer",
653
+ " // 2.0 is really soft (good only for vector graphics inputs)",
654
+ " FxaaFloat fxaaConsoleEdgeSharpness,",
655
+ " //",
656
+ " // Only used on FXAA Console.",
657
+ " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.",
658
+ " // It is here now to allow easier tuning.",
659
+ " // This does not effect PS3, as this needs to be compiled in.",
660
+ " // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.",
661
+ " // Due to the PS3 being ALU bound,",
662
+ " // there are only two safe values here: 1/4 and 1/8.",
663
+ " // These options use the shaders ability to a free *|/ by 2|4|8.",
664
+ " // The console setting has a different mapping than the quality setting.",
665
+ " // Other platforms can use other values.",
666
+ " // 0.125 leaves less aliasing, but is softer (default!!!)",
667
+ " // 0.25 leaves more aliasing, and is sharper",
668
+ " FxaaFloat fxaaConsoleEdgeThreshold,",
669
+ " //",
670
+ " // Only used on FXAA Console.",
671
+ " // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.",
672
+ " // It is here now to allow easier tuning.",
673
+ " // Trims the algorithm from processing darks.",
674
+ " // The console setting has a different mapping than the quality setting.",
675
+ " // This only applies when FXAA_EARLY_EXIT is 1.",
676
+ " // This does not apply to PS3,",
677
+ " // PS3 was simplified to avoid more shader instructions.",
678
+ " // 0.06 - faster but more aliasing in darks",
679
+ " // 0.05 - default",
680
+ " // 0.04 - slower and less aliasing in darks",
681
+ " // Special notes when using FXAA_GREEN_AS_LUMA,",
682
+ " // Likely want to set this to zero.",
683
+ " // As colors that are mostly not-green",
684
+ " // will appear very dark in the green channel!",
685
+ " // Tune by looking at mostly non-green content,",
686
+ " // then start at zero and increase until aliasing is a problem.",
687
+ " FxaaFloat fxaaConsoleEdgeThresholdMin,",
688
+ " //",
689
+ " // Extra constants for 360 FXAA Console only.",
690
+ " // Use zeros or anything else for other platforms.",
691
+ " // These must be in physical constant registers and NOT immediates.",
692
+ " // Immediates will result in compiler un-optimizing.",
693
+ " // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)",
694
+ " FxaaFloat4 fxaaConsole360ConstDir",
695
+ ") {",
696
+ "/*--------------------------------------------------------------------------*/",
697
+ " FxaaFloat2 posM;",
698
+ " posM.x = pos.x;",
699
+ " posM.y = pos.y;",
700
+ " #if (FXAA_GATHER4_ALPHA == 1)",
701
+ " #if (FXAA_DISCARD == 0)",
702
+ " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);",
703
+ " #if (FXAA_GREEN_AS_LUMA == 0)",
704
+ " #define lumaM rgbyM.w",
705
+ " #else",
706
+ " #define lumaM rgbyM.y",
707
+ " #endif",
708
+ " #endif",
709
+ " #if (FXAA_GREEN_AS_LUMA == 0)",
710
+ " FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);",
711
+ " FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));",
712
+ " #else",
713
+ " FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);",
714
+ " FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));",
715
+ " #endif",
716
+ " #if (FXAA_DISCARD == 1)",
717
+ " #define lumaM luma4A.w",
718
+ " #endif",
719
+ " #define lumaE luma4A.z",
720
+ " #define lumaS luma4A.x",
721
+ " #define lumaSE luma4A.y",
722
+ " #define lumaNW luma4B.w",
723
+ " #define lumaN luma4B.z",
724
+ " #define lumaW luma4B.x",
725
+ " #else",
726
+ " FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);",
727
+ " #if (FXAA_GREEN_AS_LUMA == 0)",
728
+ " #define lumaM rgbyM.w",
729
+ " #else",
730
+ " #define lumaM rgbyM.y",
731
+ " #endif",
732
+ " #if (FXAA_GLSL_100 == 1)",
733
+ " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));",
734
+ " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));",
735
+ " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));",
736
+ " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));",
737
+ " #else",
738
+ " FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));",
739
+ " FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));",
740
+ " FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));",
741
+ " FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));",
742
+ " #endif",
743
+ " #endif",
744
+ "/*--------------------------------------------------------------------------*/",
745
+ " FxaaFloat maxSM = max(lumaS, lumaM);",
746
+ " FxaaFloat minSM = min(lumaS, lumaM);",
747
+ " FxaaFloat maxESM = max(lumaE, maxSM);",
748
+ " FxaaFloat minESM = min(lumaE, minSM);",
749
+ " FxaaFloat maxWN = max(lumaN, lumaW);",
750
+ " FxaaFloat minWN = min(lumaN, lumaW);",
751
+ " FxaaFloat rangeMax = max(maxWN, maxESM);",
752
+ " FxaaFloat rangeMin = min(minWN, minESM);",
753
+ " FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;",
754
+ " FxaaFloat range = rangeMax - rangeMin;",
755
+ " FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);",
756
+ " FxaaBool earlyExit = range < rangeMaxClamped;",
757
+ "/*--------------------------------------------------------------------------*/",
758
+ " if(earlyExit)",
759
+ " #if (FXAA_DISCARD == 1)",
760
+ " FxaaDiscard;",
761
+ " #else",
762
+ " return rgbyM;",
763
+ " #endif",
764
+ "/*--------------------------------------------------------------------------*/",
765
+ " #if (FXAA_GATHER4_ALPHA == 0)",
766
+ " #if (FXAA_GLSL_100 == 1)",
767
+ " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));",
768
+ " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));",
769
+ " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));",
770
+ " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));",
771
+ " #else",
772
+ " FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));",
773
+ " FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));",
774
+ " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));",
775
+ " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));",
776
+ " #endif",
777
+ " #else",
778
+ " FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));",
779
+ " FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));",
780
+ " #endif",
781
+ "/*--------------------------------------------------------------------------*/",
782
+ " FxaaFloat lumaNS = lumaN + lumaS;",
783
+ " FxaaFloat lumaWE = lumaW + lumaE;",
784
+ " FxaaFloat subpixRcpRange = 1.0/range;",
785
+ " FxaaFloat subpixNSWE = lumaNS + lumaWE;",
786
+ " FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;",
787
+ " FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;",
788
+ "/*--------------------------------------------------------------------------*/",
789
+ " FxaaFloat lumaNESE = lumaNE + lumaSE;",
790
+ " FxaaFloat lumaNWNE = lumaNW + lumaNE;",
791
+ " FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;",
792
+ " FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;",
793
+ "/*--------------------------------------------------------------------------*/",
794
+ " FxaaFloat lumaNWSW = lumaNW + lumaSW;",
795
+ " FxaaFloat lumaSWSE = lumaSW + lumaSE;",
796
+ " FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);",
797
+ " FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);",
798
+ " FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;",
799
+ " FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;",
800
+ " FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;",
801
+ " FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;",
802
+ "/*--------------------------------------------------------------------------*/",
803
+ " FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;",
804
+ " FxaaFloat lengthSign = fxaaQualityRcpFrame.x;",
805
+ " FxaaBool horzSpan = edgeHorz >= edgeVert;",
806
+ " FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;",
807
+ "/*--------------------------------------------------------------------------*/",
808
+ " if(!horzSpan) lumaN = lumaW;",
809
+ " if(!horzSpan) lumaS = lumaE;",
810
+ " if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;",
811
+ " FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;",
812
+ "/*--------------------------------------------------------------------------*/",
813
+ " FxaaFloat gradientN = lumaN - lumaM;",
814
+ " FxaaFloat gradientS = lumaS - lumaM;",
815
+ " FxaaFloat lumaNN = lumaN + lumaM;",
816
+ " FxaaFloat lumaSS = lumaS + lumaM;",
817
+ " FxaaBool pairN = abs(gradientN) >= abs(gradientS);",
818
+ " FxaaFloat gradient = max(abs(gradientN), abs(gradientS));",
819
+ " if(pairN) lengthSign = -lengthSign;",
820
+ " FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);",
821
+ "/*--------------------------------------------------------------------------*/",
822
+ " FxaaFloat2 posB;",
823
+ " posB.x = posM.x;",
824
+ " posB.y = posM.y;",
825
+ " FxaaFloat2 offNP;",
826
+ " offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;",
827
+ " offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;",
828
+ " if(!horzSpan) posB.x += lengthSign * 0.5;",
829
+ " if( horzSpan) posB.y += lengthSign * 0.5;",
830
+ "/*--------------------------------------------------------------------------*/",
831
+ " FxaaFloat2 posN;",
832
+ " posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;",
833
+ " posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;",
834
+ " FxaaFloat2 posP;",
835
+ " posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;",
836
+ " posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;",
837
+ " FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;",
838
+ " FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));",
839
+ " FxaaFloat subpixE = subpixC * subpixC;",
840
+ " FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));",
841
+ "/*--------------------------------------------------------------------------*/",
842
+ " if(!pairN) lumaNN = lumaSS;",
843
+ " FxaaFloat gradientScaled = gradient * 1.0/4.0;",
844
+ " FxaaFloat lumaMM = lumaM - lumaNN * 0.5;",
845
+ " FxaaFloat subpixF = subpixD * subpixE;",
846
+ " FxaaBool lumaMLTZero = lumaMM < 0.0;",
847
+ "/*--------------------------------------------------------------------------*/",
848
+ " lumaEndN -= lumaNN * 0.5;",
849
+ " lumaEndP -= lumaNN * 0.5;",
850
+ " FxaaBool doneN = abs(lumaEndN) >= gradientScaled;",
851
+ " FxaaBool doneP = abs(lumaEndP) >= gradientScaled;",
852
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;",
853
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;",
854
+ " FxaaBool doneNP = (!doneN) || (!doneP);",
855
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;",
856
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;",
857
+ "/*--------------------------------------------------------------------------*/",
858
+ " if(doneNP) {",
859
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
860
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
861
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
862
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
863
+ " doneN = abs(lumaEndN) >= gradientScaled;",
864
+ " doneP = abs(lumaEndP) >= gradientScaled;",
865
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;",
866
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;",
867
+ " doneNP = (!doneN) || (!doneP);",
868
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;",
869
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;",
870
+ "/*--------------------------------------------------------------------------*/",
871
+ " #if (FXAA_QUALITY_PS > 3)",
872
+ " if(doneNP) {",
873
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
874
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
875
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
876
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
877
+ " doneN = abs(lumaEndN) >= gradientScaled;",
878
+ " doneP = abs(lumaEndP) >= gradientScaled;",
879
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;",
880
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;",
881
+ " doneNP = (!doneN) || (!doneP);",
882
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;",
883
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;",
884
+ "/*--------------------------------------------------------------------------*/",
885
+ " #if (FXAA_QUALITY_PS > 4)",
886
+ " if(doneNP) {",
887
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
888
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
889
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
890
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
891
+ " doneN = abs(lumaEndN) >= gradientScaled;",
892
+ " doneP = abs(lumaEndP) >= gradientScaled;",
893
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;",
894
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;",
895
+ " doneNP = (!doneN) || (!doneP);",
896
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;",
897
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;",
898
+ "/*--------------------------------------------------------------------------*/",
899
+ " #if (FXAA_QUALITY_PS > 5)",
900
+ " if(doneNP) {",
901
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
902
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
903
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
904
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
905
+ " doneN = abs(lumaEndN) >= gradientScaled;",
906
+ " doneP = abs(lumaEndP) >= gradientScaled;",
907
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;",
908
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;",
909
+ " doneNP = (!doneN) || (!doneP);",
910
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;",
911
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;",
912
+ "/*--------------------------------------------------------------------------*/",
913
+ " #if (FXAA_QUALITY_PS > 6)",
914
+ " if(doneNP) {",
915
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
916
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
917
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
918
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
919
+ " doneN = abs(lumaEndN) >= gradientScaled;",
920
+ " doneP = abs(lumaEndP) >= gradientScaled;",
921
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;",
922
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;",
923
+ " doneNP = (!doneN) || (!doneP);",
924
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;",
925
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;",
926
+ "/*--------------------------------------------------------------------------*/",
927
+ " #if (FXAA_QUALITY_PS > 7)",
928
+ " if(doneNP) {",
929
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
930
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
931
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
932
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
933
+ " doneN = abs(lumaEndN) >= gradientScaled;",
934
+ " doneP = abs(lumaEndP) >= gradientScaled;",
935
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;",
936
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;",
937
+ " doneNP = (!doneN) || (!doneP);",
938
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;",
939
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;",
940
+ "/*--------------------------------------------------------------------------*/",
941
+ " #if (FXAA_QUALITY_PS > 8)",
942
+ " if(doneNP) {",
943
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
944
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
945
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
946
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
947
+ " doneN = abs(lumaEndN) >= gradientScaled;",
948
+ " doneP = abs(lumaEndP) >= gradientScaled;",
949
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;",
950
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;",
951
+ " doneNP = (!doneN) || (!doneP);",
952
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;",
953
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;",
954
+ "/*--------------------------------------------------------------------------*/",
955
+ " #if (FXAA_QUALITY_PS > 9)",
956
+ " if(doneNP) {",
957
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
958
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
959
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
960
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
961
+ " doneN = abs(lumaEndN) >= gradientScaled;",
962
+ " doneP = abs(lumaEndP) >= gradientScaled;",
963
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;",
964
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;",
965
+ " doneNP = (!doneN) || (!doneP);",
966
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;",
967
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;",
968
+ "/*--------------------------------------------------------------------------*/",
969
+ " #if (FXAA_QUALITY_PS > 10)",
970
+ " if(doneNP) {",
971
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
972
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
973
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
974
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
975
+ " doneN = abs(lumaEndN) >= gradientScaled;",
976
+ " doneP = abs(lumaEndP) >= gradientScaled;",
977
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;",
978
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;",
979
+ " doneNP = (!doneN) || (!doneP);",
980
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;",
981
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;",
982
+ "/*--------------------------------------------------------------------------*/",
983
+ " #if (FXAA_QUALITY_PS > 11)",
984
+ " if(doneNP) {",
985
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
986
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
987
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
988
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
989
+ " doneN = abs(lumaEndN) >= gradientScaled;",
990
+ " doneP = abs(lumaEndP) >= gradientScaled;",
991
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;",
992
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;",
993
+ " doneNP = (!doneN) || (!doneP);",
994
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;",
995
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;",
996
+ "/*--------------------------------------------------------------------------*/",
997
+ " #if (FXAA_QUALITY_PS > 12)",
998
+ " if(doneNP) {",
999
+ " if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));",
1000
+ " if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));",
1001
+ " if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;",
1002
+ " if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;",
1003
+ " doneN = abs(lumaEndN) >= gradientScaled;",
1004
+ " doneP = abs(lumaEndP) >= gradientScaled;",
1005
+ " if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;",
1006
+ " if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;",
1007
+ " doneNP = (!doneN) || (!doneP);",
1008
+ " if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;",
1009
+ " if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;",
1010
+ "/*--------------------------------------------------------------------------*/",
1011
+ " }",
1012
+ " #endif",
1013
+ "/*--------------------------------------------------------------------------*/",
1014
+ " }",
1015
+ " #endif",
1016
+ "/*--------------------------------------------------------------------------*/",
1017
+ " }",
1018
+ " #endif",
1019
+ "/*--------------------------------------------------------------------------*/",
1020
+ " }",
1021
+ " #endif",
1022
+ "/*--------------------------------------------------------------------------*/",
1023
+ " }",
1024
+ " #endif",
1025
+ "/*--------------------------------------------------------------------------*/",
1026
+ " }",
1027
+ " #endif",
1028
+ "/*--------------------------------------------------------------------------*/",
1029
+ " }",
1030
+ " #endif",
1031
+ "/*--------------------------------------------------------------------------*/",
1032
+ " }",
1033
+ " #endif",
1034
+ "/*--------------------------------------------------------------------------*/",
1035
+ " }",
1036
+ " #endif",
1037
+ "/*--------------------------------------------------------------------------*/",
1038
+ " }",
1039
+ " #endif",
1040
+ "/*--------------------------------------------------------------------------*/",
1041
+ " }",
1042
+ "/*--------------------------------------------------------------------------*/",
1043
+ " FxaaFloat dstN = posM.x - posN.x;",
1044
+ " FxaaFloat dstP = posP.x - posM.x;",
1045
+ " if(!horzSpan) dstN = posM.y - posN.y;",
1046
+ " if(!horzSpan) dstP = posP.y - posM.y;",
1047
+ "/*--------------------------------------------------------------------------*/",
1048
+ " FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;",
1049
+ " FxaaFloat spanLength = (dstP + dstN);",
1050
+ " FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;",
1051
+ " FxaaFloat spanLengthRcp = 1.0/spanLength;",
1052
+ "/*--------------------------------------------------------------------------*/",
1053
+ " FxaaBool directionN = dstN < dstP;",
1054
+ " FxaaFloat dst = min(dstN, dstP);",
1055
+ " FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;",
1056
+ " FxaaFloat subpixG = subpixF * subpixF;",
1057
+ " FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;",
1058
+ " FxaaFloat subpixH = subpixG * fxaaQualitySubpix;",
1059
+ "/*--------------------------------------------------------------------------*/",
1060
+ " FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;",
1061
+ " FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);",
1062
+ " if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;",
1063
+ " if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;",
1064
+ " #if (FXAA_DISCARD == 1)",
1065
+ " return FxaaTexTop(tex, posM);",
1066
+ " #else",
1067
+ " return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);",
1068
+ " #endif",
1069
+ "}",
1070
+ "/*==========================================================================*/",
1071
+ "#endif",
1072
+ "",
1073
+ "void main() {",
1074
+ " gl_FragColor = FxaaPixelShader(",
1075
+ " vUv,",
1076
+ " vec4(0.0),",
1077
+ " tDiffuse,",
1078
+ " tDiffuse,",
1079
+ " tDiffuse,",
1080
+ " resolution,",
1081
+ " vec4(0.0),",
1082
+ " vec4(0.0),",
1083
+ " vec4(0.0),",
1084
+ " 0.75,",
1085
+ " 0.166,",
1086
+ " 0.0833,",
1087
+ " 0.0,",
1088
+ " 0.0,",
1089
+ " 0.0,",
1090
+ " vec4(0.0)",
1091
+ " );",
1092
+ "",
1093
+ " // TODO avoid querying texture twice for same texel",
1094
+ " gl_FragColor.a = texture2D(tDiffuse, vUv).a;",
1095
+ "}"
1096
+ ].join("\n")
1106
1097
  };
1107
1098
  exports.FXAAShader = FXAAShader;
1108
1099
  //# sourceMappingURL=FXAAShader.cjs.map