three-stdlib 2.35.2 → 2.35.4

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