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