super-three 0.137.0 → 0.141.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (703) hide show
  1. package/README.md +23 -25
  2. package/build/three.cjs +3721 -4964
  3. package/build/three.js +3723 -4966
  4. package/build/three.min.js +1 -1
  5. package/build/three.module.js +5705 -7216
  6. package/examples/js/animation/CCDIKSolver.js +3 -2
  7. package/examples/js/animation/MMDPhysics.js +2 -2
  8. package/examples/js/controls/ArcballControls.js +3 -1
  9. package/examples/js/controls/PointerLockControls.js +3 -2
  10. package/examples/js/controls/TrackballControls.js +1 -4
  11. package/examples/js/controls/TransformControls.js +5 -6
  12. package/examples/js/controls/experimental/CameraControls.js +2 -2
  13. package/examples/js/csm/CSMFrustum.js +1 -1
  14. package/examples/js/csm/CSMShader.js +51 -35
  15. package/examples/js/curves/CurveExtras.js +14 -18
  16. package/examples/js/effects/AnaglyphEffect.js +7 -4
  17. package/examples/js/effects/AsciiEffect.js +10 -29
  18. package/examples/js/exporters/ColladaExporter.js +29 -7
  19. package/examples/js/exporters/EXRExporter.js +458 -0
  20. package/examples/js/exporters/GLTFExporter.js +213 -128
  21. package/examples/js/exporters/OBJExporter.js +12 -18
  22. package/examples/js/exporters/PLYExporter.js +15 -20
  23. package/examples/js/exporters/USDZExporter.js +13 -0
  24. package/examples/js/geometries/DecalGeometry.js +0 -7
  25. package/examples/js/geometries/LightningStrike.js +2 -2
  26. package/examples/js/geometries/ParametricGeometries.js +3 -3
  27. package/examples/js/helpers/OctreeHelper.js +74 -0
  28. package/examples/js/helpers/VertexNormalsHelper.js +4 -23
  29. package/examples/js/helpers/VertexTangentsHelper.js +3 -13
  30. package/examples/js/helpers/ViewHelper.js +266 -0
  31. package/examples/js/interactive/HTMLMesh.js +235 -40
  32. package/examples/js/interactive/SelectionHelper.js +1 -1
  33. package/examples/js/libs/opentype.min.js +1 -118
  34. package/examples/js/lines/Line2.js +1 -2
  35. package/examples/js/lines/LineGeometry.js +10 -21
  36. package/examples/js/lines/LineMaterial.js +2 -3
  37. package/examples/js/lines/LineSegments2.js +214 -140
  38. package/examples/js/lines/LineSegmentsGeometry.js +3 -14
  39. package/examples/js/lines/Wireframe.js +2 -3
  40. package/examples/js/lines/WireframeGeometry2.js +1 -2
  41. package/examples/js/loaders/3MFLoader.js +21 -17
  42. package/examples/js/loaders/AMFLoader.js +1 -1
  43. package/examples/js/loaders/ColladaLoader.js +33 -12
  44. package/examples/js/loaders/DDSLoader.js +23 -30
  45. package/examples/js/loaders/EXRLoader.js +269 -266
  46. package/examples/js/loaders/FBXLoader.js +11 -0
  47. package/examples/js/loaders/FontLoader.js +1 -2
  48. package/examples/js/loaders/GCodeLoader.js +0 -1
  49. package/examples/js/loaders/GLTFLoader.js +249 -60
  50. package/examples/js/loaders/KMZLoader.js +1 -1
  51. package/examples/js/loaders/KTX2Loader.js +1 -9
  52. package/examples/js/loaders/LDrawLoader.js +3 -11
  53. package/examples/js/loaders/LUT3dlLoader.js +1 -1
  54. package/examples/js/loaders/LUTCubeLoader.js +1 -1
  55. package/examples/js/loaders/LWOLoader.js +4 -2
  56. package/examples/js/loaders/LogLuvLoader.js +1 -2
  57. package/examples/js/loaders/MMDLoader.js +18 -4
  58. package/examples/js/loaders/NRRDLoader.js +1 -1
  59. package/examples/js/loaders/OBJLoader.js +9 -5
  60. package/examples/js/loaders/PCDLoader.js +22 -13
  61. package/examples/js/loaders/PDBLoader.js +11 -11
  62. package/examples/js/loaders/PLYLoader.js +5 -1
  63. package/examples/js/loaders/RGBELoader.js +3 -11
  64. package/examples/js/loaders/RGBMLoader.js +12 -15
  65. package/examples/js/loaders/SVGLoader.js +16 -9
  66. package/examples/js/loaders/VOXLoader.js +3 -4
  67. package/examples/js/loaders/VTKLoader.js +260 -295
  68. package/examples/js/loaders/lwo/LWO2Parser.js +4 -4
  69. package/examples/js/loaders/lwo/LWO3Parser.js +4 -4
  70. package/examples/js/math/ConvexHull.js +6 -15
  71. package/examples/js/math/Lut.js +27 -26
  72. package/examples/js/misc/MorphAnimMesh.js +2 -2
  73. package/examples/js/misc/ProgressiveLightMap.js +1 -1
  74. package/examples/js/misc/Volume.js +37 -46
  75. package/examples/js/misc/VolumeSlice.js +21 -21
  76. package/examples/js/modifiers/EdgeSplitModifier.js +0 -7
  77. package/examples/js/modifiers/SimplifyModifier.js +1 -8
  78. package/examples/js/modifiers/TessellateModifier.js +0 -7
  79. package/examples/js/objects/Lensflare.js +2 -2
  80. package/examples/js/objects/LightningStorm.js +4 -5
  81. package/examples/js/objects/MarchingCubes.js +6 -11
  82. package/examples/js/objects/Reflector.js +10 -4
  83. package/examples/js/objects/ReflectorForSSRPass.js +1 -1
  84. package/examples/js/objects/Refractor.js +10 -4
  85. package/examples/js/objects/ShadowMesh.js +1 -2
  86. package/examples/js/objects/Sky.js +1 -1
  87. package/examples/js/objects/Water.js +1 -2
  88. package/examples/js/objects/Water2.js +1 -1
  89. package/examples/js/postprocessing/AdaptiveToneMappingPass.js +6 -10
  90. package/examples/js/postprocessing/AfterimagePass.js +2 -6
  91. package/examples/js/postprocessing/BloomPass.js +50 -19
  92. package/examples/js/postprocessing/DotScreenPass.js +1 -1
  93. package/examples/js/postprocessing/EffectComposer.js +1 -6
  94. package/examples/js/postprocessing/LUTPass.js +2 -2
  95. package/examples/js/postprocessing/OutlinePass.js +7 -12
  96. package/examples/js/postprocessing/SAOPass.js +2 -7
  97. package/examples/js/postprocessing/SSAARenderPass.js +1 -6
  98. package/examples/js/postprocessing/SSRPass.js +3 -8
  99. package/examples/js/postprocessing/TAARenderPass.js +4 -4
  100. package/examples/js/postprocessing/UnrealBloomPass.js +3 -12
  101. package/examples/js/renderers/CSS2DRenderer.js +20 -25
  102. package/examples/js/renderers/CSS3DRenderer.js +6 -7
  103. package/examples/js/renderers/Projector.js +97 -124
  104. package/examples/js/renderers/SVGRenderer.js +3 -4
  105. package/examples/js/shaders/BlendShader.js +2 -1
  106. package/examples/js/shaders/CopyShader.js +4 -3
  107. package/examples/js/shaders/FXAAShader.js +239 -1069
  108. package/examples/js/shaders/FreiChenShader.js +1 -1
  109. package/examples/js/shaders/HorizontalBlurShader.js +1 -1
  110. package/examples/js/shaders/HorizontalTiltShiftShader.js +1 -1
  111. package/examples/js/shaders/SSRShader.js +3 -3
  112. package/examples/js/shaders/ToneMapShader.js +1 -1
  113. package/examples/js/utils/BufferGeometryUtils.js +282 -22
  114. package/examples/js/utils/GPUStatsPanel.js +1 -1
  115. package/examples/js/utils/LDrawUtils.js +6 -6
  116. package/examples/js/utils/SceneUtils.js +59 -0
  117. package/examples/js/utils/SkeletonUtils.js +1 -1
  118. package/examples/js/utils/UVsDebug.js +23 -33
  119. package/examples/jsm/animation/CCDIKSolver.js +3 -9
  120. package/examples/jsm/animation/MMDPhysics.js +1 -1
  121. package/examples/jsm/capabilities/WebGPU.js +6 -0
  122. package/examples/jsm/controls/ArcballControls.js +3 -1
  123. package/examples/jsm/controls/PointerLockControls.js +4 -2
  124. package/examples/jsm/controls/TrackballControls.js +1 -4
  125. package/examples/jsm/controls/TransformControls.js +6 -6
  126. package/examples/jsm/controls/experimental/CameraControls.js +2 -2
  127. package/examples/jsm/csm/CSMFrustum.js +1 -1
  128. package/examples/jsm/csm/CSMShader.js +51 -35
  129. package/examples/jsm/curves/CurveExtras.js +15 -17
  130. package/examples/jsm/effects/AnaglyphEffect.js +4 -4
  131. package/examples/jsm/effects/AsciiEffect.js +9 -22
  132. package/examples/jsm/exporters/ColladaExporter.js +31 -6
  133. package/examples/jsm/exporters/EXRExporter.js +507 -0
  134. package/examples/jsm/exporters/GLTFExporter.js +231 -125
  135. package/examples/jsm/exporters/KTX2Exporter.js +281 -0
  136. package/examples/jsm/exporters/OBJExporter.js +11 -18
  137. package/examples/jsm/exporters/PLYExporter.js +23 -21
  138. package/examples/jsm/exporters/USDZExporter.js +12 -0
  139. package/examples/jsm/geometries/DecalGeometry.js +0 -7
  140. package/examples/jsm/geometries/LightningStrike.js +2 -2
  141. package/examples/jsm/geometries/ParametricGeometries.js +3 -3
  142. package/examples/jsm/helpers/OctreeHelper.js +58 -0
  143. package/examples/jsm/helpers/VertexNormalsHelper.js +4 -25
  144. package/examples/jsm/helpers/VertexTangentsHelper.js +3 -15
  145. package/examples/jsm/helpers/ViewHelper.js +295 -0
  146. package/examples/jsm/interactive/HTMLMesh.js +252 -34
  147. package/examples/jsm/interactive/SelectionHelper.js +1 -1
  148. package/examples/jsm/libs/flow.module.js +30 -27
  149. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  150. package/examples/jsm/libs/mikktspace.module.js +128 -0
  151. package/examples/jsm/libs/opentype.module.js +14568 -0
  152. package/examples/jsm/lines/Line2.js +2 -2
  153. package/examples/jsm/lines/LineGeometry.js +11 -19
  154. package/examples/jsm/lines/LineMaterial.js +3 -3
  155. package/examples/jsm/lines/LineSegments2.js +210 -145
  156. package/examples/jsm/lines/LineSegmentsGeometry.js +3 -12
  157. package/examples/jsm/lines/Wireframe.js +3 -3
  158. package/examples/jsm/lines/WireframeGeometry2.js +2 -2
  159. package/examples/jsm/loaders/3DMLoader.js +3 -2
  160. package/examples/jsm/loaders/3MFLoader.js +21 -17
  161. package/examples/jsm/loaders/AMFLoader.js +1 -1
  162. package/examples/jsm/loaders/ColladaLoader.js +40 -12
  163. package/examples/jsm/loaders/DDSLoader.js +21 -28
  164. package/examples/jsm/loaders/EXRLoader.js +268 -265
  165. package/examples/jsm/loaders/FBXLoader.js +11 -0
  166. package/examples/jsm/loaders/FontLoader.js +2 -2
  167. package/examples/jsm/loaders/GCodeLoader.js +0 -1
  168. package/examples/jsm/loaders/GLTFLoader.js +263 -66
  169. package/examples/jsm/loaders/KMZLoader.js +1 -1
  170. package/examples/jsm/loaders/KTX2Loader.js +1 -10
  171. package/examples/jsm/loaders/LDrawLoader.js +4 -11
  172. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  173. package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
  174. package/examples/jsm/loaders/LWOLoader.js +5 -3
  175. package/examples/jsm/loaders/LogLuvLoader.js +2 -2
  176. package/examples/jsm/loaders/MMDLoader.js +21 -3
  177. package/examples/jsm/loaders/NRRDLoader.js +1 -2
  178. package/examples/jsm/loaders/OBJLoader.js +11 -7
  179. package/examples/jsm/loaders/PCDLoader.js +23 -15
  180. package/examples/jsm/loaders/PDBLoader.js +11 -11
  181. package/examples/jsm/loaders/PLYLoader.js +10 -2
  182. package/examples/jsm/loaders/RGBELoader.js +4 -12
  183. package/examples/jsm/loaders/RGBMLoader.js +14 -11
  184. package/examples/jsm/loaders/SVGLoader.js +17 -9
  185. package/examples/jsm/loaders/TTFLoader.js +1 -1
  186. package/examples/jsm/loaders/VOXLoader.js +5 -5
  187. package/examples/jsm/loaders/VTKLoader.js +256 -284
  188. package/examples/jsm/loaders/ifc/web-ifc-api.js +9 -8
  189. package/examples/jsm/loaders/lwo/LWO2Parser.js +4 -4
  190. package/examples/jsm/loaders/lwo/LWO3Parser.js +4 -4
  191. package/examples/jsm/math/ConvexHull.js +6 -15
  192. package/examples/jsm/math/Lut.js +35 -25
  193. package/examples/jsm/misc/MorphAnimMesh.js +2 -2
  194. package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
  195. package/examples/jsm/misc/Volume.js +37 -44
  196. package/examples/jsm/misc/VolumeSlice.js +21 -21
  197. package/examples/jsm/modifiers/EdgeSplitModifier.js +0 -7
  198. package/examples/jsm/modifiers/SimplifyModifier.js +1 -8
  199. package/examples/jsm/modifiers/TessellateModifier.js +0 -7
  200. package/examples/jsm/node-editor/NodeEditor.js +78 -9
  201. package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +14 -0
  202. package/examples/jsm/node-editor/accessors/NormalEditor.js +1 -1
  203. package/examples/jsm/node-editor/accessors/PositionEditor.js +1 -1
  204. package/examples/jsm/node-editor/accessors/UVEditor.js +1 -1
  205. package/examples/jsm/node-editor/core/BaseNode.js +17 -11
  206. package/examples/jsm/node-editor/core/DataFile.js +59 -0
  207. package/examples/jsm/node-editor/core/FileEditor.js +20 -0
  208. package/examples/jsm/node-editor/core/FileURLEditor.js +29 -0
  209. package/examples/jsm/node-editor/display/BlendEditor.js +3 -3
  210. package/examples/jsm/node-editor/display/NormalMapEditor.js +49 -0
  211. package/examples/jsm/node-editor/examples/matcap.json +1 -0
  212. package/examples/jsm/node-editor/inputs/ColorEditor.js +7 -6
  213. package/examples/jsm/node-editor/inputs/FloatEditor.js +2 -2
  214. package/examples/jsm/node-editor/inputs/SliderEditor.js +2 -2
  215. package/examples/jsm/node-editor/inputs/TextureEditor.js +155 -0
  216. package/examples/jsm/node-editor/inputs/Vector2Editor.js +3 -2
  217. package/examples/jsm/node-editor/inputs/Vector3Editor.js +3 -2
  218. package/examples/jsm/node-editor/inputs/Vector4Editor.js +4 -3
  219. package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +3 -3
  220. package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +16 -11
  221. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +15 -5
  222. package/examples/jsm/node-editor/math/AngleEditor.js +3 -2
  223. package/examples/jsm/node-editor/math/DotEditor.js +2 -2
  224. package/examples/jsm/node-editor/math/InvertEditor.js +4 -4
  225. package/examples/jsm/node-editor/math/LimiterEditor.js +22 -9
  226. package/examples/jsm/node-editor/math/NormalizeEditor.js +3 -2
  227. package/examples/jsm/node-editor/math/OperatorEditor.js +20 -8
  228. package/examples/jsm/node-editor/math/PowerEditor.js +17 -8
  229. package/examples/jsm/node-editor/math/TrigonometryEditor.js +3 -2
  230. package/examples/jsm/node-editor/procedural/CheckerEditor.js +4 -4
  231. package/examples/jsm/node-editor/utils/JoinEditor.js +2 -2
  232. package/examples/jsm/node-editor/utils/OscillatorEditor.js +2 -2
  233. package/examples/jsm/node-editor/utils/PreviewEditor.js +166 -0
  234. package/examples/jsm/node-editor/utils/SplitEditor.js +2 -2
  235. package/examples/jsm/node-editor/utils/TimerEditor.js +1 -1
  236. package/examples/jsm/nodes/Nodes.js +283 -94
  237. package/examples/jsm/nodes/accessors/BufferNode.js +24 -0
  238. package/examples/jsm/nodes/accessors/CameraNode.js +27 -196
  239. package/examples/jsm/nodes/accessors/CubeTextureNode.js +103 -0
  240. package/examples/jsm/nodes/accessors/InstanceNode.js +58 -0
  241. package/examples/jsm/{renderers/nodes → nodes}/accessors/MaterialNode.js +49 -11
  242. package/examples/jsm/{renderers/nodes → nodes}/accessors/MaterialReferenceNode.js +0 -0
  243. package/examples/jsm/{renderers/nodes → nodes}/accessors/ModelNode.js +8 -0
  244. package/examples/jsm/{renderers/nodes → nodes}/accessors/ModelViewProjectionNode.js +0 -0
  245. package/examples/jsm/nodes/accessors/NormalNode.js +39 -99
  246. package/examples/jsm/{renderers/nodes → nodes}/accessors/Object3DNode.js +34 -17
  247. package/examples/jsm/{renderers/nodes → nodes}/accessors/PointUVNode.js +2 -2
  248. package/examples/jsm/nodes/accessors/PositionNode.js +41 -110
  249. package/examples/jsm/nodes/accessors/ReferenceNode.js +65 -0
  250. package/examples/jsm/nodes/accessors/ReflectNode.js +34 -121
  251. package/examples/jsm/nodes/accessors/SkinningNode.js +102 -0
  252. package/examples/jsm/nodes/accessors/StorageBufferNode.js +21 -0
  253. package/examples/jsm/nodes/accessors/TextureNode.js +100 -0
  254. package/examples/jsm/nodes/accessors/UVNode.js +17 -43
  255. package/examples/jsm/nodes/accessors/UserDataNode.js +23 -0
  256. package/examples/jsm/nodes/core/ArrayUniformNode.js +23 -0
  257. package/examples/jsm/nodes/core/AttributeNode.js +33 -30
  258. package/examples/jsm/{renderers/nodes → nodes}/core/BypassNode.js +2 -2
  259. package/examples/jsm/{renderers/nodes → nodes}/core/CodeNode.js +2 -30
  260. package/examples/jsm/nodes/core/ConstNode.js +10 -106
  261. package/examples/jsm/{renderers/nodes → nodes}/core/ContextNode.js +17 -3
  262. package/examples/jsm/nodes/core/ExpressionNode.js +24 -7
  263. package/examples/jsm/nodes/core/FunctionCallNode.js +26 -67
  264. package/examples/jsm/nodes/core/FunctionNode.js +43 -216
  265. package/examples/jsm/nodes/core/InputNode.js +28 -60
  266. package/examples/jsm/nodes/core/InstanceIndexNode.js +21 -0
  267. package/examples/jsm/nodes/core/Node.js +228 -94
  268. package/examples/jsm/{renderers/nodes → nodes}/core/NodeAttribute.js +2 -2
  269. package/examples/jsm/nodes/core/NodeBuilder.js +388 -560
  270. package/examples/jsm/{renderers/nodes → nodes}/core/NodeCode.js +0 -0
  271. package/examples/jsm/nodes/core/NodeFrame.js +30 -23
  272. package/examples/jsm/{renderers/nodes → nodes}/core/NodeFunction.js +0 -0
  273. package/examples/jsm/{renderers/nodes → nodes}/core/NodeFunctionInput.js +0 -0
  274. package/examples/jsm/{renderers/nodes → nodes}/core/NodeKeywords.js +0 -0
  275. package/examples/jsm/{renderers/nodes → nodes}/core/NodeParser.js +0 -0
  276. package/examples/jsm/nodes/core/NodeUniform.js +8 -6
  277. package/examples/jsm/nodes/core/NodeUtils.js +69 -37
  278. package/examples/jsm/{renderers/nodes → nodes}/core/NodeVar.js +2 -2
  279. package/examples/jsm/{renderers/nodes → nodes}/core/NodeVary.js +2 -2
  280. package/examples/jsm/{renderers/nodes → nodes}/core/PropertyNode.js +0 -0
  281. package/examples/jsm/nodes/core/TempNode.js +20 -112
  282. package/examples/jsm/nodes/core/UniformNode.js +46 -0
  283. package/examples/jsm/nodes/core/VarNode.js +58 -27
  284. package/examples/jsm/{renderers/nodes → nodes}/core/VaryNode.js +0 -0
  285. package/examples/jsm/{renderers/nodes → nodes}/core/constants.js +0 -0
  286. package/examples/jsm/{renderers/nodes → nodes}/display/ColorSpaceNode.js +10 -11
  287. package/examples/jsm/nodes/display/FrontFacingNode.js +21 -0
  288. package/examples/jsm/nodes/display/NormalMapNode.js +86 -0
  289. package/examples/jsm/nodes/display/ToneMappingNode.js +51 -0
  290. package/examples/jsm/nodes/fog/FogNode.js +31 -0
  291. package/examples/jsm/nodes/fog/FogRangeNode.js +27 -0
  292. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +33 -0
  293. package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
  294. package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +27 -0
  295. package/examples/jsm/nodes/functions/BSDF/D_GGX.js +18 -0
  296. package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +18 -0
  297. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +18 -0
  298. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +94 -0
  299. package/examples/jsm/nodes/functions/light/getDistanceAttenuation.js +22 -0
  300. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +12 -0
  301. package/examples/jsm/nodes/functions/material/getRoughness.js +18 -0
  302. package/examples/jsm/nodes/gpgpu/ComputeNode.js +63 -0
  303. package/examples/jsm/nodes/lighting/AONode.js +25 -0
  304. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +37 -0
  305. package/examples/jsm/nodes/lighting/EnvironmentNode.js +65 -0
  306. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +50 -0
  307. package/examples/jsm/nodes/lighting/LightingContextNode.js +75 -0
  308. package/examples/jsm/nodes/lighting/LightingNode.js +19 -0
  309. package/examples/jsm/nodes/lighting/LightsNode.js +120 -0
  310. package/examples/jsm/nodes/lighting/PunctualLightNode.js +68 -0
  311. package/examples/jsm/nodes/loaders/NodeLoader.js +107 -0
  312. package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +42 -0
  313. package/examples/jsm/nodes/loaders/NodeObjectLoader.js +70 -0
  314. package/examples/jsm/{renderers/nodes → nodes}/materials/LineBasicNodeMaterial.js +11 -4
  315. package/examples/jsm/nodes/materials/Materials.js +65 -0
  316. package/examples/jsm/{renderers/nodes → nodes}/materials/MeshBasicNodeMaterial.js +13 -4
  317. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +162 -22
  318. package/examples/jsm/nodes/materials/NodeMaterial.js +128 -113
  319. package/examples/jsm/{renderers/nodes → nodes}/materials/PointsNodeMaterial.js +13 -4
  320. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +84 -16
  321. package/examples/jsm/nodes/math/CondNode.js +26 -95
  322. package/examples/jsm/nodes/math/MathNode.js +164 -187
  323. package/examples/jsm/nodes/math/OperatorNode.js +161 -41
  324. package/examples/jsm/{renderers/nodes → nodes}/parsers/GLSLNodeFunction.js +2 -2
  325. package/examples/jsm/{renderers/nodes → nodes}/parsers/GLSLNodeParser.js +0 -0
  326. package/examples/jsm/{renderers/nodes → nodes}/parsers/WGSLNodeFunction.js +20 -5
  327. package/examples/jsm/{renderers/nodes → nodes}/parsers/WGSLNodeParser.js +0 -0
  328. package/examples/jsm/nodes/procedural/CheckerNode.js +16 -57
  329. package/examples/jsm/nodes/shadernode/ShaderNode.js +262 -0
  330. package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +274 -0
  331. package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +106 -0
  332. package/examples/jsm/{renderers/nodes → nodes}/utils/ArrayElementNode.js +3 -3
  333. package/examples/jsm/{renderers/nodes → nodes}/utils/ConvertNode.js +11 -3
  334. package/examples/jsm/nodes/utils/JoinNode.js +17 -89
  335. package/examples/jsm/nodes/utils/MatcapUVNode.js +25 -0
  336. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +32 -0
  337. package/examples/jsm/{renderers/nodes → nodes}/utils/OscNode.js +18 -2
  338. package/examples/jsm/{renderers/nodes → nodes}/utils/SplitNode.js +16 -0
  339. package/examples/jsm/{renderers/nodes → nodes}/utils/SpriteSheetUVNode.js +3 -3
  340. package/examples/jsm/nodes/utils/TimerNode.js +30 -65
  341. package/examples/jsm/objects/Lensflare.js +2 -2
  342. package/examples/jsm/objects/LightningStorm.js +4 -4
  343. package/examples/jsm/objects/MarchingCubes.js +5 -9
  344. package/examples/jsm/objects/Reflector.js +8 -4
  345. package/examples/jsm/objects/ReflectorForSSRPass.js +2 -2
  346. package/examples/jsm/objects/Refractor.js +8 -4
  347. package/examples/jsm/objects/ShadowMesh.js +2 -2
  348. package/examples/jsm/objects/Sky.js +2 -2
  349. package/examples/jsm/objects/Water.js +2 -2
  350. package/examples/jsm/objects/Water2.js +2 -2
  351. package/examples/jsm/offscreen/jank.js +5 -5
  352. package/examples/jsm/offscreen/offscreen.js +1 -1
  353. package/examples/jsm/offscreen/scene.js +11 -11
  354. package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +5 -7
  355. package/examples/jsm/postprocessing/AfterimagePass.js +0 -10
  356. package/examples/jsm/postprocessing/BloomPass.js +48 -20
  357. package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
  358. package/examples/jsm/postprocessing/EffectComposer.js +1 -9
  359. package/examples/jsm/postprocessing/LUTPass.js +2 -2
  360. package/examples/jsm/postprocessing/OutlinePass.js +7 -11
  361. package/examples/jsm/postprocessing/SAOPass.js +2 -9
  362. package/examples/jsm/postprocessing/SSAARenderPass.js +1 -4
  363. package/examples/jsm/postprocessing/SSRPass.js +3 -9
  364. package/examples/jsm/postprocessing/TAARenderPass.js +4 -4
  365. package/examples/jsm/postprocessing/UnrealBloomPass.js +3 -8
  366. package/examples/jsm/renderers/CSS2DRenderer.js +21 -24
  367. package/examples/jsm/renderers/CSS3DRenderer.js +7 -8
  368. package/examples/jsm/renderers/Projector.js +101 -128
  369. package/examples/jsm/renderers/SVGRenderer.js +4 -4
  370. package/examples/jsm/renderers/webgl/nodes/SlotNode.js +1 -1
  371. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +127 -23
  372. package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +14 -3
  373. package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +5 -5
  374. package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +4 -4
  375. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +16 -10
  376. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +8 -7
  377. package/examples/jsm/renderers/webgpu/WebGPUBuffer.js +43 -0
  378. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +14 -7
  379. package/examples/jsm/renderers/webgpu/WebGPUInfo.js +1 -1
  380. package/examples/jsm/renderers/webgpu/WebGPUObjects.js +0 -6
  381. package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +20 -20
  382. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +2 -1
  383. package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +66 -0
  384. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +47 -24
  385. package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +14 -14
  386. package/examples/jsm/renderers/webgpu/WebGPUSampler.js +2 -2
  387. package/examples/jsm/renderers/webgpu/WebGPUStorageBuffer.js +5 -8
  388. package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +23 -20
  389. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +37 -18
  390. package/examples/jsm/renderers/webgpu/WebGPUUniform.js +14 -14
  391. package/examples/jsm/renderers/webgpu/WebGPUUniformBuffer.js +5 -32
  392. package/examples/jsm/renderers/webgpu/WebGPUUniformsGroup.js +2 -2
  393. package/examples/jsm/renderers/webgpu/constants.js +3 -2
  394. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +276 -284
  395. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +20 -2
  396. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +24 -14
  397. package/examples/jsm/shaders/BlendShader.js +2 -1
  398. package/examples/jsm/shaders/CopyShader.js +4 -3
  399. package/examples/jsm/shaders/FXAAShader.js +219 -1051
  400. package/examples/jsm/shaders/FreiChenShader.js +1 -1
  401. package/examples/jsm/shaders/HorizontalBlurShader.js +1 -1
  402. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +1 -1
  403. package/examples/jsm/shaders/SSRShader.js +3 -3
  404. package/examples/jsm/shaders/ToneMapShader.js +1 -1
  405. package/examples/jsm/utils/BufferGeometryUtils.js +292 -22
  406. package/examples/jsm/utils/GPUStatsPanel.js +1 -1
  407. package/examples/jsm/utils/LDrawUtils.js +6 -6
  408. package/examples/jsm/utils/SceneUtils.js +76 -2
  409. package/examples/jsm/utils/SkeletonUtils.js +1 -1
  410. package/examples/jsm/utils/UVsDebug.js +23 -32
  411. package/examples/jsm/webxr/ARButton.js +14 -4
  412. package/examples/jsm/webxr/OculusHandPointerModel.js +3 -3
  413. package/examples/jsm/webxr/Text2D.js +1 -1
  414. package/examples/jsm/webxr/VRButton.js +15 -1
  415. package/examples/jsm/webxr/XRHandMeshModel.js +3 -7
  416. package/examples/jsm/webxr/XRHandModelFactory.js +3 -0
  417. package/package.json +37 -19
  418. package/src/Three.Legacy.js +41 -1912
  419. package/src/Three.js +6 -3
  420. package/src/animation/AnimationClip.js +1 -1
  421. package/src/animation/AnimationMixer.js +5 -3
  422. package/src/animation/AnimationObjectGroup.js +2 -2
  423. package/src/animation/PropertyBinding.js +8 -18
  424. package/src/audio/PositionalAudio.js +8 -0
  425. package/src/cameras/ArrayCamera.js +2 -3
  426. package/src/cameras/Camera.js +2 -2
  427. package/src/cameras/CubeCamera.js +6 -1
  428. package/src/cameras/OrthographicCamera.js +2 -2
  429. package/src/cameras/PerspectiveCamera.js +2 -2
  430. package/src/constants.js +7 -2
  431. package/src/core/BufferAttribute.js +7 -12
  432. package/src/core/BufferGeometry.js +4 -4
  433. package/src/core/GLBufferAttribute.js +2 -2
  434. package/src/core/InstancedBufferAttribute.js +2 -2
  435. package/src/core/InstancedBufferGeometry.js +2 -2
  436. package/src/core/InstancedInterleavedBuffer.js +2 -2
  437. package/src/core/InterleavedBuffer.js +2 -2
  438. package/src/core/InterleavedBufferAttribute.js +5 -11
  439. package/src/core/Object3D.js +6 -3
  440. package/src/core/Raycaster.js +2 -2
  441. package/src/extras/DataUtils.js +127 -40
  442. package/src/extras/Earcut.js +2 -2
  443. package/src/extras/PMREMGenerator.js +132 -104
  444. package/src/extras/core/CurvePath.js +3 -3
  445. package/src/extras/core/ShapePath.js +5 -6
  446. package/src/extras/curves/ArcCurve.js +2 -2
  447. package/src/extras/curves/CatmullRomCurve3.js +2 -2
  448. package/src/extras/curves/CubicBezierCurve.js +2 -2
  449. package/src/extras/curves/CubicBezierCurve3.js +2 -2
  450. package/src/extras/curves/EllipseCurve.js +2 -2
  451. package/src/extras/curves/LineCurve.js +2 -2
  452. package/src/extras/curves/LineCurve3.js +2 -1
  453. package/src/extras/curves/QuadraticBezierCurve.js +2 -2
  454. package/src/extras/curves/QuadraticBezierCurve3.js +2 -2
  455. package/src/extras/curves/SplineCurve.js +2 -2
  456. package/src/geometries/CapsuleGeometry.js +33 -0
  457. package/src/geometries/ExtrudeGeometry.js +2 -0
  458. package/src/geometries/Geometries.js +1 -0
  459. package/src/geometries/TorusKnotGeometry.js +2 -2
  460. package/src/geometries/WireframeGeometry.js +3 -2
  461. package/src/helpers/BoxHelper.js +2 -2
  462. package/src/helpers/PointLightHelper.js +1 -1
  463. package/src/helpers/SkeletonHelper.js +3 -2
  464. package/src/lights/AmbientLight.js +2 -2
  465. package/src/lights/AmbientLightProbe.js +2 -2
  466. package/src/lights/DirectionalLight.js +2 -2
  467. package/src/lights/DirectionalLightShadow.js +2 -2
  468. package/src/lights/HemisphereLight.js +4 -4
  469. package/src/lights/HemisphereLightProbe.js +2 -2
  470. package/src/lights/Light.js +4 -4
  471. package/src/lights/LightProbe.js +2 -2
  472. package/src/lights/PointLight.js +4 -4
  473. package/src/lights/PointLightShadow.js +2 -2
  474. package/src/lights/RectAreaLight.js +2 -2
  475. package/src/lights/SpotLight.js +4 -4
  476. package/src/lights/SpotLightShadow.js +2 -2
  477. package/src/loaders/FileLoader.js +3 -1
  478. package/src/loaders/ImageBitmapLoader.js +2 -2
  479. package/src/loaders/ImageLoader.js +1 -1
  480. package/src/loaders/LoaderUtils.js +1 -1
  481. package/src/loaders/MaterialLoader.js +8 -3
  482. package/src/loaders/ObjectLoader.js +23 -25
  483. package/src/materials/LineBasicMaterial.js +6 -13
  484. package/src/materials/LineDashedMaterial.js +2 -15
  485. package/src/materials/Material.js +48 -14
  486. package/src/materials/Materials.js +66 -18
  487. package/src/materials/MeshBasicMaterial.js +6 -31
  488. package/src/materials/MeshDepthMaterial.js +2 -22
  489. package/src/materials/MeshDistanceMaterial.js +2 -22
  490. package/src/materials/MeshLambertMaterial.js +6 -34
  491. package/src/materials/MeshMatcapMaterial.js +6 -28
  492. package/src/materials/MeshNormalMaterial.js +2 -26
  493. package/src/materials/MeshPhongMaterial.js +6 -48
  494. package/src/materials/MeshPhysicalMaterial.js +32 -35
  495. package/src/materials/MeshStandardMaterial.js +6 -54
  496. package/src/materials/MeshToonMaterial.js +6 -38
  497. package/src/materials/PointsMaterial.js +6 -15
  498. package/src/materials/RawShaderMaterial.js +2 -2
  499. package/src/materials/ShaderMaterial.js +3 -17
  500. package/src/materials/ShadowMaterial.js +6 -8
  501. package/src/materials/SpriteMaterial.js +6 -12
  502. package/src/math/Box2.js +2 -2
  503. package/src/math/Box3.js +5 -5
  504. package/src/math/Color.js +84 -35
  505. package/src/math/ColorManagement.js +74 -0
  506. package/src/math/Euler.js +16 -14
  507. package/src/math/Interpolant.js +4 -9
  508. package/src/math/MathUtils.js +76 -7
  509. package/src/math/Matrix3.js +2 -2
  510. package/src/math/Matrix4.js +2 -3
  511. package/src/math/Plane.js +2 -2
  512. package/src/math/Quaternion.js +11 -2
  513. package/src/math/Spherical.js +1 -1
  514. package/src/math/SphericalHarmonics3.js +2 -2
  515. package/src/math/Vector2.js +2 -2
  516. package/src/math/Vector3.js +12 -3
  517. package/src/math/Vector4.js +2 -2
  518. package/src/math/interpolants/DiscreteInterpolant.js +1 -1
  519. package/src/objects/Bone.js +2 -2
  520. package/src/objects/Group.js +2 -2
  521. package/src/objects/InstancedMesh.js +4 -4
  522. package/src/objects/Line.js +76 -107
  523. package/src/objects/LineLoop.js +2 -2
  524. package/src/objects/LineSegments.js +15 -23
  525. package/src/objects/Mesh.js +82 -104
  526. package/src/objects/Points.js +32 -54
  527. package/src/objects/SkinnedMesh.js +5 -8
  528. package/src/objects/Sprite.js +4 -4
  529. package/src/renderers/WebGL3DRenderTarget.js +22 -0
  530. package/src/renderers/WebGLArrayRenderTarget.js +22 -0
  531. package/src/renderers/WebGLCubeRenderTarget.js +7 -14
  532. package/src/renderers/WebGLMultipleRenderTargets.js +8 -5
  533. package/src/renderers/WebGLRenderTarget.js +16 -18
  534. package/src/renderers/WebGLRenderer.js +108 -63
  535. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +46 -0
  536. package/src/renderers/shaders/ShaderChunk/common.glsl.js +1 -0
  537. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +12 -13
  538. package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +1 -1
  539. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +3 -19
  540. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +107 -0
  541. package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
  542. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -6
  543. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +25 -0
  544. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +0 -6
  545. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +23 -0
  546. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +43 -5
  547. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
  548. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +1 -1
  549. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +7 -7
  550. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +1 -9
  551. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +16 -31
  552. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +1 -1
  553. package/src/renderers/shaders/ShaderChunk.js +6 -0
  554. package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -0
  555. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +1 -0
  556. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +3 -2
  557. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +1 -0
  558. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -0
  559. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +6 -0
  560. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +1 -0
  561. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +10 -0
  562. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +1 -0
  563. package/src/renderers/shaders/ShaderLib/points.glsl.js +1 -0
  564. package/src/renderers/shaders/ShaderLib.js +6 -0
  565. package/src/renderers/shaders/UniformsLib.js +2 -2
  566. package/src/renderers/webgl/WebGLAttributes.js +6 -6
  567. package/src/renderers/webgl/WebGLBackground.js +3 -0
  568. package/src/renderers/webgl/WebGLBindingStates.js +57 -29
  569. package/src/renderers/webgl/WebGLLights.js +0 -1
  570. package/src/renderers/webgl/WebGLMaterials.js +72 -187
  571. package/src/renderers/webgl/WebGLMorphtargets.js +47 -23
  572. package/src/renderers/webgl/WebGLProgram.js +57 -19
  573. package/src/renderers/webgl/WebGLPrograms.js +75 -86
  574. package/src/renderers/webgl/WebGLShaderCache.js +4 -3
  575. package/src/renderers/webgl/WebGLShadowMap.js +6 -8
  576. package/src/renderers/webgl/WebGLTextures.js +567 -380
  577. package/src/renderers/webgl/WebGLUniforms.js +79 -80
  578. package/src/renderers/webgl/WebGLUtils.js +12 -1
  579. package/src/renderers/webxr/WebXRManager.js +60 -45
  580. package/src/scenes/Fog.js +2 -2
  581. package/src/scenes/FogExp2.js +2 -2
  582. package/src/scenes/Scene.js +2 -2
  583. package/src/textures/CanvasTexture.js +2 -2
  584. package/src/textures/CompressedTexture.js +2 -2
  585. package/src/textures/CubeTexture.js +2 -2
  586. package/src/textures/{DataTexture3D.js → Data3DTexture.js} +4 -4
  587. package/src/textures/{DataTexture2DArray.js → DataArrayTexture.js} +4 -4
  588. package/src/textures/DataTexture.js +2 -5
  589. package/src/textures/DepthTexture.js +5 -5
  590. package/src/textures/FramebufferTexture.js +2 -2
  591. package/src/textures/Source.js +123 -0
  592. package/src/textures/Texture.js +27 -97
  593. package/src/textures/VideoTexture.js +2 -2
  594. package/examples/js/csm/Frustum.js +0 -133
  595. package/examples/js/deprecated/Geometry.js +0 -1656
  596. package/examples/js/loaders/VRMLoader.js +0 -72
  597. package/examples/js/objects/ReflectorRTT.js +0 -16
  598. package/examples/js/postprocessing/SSRrPass.js +0 -494
  599. package/examples/js/shaders/SSRrShader.js +0 -336
  600. package/examples/jsm/deprecated/Geometry.js +0 -1869
  601. package/examples/jsm/libs/opentype.module.min.js +0 -119
  602. package/examples/jsm/loaders/NodeMaterialLoader.js +0 -263
  603. package/examples/jsm/loaders/VRMLoader.js +0 -78
  604. package/examples/jsm/nodes/accessors/ColorsNode.js +0 -56
  605. package/examples/jsm/nodes/accessors/LightNode.js +0 -60
  606. package/examples/jsm/nodes/accessors/ResolutionNode.js +0 -64
  607. package/examples/jsm/nodes/accessors/ScreenUVNode.js +0 -64
  608. package/examples/jsm/nodes/core/NodeLib.js +0 -64
  609. package/examples/jsm/nodes/core/StructNode.js +0 -106
  610. package/examples/jsm/nodes/effects/BlurNode.js +0 -171
  611. package/examples/jsm/nodes/effects/ColorAdjustmentNode.js +0 -140
  612. package/examples/jsm/nodes/effects/LuminanceNode.js +0 -75
  613. package/examples/jsm/nodes/inputs/BoolNode.js +0 -51
  614. package/examples/jsm/nodes/inputs/ColorNode.js +0 -58
  615. package/examples/jsm/nodes/inputs/CubeTextureNode.js +0 -108
  616. package/examples/jsm/nodes/inputs/FloatNode.js +0 -51
  617. package/examples/jsm/nodes/inputs/IntNode.js +0 -51
  618. package/examples/jsm/nodes/inputs/Matrix3Node.js +0 -63
  619. package/examples/jsm/nodes/inputs/Matrix4Node.js +0 -63
  620. package/examples/jsm/nodes/inputs/PropertyNode.js +0 -47
  621. package/examples/jsm/nodes/inputs/RTTNode.js +0 -157
  622. package/examples/jsm/nodes/inputs/ReflectorNode.js +0 -90
  623. package/examples/jsm/nodes/inputs/ScreenNode.js +0 -28
  624. package/examples/jsm/nodes/inputs/TextureNode.js +0 -116
  625. package/examples/jsm/nodes/inputs/Vector2Node.js +0 -57
  626. package/examples/jsm/nodes/inputs/Vector3Node.js +0 -58
  627. package/examples/jsm/nodes/inputs/Vector4Node.js +0 -59
  628. package/examples/jsm/nodes/materials/BasicNodeMaterial.js +0 -26
  629. package/examples/jsm/nodes/materials/PhongNodeMaterial.js +0 -36
  630. package/examples/jsm/nodes/materials/StandardNodeMaterial.js +0 -40
  631. package/examples/jsm/nodes/materials/nodes/BasicNode.js +0 -154
  632. package/examples/jsm/nodes/materials/nodes/MeshStandardNode.js +0 -116
  633. package/examples/jsm/nodes/materials/nodes/PhongNode.js +0 -409
  634. package/examples/jsm/nodes/materials/nodes/RawNode.js +0 -62
  635. package/examples/jsm/nodes/materials/nodes/SpriteNode.js +0 -236
  636. package/examples/jsm/nodes/materials/nodes/StandardNode.js +0 -609
  637. package/examples/jsm/nodes/misc/BumpMapNode.js +0 -163
  638. package/examples/jsm/nodes/misc/NormalMapNode.js +0 -138
  639. package/examples/jsm/nodes/misc/TextureCubeNode.js +0 -86
  640. package/examples/jsm/nodes/misc/TextureCubeUVNode.js +0 -280
  641. package/examples/jsm/nodes/postprocessing/NodePass.js +0 -93
  642. package/examples/jsm/nodes/postprocessing/NodePostProcessing.js +0 -148
  643. package/examples/jsm/nodes/procedural/Fractal3DNode.js +0 -104
  644. package/examples/jsm/nodes/procedural/Noise2DNode.js +0 -149
  645. package/examples/jsm/nodes/procedural/Noise3DNode.js +0 -141
  646. package/examples/jsm/nodes/utils/BypassNode.js +0 -85
  647. package/examples/jsm/nodes/utils/ColorSpaceNode.js +0 -145
  648. package/examples/jsm/nodes/utils/MaxMIPLevelNode.js +0 -56
  649. package/examples/jsm/nodes/utils/RemapNode.js +0 -155
  650. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -101
  651. package/examples/jsm/nodes/utils/SubSlotNode.js +0 -77
  652. package/examples/jsm/nodes/utils/SwitchNode.js +0 -103
  653. package/examples/jsm/nodes/utils/UVTransformNode.js +0 -66
  654. package/examples/jsm/nodes/utils/VelocityNode.js +0 -170
  655. package/examples/jsm/objects/ReflectorRTT.js +0 -15
  656. package/examples/jsm/postprocessing/SSRrPass.js +0 -579
  657. package/examples/jsm/renderers/nodes/Nodes.js +0 -166
  658. package/examples/jsm/renderers/nodes/ShaderNode.js +0 -373
  659. package/examples/jsm/renderers/nodes/accessors/CameraNode.js +0 -68
  660. package/examples/jsm/renderers/nodes/accessors/NormalNode.js +0 -63
  661. package/examples/jsm/renderers/nodes/accessors/PositionNode.js +0 -67
  662. package/examples/jsm/renderers/nodes/accessors/ReferenceNode.js +0 -91
  663. package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +0 -107
  664. package/examples/jsm/renderers/nodes/accessors/UVNode.js +0 -25
  665. package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +0 -23
  666. package/examples/jsm/renderers/nodes/core/AttributeNode.js +0 -54
  667. package/examples/jsm/renderers/nodes/core/ExpressionNode.js +0 -32
  668. package/examples/jsm/renderers/nodes/core/FunctionCallNode.js +0 -67
  669. package/examples/jsm/renderers/nodes/core/FunctionNode.js +0 -87
  670. package/examples/jsm/renderers/nodes/core/InputNode.js +0 -66
  671. package/examples/jsm/renderers/nodes/core/Node.js +0 -104
  672. package/examples/jsm/renderers/nodes/core/NodeBuilder.js +0 -634
  673. package/examples/jsm/renderers/nodes/core/NodeFrame.js +0 -59
  674. package/examples/jsm/renderers/nodes/core/NodeUniform.js +0 -28
  675. package/examples/jsm/renderers/nodes/core/TempNode.js +0 -43
  676. package/examples/jsm/renderers/nodes/core/VarNode.js +0 -51
  677. package/examples/jsm/renderers/nodes/display/NormalMapNode.js +0 -87
  678. package/examples/jsm/renderers/nodes/functions/BSDFs.js +0 -122
  679. package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +0 -27
  680. package/examples/jsm/renderers/nodes/inputs/BufferNode.js +0 -25
  681. package/examples/jsm/renderers/nodes/inputs/ColorNode.js +0 -18
  682. package/examples/jsm/renderers/nodes/inputs/FloatNode.js +0 -17
  683. package/examples/jsm/renderers/nodes/inputs/IntNode.js +0 -17
  684. package/examples/jsm/renderers/nodes/inputs/Matrix3Node.js +0 -18
  685. package/examples/jsm/renderers/nodes/inputs/Matrix4Node.js +0 -18
  686. package/examples/jsm/renderers/nodes/inputs/TextureNode.js +0 -74
  687. package/examples/jsm/renderers/nodes/inputs/Vector2Node.js +0 -18
  688. package/examples/jsm/renderers/nodes/inputs/Vector3Node.js +0 -18
  689. package/examples/jsm/renderers/nodes/inputs/Vector4Node.js +0 -18
  690. package/examples/jsm/renderers/nodes/lights/LightContextNode.js +0 -59
  691. package/examples/jsm/renderers/nodes/lights/LightNode.js +0 -79
  692. package/examples/jsm/renderers/nodes/lights/LightsNode.js +0 -44
  693. package/examples/jsm/renderers/nodes/materials/Materials.js +0 -11
  694. package/examples/jsm/renderers/nodes/materials/MeshStandardNodeMaterial.js +0 -63
  695. package/examples/jsm/renderers/nodes/math/CondNode.js +0 -60
  696. package/examples/jsm/renderers/nodes/math/MathNode.js +0 -242
  697. package/examples/jsm/renderers/nodes/math/OperatorNode.js +0 -174
  698. package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +0 -36
  699. package/examples/jsm/renderers/nodes/utils/JoinNode.js +0 -42
  700. package/examples/jsm/renderers/nodes/utils/TimerNode.js +0 -47
  701. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +0 -20
  702. package/examples/jsm/shaders/SSRrShader.js +0 -307
  703. package/src/renderers/WebGLMultisampleRenderTarget.js +0 -33
@@ -7,6 +7,7 @@ import {
7
7
  * https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf
8
8
  * - WebGL port by @supereggbert
9
9
  * http://www.glge.org/demos/fxaa/
10
+ * Further improved by Daniel Sturk
10
11
  */
11
12
 
12
13
  const FXAAShader = {
@@ -29,34 +30,41 @@ const FXAAShader = {
29
30
 
30
31
  }`,
31
32
 
32
- fragmentShader:
33
+ fragmentShader: `
34
+ precision highp float;
35
+
36
+ uniform sampler2D tDiffuse;
37
+
38
+ uniform vec2 resolution;
39
+
40
+ varying vec2 vUv;
33
41
 
34
42
  // FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)
35
43
 
36
44
  //----------------------------------------------------------------------------------
37
- // File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag
45
+ // File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag
38
46
  // SDK Version: v3.00
39
- // Email: gameworks@nvidia.com
40
- // Site: http://developer.nvidia.com/
47
+ // Email: gameworks@nvidia.com
48
+ // Site: http://developer.nvidia.com/
41
49
  //
42
50
  // Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
43
51
  //
44
52
  // Redistribution and use in source and binary forms, with or without
45
53
  // modification, are permitted provided that the following conditions
46
54
  // are met:
47
- // * Redistributions of source code must retain the above copyright
48
- // notice, this list of conditions and the following disclaimer.
49
- // * Redistributions in binary form must reproduce the above copyright
50
- // notice, this list of conditions and the following disclaimer in the
51
- // documentation and/or other materials provided with the distribution.
52
- // * Neither the name of NVIDIA CORPORATION nor the names of its
53
- // contributors may be used to endorse or promote products derived
54
- // from this software without specific prior written permission.
55
+ // * Redistributions of source code must retain the above copyright
56
+ // notice, this list of conditions and the following disclaimer.
57
+ // * Redistributions in binary form must reproduce the above copyright
58
+ // notice, this list of conditions and the following disclaimer in the
59
+ // documentation and/or other materials provided with the distribution.
60
+ // * Neither the name of NVIDIA CORPORATION nor the names of its
61
+ // contributors may be used to endorse or promote products derived
62
+ // from this software without specific prior written permission.
55
63
  //
56
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS\'\' AND ANY
64
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
57
65
  // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58
66
  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
- // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
67
+ // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
60
68
  // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
61
69
  // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
62
70
  // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -67,1051 +75,211 @@ const FXAAShader = {
67
75
  //
68
76
  //----------------------------------------------------------------------------------
69
77
 
70
- /* glsl */`
71
-
72
- precision highp float;
73
-
74
- uniform sampler2D tDiffuse;
75
-
76
- uniform vec2 resolution;
77
-
78
- varying vec2 vUv;
79
-
80
- #define FXAA_PC 1
81
- #define FXAA_GLSL_100 1
82
- #define FXAA_QUALITY_PRESET 12
83
-
84
- #define FXAA_GREEN_AS_LUMA 1
85
-
86
- /*--------------------------------------------------------------------------*/
87
- #ifndef FXAA_PC_CONSOLE
88
- //
89
- // The console algorithm for PC is included
90
- // for developers targeting really low spec machines.
91
- // Likely better to just run FXAA_PC, and use a really low preset.
92
- //
93
- #define FXAA_PC_CONSOLE 0
94
- #endif
95
- /*--------------------------------------------------------------------------*/
96
- #ifndef FXAA_GLSL_120
97
- #define FXAA_GLSL_120 0
98
- #endif
99
- /*--------------------------------------------------------------------------*/
100
- #ifndef FXAA_GLSL_130
101
- #define FXAA_GLSL_130 0
102
- #endif
103
- /*--------------------------------------------------------------------------*/
104
- #ifndef FXAA_HLSL_3
105
- #define FXAA_HLSL_3 0
106
- #endif
107
- /*--------------------------------------------------------------------------*/
108
- #ifndef FXAA_HLSL_4
109
- #define FXAA_HLSL_4 0
110
- #endif
111
- /*--------------------------------------------------------------------------*/
112
- #ifndef FXAA_HLSL_5
113
- #define FXAA_HLSL_5 0
114
- #endif
115
- /*==========================================================================*/
116
- #ifndef FXAA_GREEN_AS_LUMA
117
- //
118
- // For those using non-linear color,
119
- // and either not able to get luma in alpha, or not wanting to,
120
- // this enables FXAA to run using green as a proxy for luma.
121
- // So with this enabled, no need to pack luma in alpha.
122
- //
123
- // This will turn off AA on anything which lacks some amount of green.
124
- // Pure red and blue or combination of only R and B, will get no AA.
125
- //
126
- // Might want to lower the settings for both,
127
- // fxaaConsoleEdgeThresholdMin
128
- // fxaaQualityEdgeThresholdMin
129
- // In order to insure AA does not get turned off on colors
130
- // which contain a minor amount of green.
131
- //
132
- // 1 = On.
133
- // 0 = Off.
134
- //
135
- #define FXAA_GREEN_AS_LUMA 0
136
- #endif
137
- /*--------------------------------------------------------------------------*/
138
- #ifndef FXAA_EARLY_EXIT
139
- //
140
- // Controls algorithm\'s early exit path.
141
- // On PS3 turning this ON adds 2 cycles to the shader.
142
- // On 360 turning this OFF adds 10ths of a millisecond to the shader.
143
- // Turning this off on console will result in a more blurry image.
144
- // So this defaults to on.
145
- //
146
- // 1 = On.
147
- // 0 = Off.
148
- //
149
- #define FXAA_EARLY_EXIT 1
150
- #endif
151
- /*--------------------------------------------------------------------------*/
152
- #ifndef FXAA_DISCARD
153
- //
154
- // Only valid for PC OpenGL currently.
155
- // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
156
- //
157
- // 1 = Use discard on pixels which don\'t need AA.
158
- // For APIs which enable concurrent TEX+ROP from same surface.
159
- // 0 = Return unchanged color on pixels which don\'t need AA.
160
- //
161
- #define FXAA_DISCARD 0
162
- #endif
163
- /*--------------------------------------------------------------------------*/
164
- #ifndef FXAA_FAST_PIXEL_OFFSET
165
- //
166
- // Used for GLSL 120 only.
167
- //
168
- // 1 = GL API supports fast pixel offsets
169
- // 0 = do not use fast pixel offsets
170
- //
171
- #ifdef GL_EXT_gpu_shader4
172
- #define FXAA_FAST_PIXEL_OFFSET 1
173
- #endif
174
- #ifdef GL_NV_gpu_shader5
175
- #define FXAA_FAST_PIXEL_OFFSET 1
176
- #endif
177
- #ifdef GL_ARB_gpu_shader5
178
- #define FXAA_FAST_PIXEL_OFFSET 1
179
- #endif
180
- #ifndef FXAA_FAST_PIXEL_OFFSET
181
- #define FXAA_FAST_PIXEL_OFFSET 0
182
- #endif
183
- #endif
184
- /*--------------------------------------------------------------------------*/
185
- #ifndef FXAA_GATHER4_ALPHA
186
- //
187
- // 1 = API supports gather4 on alpha channel.
188
- // 0 = API does not support gather4 on alpha channel.
189
- //
190
- #if (FXAA_HLSL_5 == 1)
191
- #define FXAA_GATHER4_ALPHA 1
192
- #endif
193
- #ifdef GL_ARB_gpu_shader5
194
- #define FXAA_GATHER4_ALPHA 1
195
- #endif
196
- #ifdef GL_NV_gpu_shader5
197
- #define FXAA_GATHER4_ALPHA 1
198
- #endif
199
- #ifndef FXAA_GATHER4_ALPHA
200
- #define FXAA_GATHER4_ALPHA 0
201
- #endif
202
- #endif
203
-
204
-
205
- /*============================================================================
206
- FXAA QUALITY - TUNING KNOBS
207
- ------------------------------------------------------------------------------
208
- NOTE the other tuning knobs are now in the shader function inputs!
209
- ============================================================================*/
210
- #ifndef FXAA_QUALITY_PRESET
211
- //
212
- // Choose the quality preset.
213
- // This needs to be compiled into the shader as it effects code.
214
- // Best option to include multiple presets is to
215
- // in each shader define the preset, then include this file.
216
- //
217
- // OPTIONS
218
- // -----------------------------------------------------------------------
219
- // 10 to 15 - default medium dither (10=fastest, 15=highest quality)
220
- // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
221
- // 39 - no dither, very expensive
222
- //
223
- // NOTES
224
- // -----------------------------------------------------------------------
225
- // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
226
- // 13 = about same speed as FXAA 3.9 and better than 12
227
- // 23 = closest to FXAA 3.9 visually and performance wise
228
- // _ = the lowest digit is directly related to performance
229
- // _ = the highest digit is directly related to style
230
- //
231
- #define FXAA_QUALITY_PRESET 12
232
- #endif
233
-
234
-
235
- /*============================================================================
236
-
237
- FXAA QUALITY - PRESETS
238
-
239
- ============================================================================*/
240
-
241
- /*============================================================================
242
- FXAA QUALITY - MEDIUM DITHER PRESETS
243
- ============================================================================*/
244
- #if (FXAA_QUALITY_PRESET == 10)
245
- #define FXAA_QUALITY_PS 3
246
- #define FXAA_QUALITY_P0 1.5
247
- #define FXAA_QUALITY_P1 3.0
248
- #define FXAA_QUALITY_P2 12.0
249
- #endif
250
- /*--------------------------------------------------------------------------*/
251
- #if (FXAA_QUALITY_PRESET == 11)
252
- #define FXAA_QUALITY_PS 4
253
- #define FXAA_QUALITY_P0 1.0
254
- #define FXAA_QUALITY_P1 1.5
255
- #define FXAA_QUALITY_P2 3.0
256
- #define FXAA_QUALITY_P3 12.0
257
- #endif
258
- /*--------------------------------------------------------------------------*/
259
- #if (FXAA_QUALITY_PRESET == 12)
260
- #define FXAA_QUALITY_PS 5
261
- #define FXAA_QUALITY_P0 1.0
262
- #define FXAA_QUALITY_P1 1.5
263
- #define FXAA_QUALITY_P2 2.0
264
- #define FXAA_QUALITY_P3 4.0
265
- #define FXAA_QUALITY_P4 12.0
266
- #endif
267
- /*--------------------------------------------------------------------------*/
268
- #if (FXAA_QUALITY_PRESET == 13)
269
- #define FXAA_QUALITY_PS 6
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 4.0
275
- #define FXAA_QUALITY_P5 12.0
276
- #endif
277
- /*--------------------------------------------------------------------------*/
278
- #if (FXAA_QUALITY_PRESET == 14)
279
- #define FXAA_QUALITY_PS 7
280
- #define FXAA_QUALITY_P0 1.0
281
- #define FXAA_QUALITY_P1 1.5
282
- #define FXAA_QUALITY_P2 2.0
283
- #define FXAA_QUALITY_P3 2.0
284
- #define FXAA_QUALITY_P4 2.0
285
- #define FXAA_QUALITY_P5 4.0
286
- #define FXAA_QUALITY_P6 12.0
287
- #endif
288
- /*--------------------------------------------------------------------------*/
289
- #if (FXAA_QUALITY_PRESET == 15)
290
- #define FXAA_QUALITY_PS 8
291
- #define FXAA_QUALITY_P0 1.0
292
- #define FXAA_QUALITY_P1 1.5
293
- #define FXAA_QUALITY_P2 2.0
294
- #define FXAA_QUALITY_P3 2.0
295
- #define FXAA_QUALITY_P4 2.0
296
- #define FXAA_QUALITY_P5 2.0
297
- #define FXAA_QUALITY_P6 4.0
298
- #define FXAA_QUALITY_P7 12.0
299
- #endif
300
-
301
- /*============================================================================
302
- FXAA QUALITY - LOW DITHER PRESETS
303
- ============================================================================*/
304
- #if (FXAA_QUALITY_PRESET == 20)
305
- #define FXAA_QUALITY_PS 3
306
- #define FXAA_QUALITY_P0 1.5
307
- #define FXAA_QUALITY_P1 2.0
308
- #define FXAA_QUALITY_P2 8.0
309
- #endif
310
- /*--------------------------------------------------------------------------*/
311
- #if (FXAA_QUALITY_PRESET == 21)
312
- #define FXAA_QUALITY_PS 4
313
- #define FXAA_QUALITY_P0 1.0
314
- #define FXAA_QUALITY_P1 1.5
315
- #define FXAA_QUALITY_P2 2.0
316
- #define FXAA_QUALITY_P3 8.0
317
- #endif
318
- /*--------------------------------------------------------------------------*/
319
- #if (FXAA_QUALITY_PRESET == 22)
320
- #define FXAA_QUALITY_PS 5
321
- #define FXAA_QUALITY_P0 1.0
322
- #define FXAA_QUALITY_P1 1.5
323
- #define FXAA_QUALITY_P2 2.0
324
- #define FXAA_QUALITY_P3 2.0
325
- #define FXAA_QUALITY_P4 8.0
326
- #endif
327
- /*--------------------------------------------------------------------------*/
328
- #if (FXAA_QUALITY_PRESET == 23)
329
- #define FXAA_QUALITY_PS 6
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 8.0
336
- #endif
337
- /*--------------------------------------------------------------------------*/
338
- #if (FXAA_QUALITY_PRESET == 24)
339
- #define FXAA_QUALITY_PS 7
340
- #define FXAA_QUALITY_P0 1.0
341
- #define FXAA_QUALITY_P1 1.5
342
- #define FXAA_QUALITY_P2 2.0
343
- #define FXAA_QUALITY_P3 2.0
344
- #define FXAA_QUALITY_P4 2.0
345
- #define FXAA_QUALITY_P5 3.0
346
- #define FXAA_QUALITY_P6 8.0
347
- #endif
348
- /*--------------------------------------------------------------------------*/
349
- #if (FXAA_QUALITY_PRESET == 25)
350
- #define FXAA_QUALITY_PS 8
351
- #define FXAA_QUALITY_P0 1.0
352
- #define FXAA_QUALITY_P1 1.5
353
- #define FXAA_QUALITY_P2 2.0
354
- #define FXAA_QUALITY_P3 2.0
355
- #define FXAA_QUALITY_P4 2.0
356
- #define FXAA_QUALITY_P5 2.0
357
- #define FXAA_QUALITY_P6 4.0
358
- #define FXAA_QUALITY_P7 8.0
359
- #endif
360
- /*--------------------------------------------------------------------------*/
361
- #if (FXAA_QUALITY_PRESET == 26)
362
- #define FXAA_QUALITY_PS 9
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 4.0
371
- #define FXAA_QUALITY_P8 8.0
372
- #endif
373
- /*--------------------------------------------------------------------------*/
374
- #if (FXAA_QUALITY_PRESET == 27)
375
- #define FXAA_QUALITY_PS 10
376
- #define FXAA_QUALITY_P0 1.0
377
- #define FXAA_QUALITY_P1 1.5
378
- #define FXAA_QUALITY_P2 2.0
379
- #define FXAA_QUALITY_P3 2.0
380
- #define FXAA_QUALITY_P4 2.0
381
- #define FXAA_QUALITY_P5 2.0
382
- #define FXAA_QUALITY_P6 2.0
383
- #define FXAA_QUALITY_P7 2.0
384
- #define FXAA_QUALITY_P8 4.0
385
- #define FXAA_QUALITY_P9 8.0
386
- #endif
387
- /*--------------------------------------------------------------------------*/
388
- #if (FXAA_QUALITY_PRESET == 28)
389
- #define FXAA_QUALITY_PS 11
390
- #define FXAA_QUALITY_P0 1.0
391
- #define FXAA_QUALITY_P1 1.5
392
- #define FXAA_QUALITY_P2 2.0
393
- #define FXAA_QUALITY_P3 2.0
394
- #define FXAA_QUALITY_P4 2.0
395
- #define FXAA_QUALITY_P5 2.0
396
- #define FXAA_QUALITY_P6 2.0
397
- #define FXAA_QUALITY_P7 2.0
398
- #define FXAA_QUALITY_P8 2.0
399
- #define FXAA_QUALITY_P9 4.0
400
- #define FXAA_QUALITY_P10 8.0
401
- #endif
402
- /*--------------------------------------------------------------------------*/
403
- #if (FXAA_QUALITY_PRESET == 29)
404
- #define FXAA_QUALITY_PS 12
405
- #define FXAA_QUALITY_P0 1.0
406
- #define FXAA_QUALITY_P1 1.5
407
- #define FXAA_QUALITY_P2 2.0
408
- #define FXAA_QUALITY_P3 2.0
409
- #define FXAA_QUALITY_P4 2.0
410
- #define FXAA_QUALITY_P5 2.0
411
- #define FXAA_QUALITY_P6 2.0
412
- #define FXAA_QUALITY_P7 2.0
413
- #define FXAA_QUALITY_P8 2.0
414
- #define FXAA_QUALITY_P9 2.0
415
- #define FXAA_QUALITY_P10 4.0
416
- #define FXAA_QUALITY_P11 8.0
417
- #endif
418
-
419
- /*============================================================================
420
- FXAA QUALITY - EXTREME QUALITY
421
- ============================================================================*/
422
- #if (FXAA_QUALITY_PRESET == 39)
423
- #define FXAA_QUALITY_PS 12
424
- #define FXAA_QUALITY_P0 1.0
425
- #define FXAA_QUALITY_P1 1.0
426
- #define FXAA_QUALITY_P2 1.0
427
- #define FXAA_QUALITY_P3 1.0
428
- #define FXAA_QUALITY_P4 1.0
429
- #define FXAA_QUALITY_P5 1.5
430
- #define FXAA_QUALITY_P6 2.0
431
- #define FXAA_QUALITY_P7 2.0
432
- #define FXAA_QUALITY_P8 2.0
433
- #define FXAA_QUALITY_P9 2.0
434
- #define FXAA_QUALITY_P10 4.0
435
- #define FXAA_QUALITY_P11 8.0
436
- #endif
437
-
438
-
439
-
440
- /*============================================================================
441
-
442
- API PORTING
443
-
444
- ============================================================================*/
445
- #if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)
446
- #define FxaaBool bool
447
- #define FxaaDiscard discard
448
- #define FxaaFloat float
449
- #define FxaaFloat2 vec2
450
- #define FxaaFloat3 vec3
451
- #define FxaaFloat4 vec4
452
- #define FxaaHalf float
453
- #define FxaaHalf2 vec2
454
- #define FxaaHalf3 vec3
455
- #define FxaaHalf4 vec4
456
- #define FxaaInt2 ivec2
457
- #define FxaaSat(x) clamp(x, 0.0, 1.0)
458
- #define FxaaTex sampler2D
459
- #else
460
- #define FxaaBool bool
461
- #define FxaaDiscard clip(-1)
462
- #define FxaaFloat float
463
- #define FxaaFloat2 float2
464
- #define FxaaFloat3 float3
465
- #define FxaaFloat4 float4
466
- #define FxaaHalf half
467
- #define FxaaHalf2 half2
468
- #define FxaaHalf3 half3
469
- #define FxaaHalf4 half4
470
- #define FxaaSat(x) saturate(x)
471
- #endif
472
- /*--------------------------------------------------------------------------*/
473
- #if (FXAA_GLSL_100 == 1)
474
- #define FxaaTexTop(t, p) texture2D(t, p, 0.0)
475
- #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)
476
- #endif
477
- /*--------------------------------------------------------------------------*/
478
- #if (FXAA_GLSL_120 == 1)
479
- // Requires,
480
- // #version 120
481
- // And at least,
482
- // #extension GL_EXT_gpu_shader4 : enable
483
- // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
484
- #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
485
- #if (FXAA_FAST_PIXEL_OFFSET == 1)
486
- #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
487
- #else
488
- #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
489
- #endif
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_GLSL_130 == 1)
500
- // Requires "#version 130" or better
501
- #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
502
- #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
503
- #if (FXAA_GATHER4_ALPHA == 1)
504
- // use #extension GL_ARB_gpu_shader5 : enable
505
- #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
506
- #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
507
- #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
508
- #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
509
- #endif
510
- #endif
511
- /*--------------------------------------------------------------------------*/
512
- #if (FXAA_HLSL_3 == 1)
513
- #define FxaaInt2 float2
514
- #define FxaaTex sampler2D
515
- #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
516
- #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
517
- #endif
518
- /*--------------------------------------------------------------------------*/
519
- #if (FXAA_HLSL_4 == 1)
520
- #define FxaaInt2 int2
521
- struct FxaaTex { SamplerState smpl; Texture2D tex; };
522
- #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
523
- #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
524
- #endif
525
- /*--------------------------------------------------------------------------*/
526
- #if (FXAA_HLSL_5 == 1)
527
- #define FxaaInt2 int2
528
- struct FxaaTex { SamplerState smpl; Texture2D tex; };
529
- #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
530
- #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
531
- #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)
532
- #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)
533
- #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)
534
- #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)
535
- #endif
536
-
537
-
538
- /*============================================================================
539
- GREEN AS LUMA OPTION SUPPORT FUNCTION
540
- ============================================================================*/
541
- #if (FXAA_GREEN_AS_LUMA == 0)
542
- FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }
543
- #else
544
- FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
545
- #endif
546
-
547
-
78
+ #ifndef FXAA_DISCARD
79
+ //
80
+ // Only valid for PC OpenGL currently.
81
+ // Probably will not work when FXAA_GREEN_AS_LUMA = 1.
82
+ //
83
+ // 1 = Use discard on pixels which don't need AA.
84
+ // For APIs which enable concurrent TEX+ROP from same surface.
85
+ // 0 = Return unchanged color on pixels which don't need AA.
86
+ //
87
+ #define FXAA_DISCARD 0
88
+ #endif
89
+
90
+ /*--------------------------------------------------------------------------*/
91
+ #define FxaaTexTop(t, p) texture2D(t, p, -100.0)
92
+ #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)
93
+ /*--------------------------------------------------------------------------*/
94
+
95
+ #define NUM_SAMPLES 5
96
+
97
+ // assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
98
+ float contrast( vec4 a, vec4 b ) {
99
+ vec4 diff = abs( a - b );
100
+ return max( max( max( diff.r, diff.g ), diff.b ), diff.a );
101
+ }
102
+
103
+ /*============================================================================
104
+
105
+ FXAA3 QUALITY - PC
106
+
107
+ ============================================================================*/
108
+
109
+ /*--------------------------------------------------------------------------*/
110
+ vec4 FxaaPixelShader(
111
+ vec2 posM,
112
+ sampler2D tex,
113
+ vec2 fxaaQualityRcpFrame,
114
+ float fxaaQualityEdgeThreshold,
115
+ float fxaaQualityinvEdgeThreshold
116
+ ) {
117
+ vec4 rgbaM = FxaaTexTop(tex, posM);
118
+ vec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);
119
+ vec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);
120
+ vec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);
121
+ vec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);
122
+ // . S .
123
+ // W M E
124
+ // . N .
125
+
126
+ bool earlyExit = max( max( max(
127
+ contrast( rgbaM, rgbaN ),
128
+ contrast( rgbaM, rgbaS ) ),
129
+ contrast( rgbaM, rgbaE ) ),
130
+ contrast( rgbaM, rgbaW ) )
131
+ < fxaaQualityEdgeThreshold;
132
+ // . 0 .
133
+ // 0 0 0
134
+ // . 0 .
135
+
136
+ #if (FXAA_DISCARD == 1)
137
+ if(earlyExit) FxaaDiscard;
138
+ #else
139
+ if(earlyExit) return rgbaM;
140
+ #endif
141
+
142
+ float contrastN = contrast( rgbaM, rgbaN );
143
+ float contrastS = contrast( rgbaM, rgbaS );
144
+ float contrastE = contrast( rgbaM, rgbaE );
145
+ float contrastW = contrast( rgbaM, rgbaW );
146
+
147
+ float relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );
148
+ relativeVContrast *= fxaaQualityinvEdgeThreshold;
149
+
150
+ bool horzSpan = relativeVContrast > 0.;
151
+ // . 1 .
152
+ // 0 0 0
153
+ // . 1 .
154
+
155
+ // 45 deg edge detection and corners of objects, aka V/H contrast is too similar
156
+ if( abs( relativeVContrast ) < .3 ) {
157
+ // locate the edge
158
+ vec2 dirToEdge;
159
+ dirToEdge.x = contrastE > contrastW ? 1. : -1.;
160
+ dirToEdge.y = contrastS > contrastN ? 1. : -1.;
161
+ // . 2 . . 1 .
162
+ // 1 0 2 ~= 0 0 1
163
+ // . 1 . . 0 .
164
+
165
+ // tap 2 pixels and see which ones are "outside" the edge, to
166
+ // determine if the edge is vertical or horizontal
167
+
168
+ vec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);
169
+ float matchAlongH = contrast( rgbaM, rgbaAlongH );
170
+ // . 1 .
171
+ // 0 0 1
172
+ // . 0 H
173
+
174
+ vec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);
175
+ float matchAlongV = contrast( rgbaM, rgbaAlongV );
176
+ // V 1 .
177
+ // 0 0 1
178
+ // . 0 .
179
+
180
+ relativeVContrast = matchAlongV - matchAlongH;
181
+ relativeVContrast *= fxaaQualityinvEdgeThreshold;
182
+
183
+ if( abs( relativeVContrast ) < .3 ) { // 45 deg edge
184
+ // 1 1 .
185
+ // 0 0 1
186
+ // . 0 1
187
+
188
+ // do a simple blur
189
+ return mix(
190
+ rgbaM,
191
+ (rgbaN + rgbaS + rgbaE + rgbaW) * .25,
192
+ .4
193
+ );
194
+ }
195
+
196
+ horzSpan = relativeVContrast > 0.;
197
+ }
198
+
199
+ if(!horzSpan) rgbaN = rgbaW;
200
+ if(!horzSpan) rgbaS = rgbaE;
201
+ // . 0 . 1
202
+ // 1 0 1 -> 0
203
+ // . 0 . 1
204
+
205
+ bool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );
206
+ if(!pairN) rgbaN = rgbaS;
207
+
208
+ vec2 offNP;
209
+ offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
210
+ offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
211
+
212
+ bool doneN = false;
213
+ bool doneP = false;
214
+
215
+ float nDist = 0.;
216
+ float pDist = 0.;
217
+
218
+ vec2 posN = posM;
219
+ vec2 posP = posM;
220
+
221
+ int iterationsUsed = 0;
222
+ int iterationsUsedN = 0;
223
+ int iterationsUsedP = 0;
224
+ for( int i = 0; i < NUM_SAMPLES; i++ ) {
225
+ iterationsUsed = i;
226
+
227
+ float increment = float(i + 1);
228
+
229
+ if(!doneN) {
230
+ nDist += increment;
231
+ posN = posM + offNP * nDist;
232
+ vec4 rgbaEndN = FxaaTexTop(tex, posN.xy);
233
+ doneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );
234
+ iterationsUsedN = i;
235
+ }
236
+
237
+ if(!doneP) {
238
+ pDist += increment;
239
+ posP = posM - offNP * pDist;
240
+ vec4 rgbaEndP = FxaaTexTop(tex, posP.xy);
241
+ doneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );
242
+ iterationsUsedP = i;
243
+ }
244
+
245
+ if(doneN || doneP) break;
246
+ }
247
+
248
+
249
+ if ( !doneP && !doneN ) return rgbaM; // failed to find end of edge
250
+
251
+ float dist = min(
252
+ doneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,
253
+ doneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.
254
+ );
548
255
 
256
+ // hacky way of reduces blurriness of mostly diagonal edges
257
+ // but reduces AA quality
258
+ dist = pow(dist, .5);
549
259
 
550
- /*============================================================================
260
+ dist = 1. - dist;
551
261
 
552
- FXAA3 QUALITY - PC
262
+ return mix(
263
+ rgbaM,
264
+ rgbaN,
265
+ dist * .5
266
+ );
267
+ }
553
268
 
554
- ============================================================================*/
555
- #if (FXAA_PC == 1)
556
- /*--------------------------------------------------------------------------*/
557
- FxaaFloat4 FxaaPixelShader(
558
- //
559
- // Use noperspective interpolation here (turn off perspective interpolation).
560
- // {xy} = center of pixel
561
- FxaaFloat2 pos,
562
- //
563
- // Used only for FXAA Console, and not used on the 360 version.
564
- // Use noperspective interpolation here (turn off perspective interpolation).
565
- // {xy_} = upper left of pixel
566
- // {_zw} = lower right of pixel
567
- FxaaFloat4 fxaaConsolePosPos,
568
- //
569
- // Input color texture.
570
- // {rgb_} = color in linear or perceptual color space
571
- // if (FXAA_GREEN_AS_LUMA == 0)
572
- // {__a} = luma in perceptual color space (not linear)
573
- FxaaTex tex,
574
- //
575
- // Only used on the optimized 360 version of FXAA Console.
576
- // For everything but 360, just use the same input here as for "tex".
577
- // For 360, same texture, just alias with a 2nd sampler.
578
- // This sampler needs to have an exponent bias of -1.
579
- FxaaTex fxaaConsole360TexExpBiasNegOne,
580
- //
581
- // Only used on the optimized 360 version of FXAA Console.
582
- // For everything but 360, just use the same input here as for "tex".
583
- // For 360, same texture, just alias with a 3nd sampler.
584
- // This sampler needs to have an exponent bias of -2.
585
- FxaaTex fxaaConsole360TexExpBiasNegTwo,
586
- //
587
- // Only used on FXAA Quality.
588
- // This must be from a constant/uniform.
589
- // {x_} = 1.0/screenWidthInPixels
590
- // {_y} = 1.0/screenHeightInPixels
591
- FxaaFloat2 fxaaQualityRcpFrame,
592
- //
593
- // Only used on FXAA Console.
594
- // This must be from a constant/uniform.
595
- // This effects sub-pixel AA quality and inversely sharpness.
596
- // Where N ranges between,
597
- // N = 0.50 (default)
598
- // N = 0.33 (sharper)
599
- // {x__} = -N/screenWidthInPixels
600
- // {_y_} = -N/screenHeightInPixels
601
- // {_z_} = N/screenWidthInPixels
602
- // {__w} = N/screenHeightInPixels
603
- FxaaFloat4 fxaaConsoleRcpFrameOpt,
604
- //
605
- // Only used on FXAA Console.
606
- // Not used on 360, but used on PS3 and PC.
607
- // This must be from a constant/uniform.
608
- // {x__} = -2.0/screenWidthInPixels
609
- // {_y_} = -2.0/screenHeightInPixels
610
- // {_z_} = 2.0/screenWidthInPixels
611
- // {__w} = 2.0/screenHeightInPixels
612
- FxaaFloat4 fxaaConsoleRcpFrameOpt2,
613
- //
614
- // Only used on FXAA Console.
615
- // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.
616
- // This must be from a constant/uniform.
617
- // {x__} = 8.0/screenWidthInPixels
618
- // {_y_} = 8.0/screenHeightInPixels
619
- // {_z_} = -4.0/screenWidthInPixels
620
- // {__w} = -4.0/screenHeightInPixels
621
- FxaaFloat4 fxaaConsole360RcpFrameOpt2,
622
- //
623
- // Only used on FXAA Quality.
624
- // This used to be the FXAA_QUALITY_SUBPIX define.
625
- // It is here now to allow easier tuning.
626
- // Choose the amount of sub-pixel aliasing removal.
627
- // This can effect sharpness.
628
- // 1.00 - upper limit (softer)
629
- // 0.75 - default amount of filtering
630
- // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
631
- // 0.25 - almost off
632
- // 0.00 - completely off
633
- FxaaFloat fxaaQualitySubpix,
634
- //
635
- // Only used on FXAA Quality.
636
- // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
637
- // It is here now to allow easier tuning.
638
- // The minimum amount of local contrast required to apply algorithm.
639
- // 0.333 - too little (faster)
640
- // 0.250 - low quality
641
- // 0.166 - default
642
- // 0.125 - high quality
643
- // 0.063 - overkill (slower)
644
- FxaaFloat fxaaQualityEdgeThreshold,
645
- //
646
- // Only used on FXAA Quality.
647
- // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
648
- // It is here now to allow easier tuning.
649
- // Trims the algorithm from processing darks.
650
- // 0.0833 - upper limit (default, the start of visible unfiltered edges)
651
- // 0.0625 - high quality (faster)
652
- // 0.0312 - visible limit (slower)
653
- // Special notes when using FXAA_GREEN_AS_LUMA,
654
- // Likely want to set this to zero.
655
- // As colors that are mostly not-green
656
- // will appear very dark in the green channel!
657
- // Tune by looking at mostly non-green content,
658
- // then start at zero and increase until aliasing is a problem.
659
- FxaaFloat fxaaQualityEdgeThresholdMin,
660
- //
661
- // Only used on FXAA Console.
662
- // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.
663
- // It is here now to allow easier tuning.
664
- // This does not effect PS3, as this needs to be compiled in.
665
- // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.
666
- // Due to the PS3 being ALU bound,
667
- // there are only three safe values here: 2 and 4 and 8.
668
- // These options use the shaders ability to a free *|/ by 2|4|8.
669
- // For all other platforms can be a non-power of two.
670
- // 8.0 is sharper (default!!!)
671
- // 4.0 is softer
672
- // 2.0 is really soft (good only for vector graphics inputs)
673
- FxaaFloat fxaaConsoleEdgeSharpness,
674
- //
675
- // Only used on FXAA Console.
676
- // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.
677
- // It is here now to allow easier tuning.
678
- // This does not effect PS3, as this needs to be compiled in.
679
- // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.
680
- // Due to the PS3 being ALU bound,
681
- // there are only two safe values here: 1/4 and 1/8.
682
- // These options use the shaders ability to a free *|/ by 2|4|8.
683
- // The console setting has a different mapping than the quality setting.
684
- // Other platforms can use other values.
685
- // 0.125 leaves less aliasing, but is softer (default!!!)
686
- // 0.25 leaves more aliasing, and is sharper
687
- FxaaFloat fxaaConsoleEdgeThreshold,
688
- //
689
- // Only used on FXAA Console.
690
- // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.
691
- // It is here now to allow easier tuning.
692
- // Trims the algorithm from processing darks.
693
- // The console setting has a different mapping than the quality setting.
694
- // This only applies when FXAA_EARLY_EXIT is 1.
695
- // This does not apply to PS3,
696
- // PS3 was simplified to avoid more shader instructions.
697
- // 0.06 - faster but more aliasing in darks
698
- // 0.05 - default
699
- // 0.04 - slower and less aliasing in darks
700
- // Special notes when using FXAA_GREEN_AS_LUMA,
701
- // Likely want to set this to zero.
702
- // As colors that are mostly not-green
703
- // will appear very dark in the green channel!
704
- // Tune by looking at mostly non-green content,
705
- // then start at zero and increase until aliasing is a problem.
706
- FxaaFloat fxaaConsoleEdgeThresholdMin,
707
- //
708
- // Extra constants for 360 FXAA Console only.
709
- // Use zeros or anything else for other platforms.
710
- // These must be in physical constant registers and NOT immediates.
711
- // Immediates will result in compiler un-optimizing.
712
- // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)
713
- FxaaFloat4 fxaaConsole360ConstDir
714
- ) {
715
- /*--------------------------------------------------------------------------*/
716
- FxaaFloat2 posM;
717
- posM.x = pos.x;
718
- posM.y = pos.y;
719
- #if (FXAA_GATHER4_ALPHA == 1)
720
- #if (FXAA_DISCARD == 0)
721
- FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
722
- #if (FXAA_GREEN_AS_LUMA == 0)
723
- #define lumaM rgbyM.w
724
- #else
725
- #define lumaM rgbyM.y
726
- #endif
727
- #endif
728
- #if (FXAA_GREEN_AS_LUMA == 0)
729
- FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);
730
- FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));
731
- #else
732
- FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
733
- FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
734
- #endif
735
- #if (FXAA_DISCARD == 1)
736
- #define lumaM luma4A.w
737
- #endif
738
- #define lumaE luma4A.z
739
- #define lumaS luma4A.x
740
- #define lumaSE luma4A.y
741
- #define lumaNW luma4B.w
742
- #define lumaN luma4B.z
743
- #define lumaW luma4B.x
744
- #else
745
- FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
746
- #if (FXAA_GREEN_AS_LUMA == 0)
747
- #define lumaM rgbyM.w
748
- #else
749
- #define lumaM rgbyM.y
750
- #endif
751
- #if (FXAA_GLSL_100 == 1)
752
- FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));
753
- FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));
754
- FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));
755
- FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));
756
- #else
757
- FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
758
- FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
759
- FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
760
- FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
761
- #endif
762
- #endif
763
- /*--------------------------------------------------------------------------*/
764
- FxaaFloat maxSM = max(lumaS, lumaM);
765
- FxaaFloat minSM = min(lumaS, lumaM);
766
- FxaaFloat maxESM = max(lumaE, maxSM);
767
- FxaaFloat minESM = min(lumaE, minSM);
768
- FxaaFloat maxWN = max(lumaN, lumaW);
769
- FxaaFloat minWN = min(lumaN, lumaW);
770
- FxaaFloat rangeMax = max(maxWN, maxESM);
771
- FxaaFloat rangeMin = min(minWN, minESM);
772
- FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
773
- FxaaFloat range = rangeMax - rangeMin;
774
- FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
775
- FxaaBool earlyExit = range < rangeMaxClamped;
776
- /*--------------------------------------------------------------------------*/
777
- if(earlyExit)
778
- #if (FXAA_DISCARD == 1)
779
- FxaaDiscard;
780
- #else
781
- return rgbyM;
782
- #endif
783
- /*--------------------------------------------------------------------------*/
784
- #if (FXAA_GATHER4_ALPHA == 0)
785
- #if (FXAA_GLSL_100 == 1)
786
- FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));
787
- FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));
788
- FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));
789
- FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));
790
- #else
791
- FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
792
- FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
793
- FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
794
- FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
795
- #endif
796
- #else
797
- FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
798
- FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
799
- #endif
800
- /*--------------------------------------------------------------------------*/
801
- FxaaFloat lumaNS = lumaN + lumaS;
802
- FxaaFloat lumaWE = lumaW + lumaE;
803
- FxaaFloat subpixRcpRange = 1.0/range;
804
- FxaaFloat subpixNSWE = lumaNS + lumaWE;
805
- FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
806
- FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
807
- /*--------------------------------------------------------------------------*/
808
- FxaaFloat lumaNESE = lumaNE + lumaSE;
809
- FxaaFloat lumaNWNE = lumaNW + lumaNE;
810
- FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
811
- FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
812
- /*--------------------------------------------------------------------------*/
813
- FxaaFloat lumaNWSW = lumaNW + lumaSW;
814
- FxaaFloat lumaSWSE = lumaSW + lumaSE;
815
- FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
816
- FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
817
- FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
818
- FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
819
- FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
820
- FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
821
- /*--------------------------------------------------------------------------*/
822
- FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
823
- FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
824
- FxaaBool horzSpan = edgeHorz >= edgeVert;
825
- FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
826
- /*--------------------------------------------------------------------------*/
827
- if(!horzSpan) lumaN = lumaW;
828
- if(!horzSpan) lumaS = lumaE;
829
- if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
830
- FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
831
- /*--------------------------------------------------------------------------*/
832
- FxaaFloat gradientN = lumaN - lumaM;
833
- FxaaFloat gradientS = lumaS - lumaM;
834
- FxaaFloat lumaNN = lumaN + lumaM;
835
- FxaaFloat lumaSS = lumaS + lumaM;
836
- FxaaBool pairN = abs(gradientN) >= abs(gradientS);
837
- FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
838
- if(pairN) lengthSign = -lengthSign;
839
- FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
840
- /*--------------------------------------------------------------------------*/
841
- FxaaFloat2 posB;
842
- posB.x = posM.x;
843
- posB.y = posM.y;
844
- FxaaFloat2 offNP;
845
- offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
846
- offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
847
- if(!horzSpan) posB.x += lengthSign * 0.5;
848
- if( horzSpan) posB.y += lengthSign * 0.5;
849
- /*--------------------------------------------------------------------------*/
850
- FxaaFloat2 posN;
851
- posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
852
- posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
853
- FxaaFloat2 posP;
854
- posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
855
- posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
856
- FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
857
- FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
858
- FxaaFloat subpixE = subpixC * subpixC;
859
- FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
860
- /*--------------------------------------------------------------------------*/
861
- if(!pairN) lumaNN = lumaSS;
862
- FxaaFloat gradientScaled = gradient * 1.0/4.0;
863
- FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
864
- FxaaFloat subpixF = subpixD * subpixE;
865
- FxaaBool lumaMLTZero = lumaMM < 0.0;
866
- /*--------------------------------------------------------------------------*/
867
- lumaEndN -= lumaNN * 0.5;
868
- lumaEndP -= lumaNN * 0.5;
869
- FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
870
- FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
871
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
872
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
873
- FxaaBool doneNP = (!doneN) || (!doneP);
874
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
875
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
876
- /*--------------------------------------------------------------------------*/
877
- if(doneNP) {
878
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
879
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
880
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
881
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
882
- doneN = abs(lumaEndN) >= gradientScaled;
883
- doneP = abs(lumaEndP) >= gradientScaled;
884
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
885
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
886
- doneNP = (!doneN) || (!doneP);
887
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
888
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
889
- /*--------------------------------------------------------------------------*/
890
- #if (FXAA_QUALITY_PS > 3)
891
- if(doneNP) {
892
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
893
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
894
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
895
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
896
- doneN = abs(lumaEndN) >= gradientScaled;
897
- doneP = abs(lumaEndP) >= gradientScaled;
898
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
899
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
900
- doneNP = (!doneN) || (!doneP);
901
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
902
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
903
- /*--------------------------------------------------------------------------*/
904
- #if (FXAA_QUALITY_PS > 4)
905
- if(doneNP) {
906
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
907
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
908
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
909
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
910
- doneN = abs(lumaEndN) >= gradientScaled;
911
- doneP = abs(lumaEndP) >= gradientScaled;
912
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
913
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
914
- doneNP = (!doneN) || (!doneP);
915
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
916
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
917
- /*--------------------------------------------------------------------------*/
918
- #if (FXAA_QUALITY_PS > 5)
919
- if(doneNP) {
920
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
921
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
922
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
923
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
924
- doneN = abs(lumaEndN) >= gradientScaled;
925
- doneP = abs(lumaEndP) >= gradientScaled;
926
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
927
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
928
- doneNP = (!doneN) || (!doneP);
929
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
930
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
931
- /*--------------------------------------------------------------------------*/
932
- #if (FXAA_QUALITY_PS > 6)
933
- if(doneNP) {
934
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
935
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
936
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
937
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
938
- doneN = abs(lumaEndN) >= gradientScaled;
939
- doneP = abs(lumaEndP) >= gradientScaled;
940
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
941
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
942
- doneNP = (!doneN) || (!doneP);
943
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
944
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
945
- /*--------------------------------------------------------------------------*/
946
- #if (FXAA_QUALITY_PS > 7)
947
- if(doneNP) {
948
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
949
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
950
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
951
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
952
- doneN = abs(lumaEndN) >= gradientScaled;
953
- doneP = abs(lumaEndP) >= gradientScaled;
954
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
955
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
956
- doneNP = (!doneN) || (!doneP);
957
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
958
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
959
- /*--------------------------------------------------------------------------*/
960
- #if (FXAA_QUALITY_PS > 8)
961
- if(doneNP) {
962
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
963
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
964
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
965
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
966
- doneN = abs(lumaEndN) >= gradientScaled;
967
- doneP = abs(lumaEndP) >= gradientScaled;
968
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
969
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
970
- doneNP = (!doneN) || (!doneP);
971
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
972
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
973
- /*--------------------------------------------------------------------------*/
974
- #if (FXAA_QUALITY_PS > 9)
975
- if(doneNP) {
976
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
977
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
978
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
979
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
980
- doneN = abs(lumaEndN) >= gradientScaled;
981
- doneP = abs(lumaEndP) >= gradientScaled;
982
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
983
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
984
- doneNP = (!doneN) || (!doneP);
985
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
986
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
987
- /*--------------------------------------------------------------------------*/
988
- #if (FXAA_QUALITY_PS > 10)
989
- if(doneNP) {
990
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
991
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
992
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
993
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
994
- doneN = abs(lumaEndN) >= gradientScaled;
995
- doneP = abs(lumaEndP) >= gradientScaled;
996
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
997
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
998
- doneNP = (!doneN) || (!doneP);
999
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
1000
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
1001
- /*--------------------------------------------------------------------------*/
1002
- #if (FXAA_QUALITY_PS > 11)
1003
- if(doneNP) {
1004
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
1005
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
1006
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
1007
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
1008
- doneN = abs(lumaEndN) >= gradientScaled;
1009
- doneP = abs(lumaEndP) >= gradientScaled;
1010
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
1011
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
1012
- doneNP = (!doneN) || (!doneP);
1013
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
1014
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
1015
- /*--------------------------------------------------------------------------*/
1016
- #if (FXAA_QUALITY_PS > 12)
1017
- if(doneNP) {
1018
- if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
1019
- if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
1020
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
1021
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
1022
- doneN = abs(lumaEndN) >= gradientScaled;
1023
- doneP = abs(lumaEndP) >= gradientScaled;
1024
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
1025
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
1026
- doneNP = (!doneN) || (!doneP);
1027
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
1028
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
1029
- /*--------------------------------------------------------------------------*/
1030
- }
1031
- #endif
1032
- /*--------------------------------------------------------------------------*/
1033
- }
1034
- #endif
1035
- /*--------------------------------------------------------------------------*/
1036
- }
1037
- #endif
1038
- /*--------------------------------------------------------------------------*/
1039
- }
1040
- #endif
1041
- /*--------------------------------------------------------------------------*/
1042
- }
1043
- #endif
1044
- /*--------------------------------------------------------------------------*/
1045
- }
1046
- #endif
1047
- /*--------------------------------------------------------------------------*/
1048
- }
1049
- #endif
1050
- /*--------------------------------------------------------------------------*/
1051
- }
1052
- #endif
1053
- /*--------------------------------------------------------------------------*/
1054
- }
1055
- #endif
1056
- /*--------------------------------------------------------------------------*/
1057
- }
1058
- #endif
1059
- /*--------------------------------------------------------------------------*/
1060
- }
1061
- /*--------------------------------------------------------------------------*/
1062
- FxaaFloat dstN = posM.x - posN.x;
1063
- FxaaFloat dstP = posP.x - posM.x;
1064
- if(!horzSpan) dstN = posM.y - posN.y;
1065
- if(!horzSpan) dstP = posP.y - posM.y;
1066
- /*--------------------------------------------------------------------------*/
1067
- FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
1068
- FxaaFloat spanLength = (dstP + dstN);
1069
- FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
1070
- FxaaFloat spanLengthRcp = 1.0/spanLength;
1071
- /*--------------------------------------------------------------------------*/
1072
- FxaaBool directionN = dstN < dstP;
1073
- FxaaFloat dst = min(dstN, dstP);
1074
- FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
1075
- FxaaFloat subpixG = subpixF * subpixF;
1076
- FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
1077
- FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
1078
- /*--------------------------------------------------------------------------*/
1079
- FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
1080
- FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
1081
- if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
1082
- if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
1083
- #if (FXAA_DISCARD == 1)
1084
- return FxaaTexTop(tex, posM);
1085
- #else
1086
- return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
1087
- #endif
1088
- }
1089
- /*==========================================================================*/
1090
- #endif
269
+ void main() {
270
+ const float edgeDetectionQuality = .2;
271
+ const float invEdgeDetectionQuality = 1. / edgeDetectionQuality;
1091
272
 
1092
- void main() {
1093
273
  gl_FragColor = FxaaPixelShader(
1094
- vUv,
1095
- vec4(0.0),
1096
- tDiffuse,
1097
- tDiffuse,
1098
- tDiffuse,
1099
- resolution,
1100
- vec4(0.0),
1101
- vec4(0.0),
1102
- vec4(0.0),
1103
- 0.75,
1104
- 0.166,
1105
- 0.0833,
1106
- 0.0,
1107
- 0.0,
1108
- 0.0,
1109
- vec4(0.0)
274
+ vUv,
275
+ tDiffuse,
276
+ resolution,
277
+ edgeDetectionQuality, // [0,1] contrast needed, otherwise early discard
278
+ invEdgeDetectionQuality
1110
279
  );
1111
280
 
1112
- // TODO avoid querying texture twice for same texel
1113
- gl_FragColor.a = texture2D(tDiffuse, vUv).a;
1114
- }`
281
+ }
282
+ `
1115
283
 
1116
284
  };
1117
285