super-three 0.136.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.
- package/LICENSE +1 -1
- package/README.md +24 -26
- package/build/three.cjs +35889 -0
- package/build/three.js +4837 -6036
- package/build/three.min.js +2 -2
- package/build/three.module.js +16548 -17930
- package/examples/js/animation/CCDIKSolver.js +3 -2
- package/examples/js/animation/MMDAnimationHelper.js +3 -1
- package/examples/js/animation/MMDPhysics.js +3 -3
- package/examples/js/cameras/CinematicCamera.js +2 -7
- package/examples/js/controls/ArcballControls.js +3 -1
- package/examples/js/controls/PointerLockControls.js +3 -2
- package/examples/js/controls/TrackballControls.js +1 -4
- package/examples/js/controls/TransformControls.js +5 -6
- package/examples/js/controls/experimental/CameraControls.js +8 -4
- package/examples/js/csm/CSMFrustum.js +1 -1
- package/examples/js/csm/CSMShader.js +51 -35
- package/examples/js/curves/CurveExtras.js +14 -18
- package/examples/js/effects/AnaglyphEffect.js +7 -4
- package/examples/js/effects/AsciiEffect.js +10 -29
- package/examples/js/exporters/ColladaExporter.js +29 -7
- package/examples/js/exporters/EXRExporter.js +458 -0
- package/examples/js/exporters/GLTFExporter.js +233 -105
- package/examples/js/exporters/MMDExporter.js +1 -1
- package/examples/js/exporters/OBJExporter.js +12 -18
- package/examples/js/exporters/PLYExporter.js +15 -20
- package/examples/js/exporters/USDZExporter.js +13 -0
- package/examples/js/geometries/ConvexGeometry.js +1 -1
- package/examples/js/geometries/DecalGeometry.js +0 -7
- package/examples/js/geometries/LightningStrike.js +2 -2
- package/examples/js/geometries/ParametricGeometries.js +3 -3
- package/examples/js/geometries/TextGeometry.js +12 -10
- package/examples/js/helpers/OctreeHelper.js +74 -0
- package/examples/js/helpers/VertexNormalsHelper.js +4 -23
- package/examples/js/helpers/VertexTangentsHelper.js +3 -13
- package/examples/js/helpers/ViewHelper.js +266 -0
- package/examples/js/interactive/HTMLMesh.js +249 -42
- package/examples/js/interactive/SelectionHelper.js +1 -1
- package/examples/js/libs/opentype.min.js +1 -118
- package/examples/js/lines/Line2.js +1 -2
- package/examples/js/lines/LineGeometry.js +10 -21
- package/examples/js/lines/LineMaterial.js +2 -3
- package/examples/js/lines/LineSegments2.js +214 -140
- package/examples/js/lines/LineSegmentsGeometry.js +3 -14
- package/examples/js/lines/Wireframe.js +2 -3
- package/examples/js/lines/WireframeGeometry2.js +1 -2
- package/examples/js/loaders/3MFLoader.js +21 -17
- package/examples/js/loaders/AMFLoader.js +1 -1
- package/examples/js/loaders/BasisTextureLoader.js +1 -0
- package/examples/js/loaders/ColladaLoader.js +33 -12
- package/examples/js/loaders/DDSLoader.js +23 -30
- package/examples/js/loaders/EXRLoader.js +314 -294
- package/examples/js/loaders/FBXLoader.js +11 -0
- package/examples/js/loaders/FontLoader.js +1 -2
- package/examples/js/loaders/GCodeLoader.js +0 -1
- package/examples/js/loaders/GLTFLoader.js +250 -61
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -2
- package/examples/js/loaders/KMZLoader.js +1 -1
- package/examples/js/loaders/KTX2Loader.js +1 -9
- package/examples/js/loaders/LDrawLoader.js +1342 -962
- package/examples/js/loaders/LUT3dlLoader.js +18 -11
- package/examples/js/loaders/LUTCubeLoader.js +4 -5
- package/examples/js/loaders/LWOLoader.js +4 -2
- package/examples/js/loaders/LogLuvLoader.js +1 -2
- package/examples/js/loaders/MD2Loader.js +5 -5
- package/examples/js/loaders/MMDLoader.js +18 -4
- package/examples/js/loaders/MTLLoader.js +10 -3
- package/examples/js/loaders/NRRDLoader.js +1 -1
- package/examples/js/loaders/OBJLoader.js +9 -5
- package/examples/js/loaders/PCDLoader.js +24 -15
- package/examples/js/loaders/PDBLoader.js +11 -11
- package/examples/js/loaders/PLYLoader.js +5 -1
- package/examples/js/loaders/RGBELoader.js +9 -17
- package/examples/js/loaders/RGBMLoader.js +13 -16
- package/examples/js/loaders/STLLoader.js +1 -1
- package/examples/js/loaders/SVGLoader.js +21 -11
- package/examples/js/loaders/VOXLoader.js +3 -4
- package/examples/js/loaders/VRMLLoader.js +9 -21
- package/examples/js/loaders/VTKLoader.js +260 -295
- package/examples/js/loaders/lwo/LWO2Parser.js +4 -4
- package/examples/js/loaders/lwo/LWO3Parser.js +4 -4
- package/examples/js/math/ConvexHull.js +13 -28
- package/examples/js/math/Lut.js +27 -26
- package/examples/js/misc/MorphAnimMesh.js +2 -2
- package/examples/js/misc/ProgressiveLightMap.js +1 -1
- package/examples/js/misc/Volume.js +39 -48
- package/examples/js/misc/VolumeSlice.js +21 -21
- package/examples/js/modifiers/CurveModifier.js +8 -7
- package/examples/js/modifiers/EdgeSplitModifier.js +0 -13
- package/examples/js/modifiers/SimplifyModifier.js +1 -18
- package/examples/js/modifiers/TessellateModifier.js +0 -7
- package/examples/js/objects/Lensflare.js +4 -4
- package/examples/js/objects/LightningStorm.js +4 -5
- package/examples/js/objects/MarchingCubes.js +6 -11
- package/examples/js/objects/Reflector.js +10 -16
- package/examples/js/objects/ReflectorForSSRPass.js +1 -11
- package/examples/js/objects/Refractor.js +10 -16
- package/examples/js/objects/ShadowMesh.js +1 -2
- package/examples/js/objects/Sky.js +1 -1
- package/examples/js/objects/Water.js +2 -15
- package/examples/js/objects/Water2.js +1 -1
- package/examples/js/postprocessing/AdaptiveToneMappingPass.js +6 -10
- package/examples/js/postprocessing/AfterimagePass.js +2 -6
- package/examples/js/postprocessing/BloomPass.js +50 -19
- package/examples/js/postprocessing/DotScreenPass.js +1 -1
- package/examples/js/postprocessing/EffectComposer.js +1 -6
- package/examples/js/postprocessing/GlitchPass.js +4 -5
- package/examples/js/postprocessing/LUTPass.js +2 -2
- package/examples/js/postprocessing/OutlinePass.js +8 -17
- package/examples/js/postprocessing/SAOPass.js +2 -7
- package/examples/js/postprocessing/SMAAPass.js +2 -9
- package/examples/js/postprocessing/SSAARenderPass.js +1 -6
- package/examples/js/postprocessing/SSAOPass.js +9 -21
- package/examples/js/postprocessing/SSRPass.js +3 -8
- package/examples/js/postprocessing/SavePass.js +1 -5
- package/examples/js/postprocessing/TAARenderPass.js +4 -4
- package/examples/js/postprocessing/UnrealBloomPass.js +3 -12
- package/examples/js/renderers/CSS2DRenderer.js +20 -19
- package/examples/js/renderers/CSS3DRenderer.js +40 -36
- package/examples/js/renderers/Projector.js +97 -124
- package/examples/js/renderers/SVGRenderer.js +3 -4
- package/examples/js/shaders/BlendShader.js +2 -1
- package/examples/js/shaders/CopyShader.js +4 -3
- package/examples/js/shaders/DigitalGlitch.js +3 -3
- package/examples/js/shaders/FXAAShader.js +239 -1069
- package/examples/js/shaders/FreiChenShader.js +1 -1
- package/examples/js/shaders/HorizontalBlurShader.js +1 -1
- package/examples/js/shaders/HorizontalTiltShiftShader.js +1 -1
- package/examples/js/shaders/MMDToonShader.js +0 -1
- package/examples/js/shaders/SSAOShader.js +1 -1
- package/examples/js/shaders/SSRShader.js +3 -3
- package/examples/js/shaders/ToneMapShader.js +1 -1
- package/examples/js/utils/BufferGeometryUtils.js +282 -22
- package/examples/js/utils/GPUStatsPanel.js +1 -1
- package/examples/js/utils/LDrawUtils.js +182 -0
- package/examples/js/utils/SceneUtils.js +59 -0
- package/examples/js/utils/SkeletonUtils.js +1 -1
- package/examples/js/utils/UVsDebug.js +23 -33
- package/examples/jsm/animation/CCDIKSolver.js +3 -9
- package/examples/jsm/animation/MMDPhysics.js +2 -2
- package/examples/jsm/cameras/CinematicCamera.js +2 -5
- package/examples/jsm/{WebGL.js → capabilities/WebGL.js} +2 -2
- package/examples/jsm/{renderers/webgpu → capabilities}/WebGPU.js +7 -1
- package/examples/jsm/controls/ArcballControls.js +3 -1
- package/examples/jsm/controls/PointerLockControls.js +4 -2
- package/examples/jsm/controls/TrackballControls.js +1 -4
- package/examples/jsm/controls/TransformControls.js +6 -6
- package/examples/jsm/controls/experimental/CameraControls.js +2 -2
- package/examples/jsm/csm/CSMFrustum.js +1 -1
- package/examples/jsm/csm/CSMShader.js +51 -35
- package/examples/jsm/curves/CurveExtras.js +15 -17
- package/examples/jsm/effects/AnaglyphEffect.js +4 -4
- package/examples/jsm/effects/AsciiEffect.js +9 -22
- package/examples/jsm/exporters/ColladaExporter.js +31 -6
- package/examples/jsm/exporters/EXRExporter.js +507 -0
- package/examples/jsm/exporters/GLTFExporter.js +261 -103
- package/examples/jsm/exporters/KTX2Exporter.js +281 -0
- package/examples/jsm/exporters/MMDExporter.js +1 -1
- package/examples/jsm/exporters/OBJExporter.js +11 -18
- package/examples/jsm/exporters/PLYExporter.js +23 -21
- package/examples/jsm/exporters/USDZExporter.js +12 -0
- package/examples/jsm/geometries/ConvexGeometry.js +1 -1
- package/examples/jsm/geometries/DecalGeometry.js +0 -7
- package/examples/jsm/geometries/LightningStrike.js +2 -2
- package/examples/jsm/geometries/ParametricGeometries.js +3 -3
- package/examples/jsm/geometries/TextGeometry.js +13 -13
- package/examples/jsm/helpers/OctreeHelper.js +58 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +4 -25
- package/examples/jsm/helpers/VertexTangentsHelper.js +3 -15
- package/examples/jsm/helpers/ViewHelper.js +295 -0
- package/examples/jsm/interactive/HTMLMesh.js +268 -36
- package/examples/jsm/interactive/SelectionHelper.js +1 -1
- package/examples/jsm/libs/flow.module.js +947 -183
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/lil-gui.module.min.js +2 -2
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/opentype.module.js +14568 -0
- package/examples/jsm/lines/Line2.js +2 -2
- package/examples/jsm/lines/LineGeometry.js +11 -19
- package/examples/jsm/lines/LineMaterial.js +3 -3
- package/examples/jsm/lines/LineSegments2.js +210 -145
- package/examples/jsm/lines/LineSegmentsGeometry.js +3 -12
- package/examples/jsm/lines/Wireframe.js +3 -3
- package/examples/jsm/lines/WireframeGeometry2.js +2 -2
- package/examples/jsm/loaders/3DMLoader.js +3 -2
- package/examples/jsm/loaders/3MFLoader.js +21 -17
- package/examples/jsm/loaders/AMFLoader.js +1 -1
- package/examples/jsm/loaders/BasisTextureLoader.js +7 -0
- package/examples/jsm/loaders/ColladaLoader.js +40 -12
- package/examples/jsm/loaders/DDSLoader.js +21 -28
- package/examples/jsm/loaders/EXRLoader.js +309 -293
- package/examples/jsm/loaders/FBXLoader.js +11 -0
- package/examples/jsm/loaders/FontLoader.js +2 -2
- package/examples/jsm/loaders/GCodeLoader.js +0 -1
- package/examples/jsm/loaders/GLTFLoader.js +263 -68
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -4
- package/examples/jsm/loaders/KMZLoader.js +1 -1
- package/examples/jsm/loaders/KTX2Loader.js +1 -10
- package/examples/jsm/loaders/LDrawLoader.js +1335 -988
- package/examples/jsm/loaders/LUT3dlLoader.js +19 -14
- package/examples/jsm/loaders/LUTCubeLoader.js +5 -7
- package/examples/jsm/loaders/LWOLoader.js +5 -3
- package/examples/jsm/loaders/LogLuvLoader.js +2 -2
- package/examples/jsm/loaders/MD2Loader.js +5 -5
- package/examples/jsm/loaders/MMDLoader.js +21 -3
- package/examples/jsm/loaders/MTLLoader.js +11 -4
- package/examples/jsm/loaders/NRRDLoader.js +1 -2
- package/examples/jsm/loaders/OBJLoader.js +11 -7
- package/examples/jsm/loaders/PCDLoader.js +25 -17
- package/examples/jsm/loaders/PDBLoader.js +11 -11
- package/examples/jsm/loaders/PLYLoader.js +10 -2
- package/examples/jsm/loaders/RGBELoader.js +11 -20
- package/examples/jsm/loaders/RGBMLoader.js +15 -12
- package/examples/jsm/loaders/STLLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +26 -11
- package/examples/jsm/loaders/TTFLoader.js +1 -1
- package/examples/jsm/loaders/VOXLoader.js +5 -5
- package/examples/jsm/loaders/VRMLLoader.js +9 -23
- package/examples/jsm/loaders/VTKLoader.js +256 -284
- package/examples/jsm/loaders/ifc/web-ifc-api.js +9 -8
- package/examples/jsm/loaders/lwo/LWO2Parser.js +4 -4
- package/examples/jsm/loaders/lwo/LWO3Parser.js +4 -4
- package/examples/jsm/math/ConvexHull.js +13 -28
- package/examples/jsm/math/Lut.js +35 -25
- package/examples/jsm/misc/MorphAnimMesh.js +2 -2
- package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
- package/examples/jsm/misc/Volume.js +39 -46
- package/examples/jsm/misc/VolumeSlice.js +21 -21
- package/examples/jsm/modifiers/CurveModifier.js +9 -8
- package/examples/jsm/modifiers/EdgeSplitModifier.js +0 -13
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -18
- package/examples/jsm/modifiers/TessellateModifier.js +0 -7
- package/examples/jsm/node-editor/NodeEditor.js +485 -163
- package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +14 -0
- package/examples/jsm/node-editor/accessors/NormalEditor.js +9 -9
- package/examples/jsm/node-editor/accessors/PositionEditor.js +9 -9
- package/examples/jsm/node-editor/accessors/UVEditor.js +7 -8
- package/examples/jsm/node-editor/core/BaseNode.js +89 -0
- package/examples/jsm/node-editor/core/DataFile.js +59 -0
- package/examples/jsm/node-editor/core/FileEditor.js +20 -0
- package/examples/jsm/node-editor/core/FileURLEditor.js +29 -0
- package/examples/jsm/node-editor/display/BlendEditor.js +10 -9
- package/examples/jsm/node-editor/display/NormalMapEditor.js +49 -0
- package/examples/jsm/node-editor/examples/animate-uv.json +1 -1
- package/examples/jsm/node-editor/examples/fake-top-light.json +1 -1
- package/examples/jsm/node-editor/examples/matcap.json +1 -0
- package/examples/jsm/node-editor/examples/oscillator-color.json +1 -1
- package/examples/jsm/node-editor/examples/rim.json +1 -1
- package/examples/jsm/node-editor/inputs/ColorEditor.js +18 -13
- package/examples/jsm/node-editor/inputs/FloatEditor.js +8 -9
- package/examples/jsm/node-editor/inputs/SliderEditor.js +6 -7
- package/examples/jsm/node-editor/inputs/TextureEditor.js +155 -0
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +9 -9
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +11 -11
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +12 -12
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +87 -0
- package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +102 -0
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +31 -18
- package/examples/jsm/node-editor/math/AngleEditor.js +40 -0
- package/examples/jsm/node-editor/math/DotEditor.js +8 -9
- package/examples/jsm/node-editor/math/InvertEditor.js +8 -7
- package/examples/jsm/node-editor/math/LimiterEditor.js +28 -14
- package/examples/jsm/node-editor/math/NormalizeEditor.js +9 -7
- package/examples/jsm/node-editor/math/OperatorEditor.js +29 -16
- package/examples/jsm/node-editor/math/PowerEditor.js +20 -10
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +15 -9
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +7 -6
- package/examples/jsm/node-editor/scene/MeshEditor.js +99 -0
- package/examples/jsm/node-editor/scene/Object3DEditor.js +160 -0
- package/examples/jsm/node-editor/scene/PointsEditor.js +99 -0
- package/examples/jsm/node-editor/utils/JoinEditor.js +58 -0
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +9 -8
- package/examples/jsm/node-editor/utils/PreviewEditor.js +166 -0
- package/examples/jsm/node-editor/utils/SplitEditor.js +39 -0
- package/examples/jsm/node-editor/utils/TimerEditor.js +7 -6
- package/examples/jsm/nodes/Nodes.js +283 -94
- package/examples/jsm/nodes/accessors/BufferNode.js +24 -0
- package/examples/jsm/nodes/accessors/CameraNode.js +27 -196
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +103 -0
- package/examples/jsm/nodes/accessors/InstanceNode.js +58 -0
- package/examples/jsm/{renderers/nodes → nodes}/accessors/MaterialNode.js +49 -11
- package/examples/jsm/{renderers/nodes → nodes}/accessors/MaterialReferenceNode.js +0 -0
- package/examples/jsm/{renderers/nodes → nodes}/accessors/ModelNode.js +8 -0
- package/examples/jsm/{renderers/nodes → nodes}/accessors/ModelViewProjectionNode.js +0 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +39 -99
- package/examples/jsm/{renderers/nodes → nodes}/accessors/Object3DNode.js +34 -17
- package/examples/jsm/{renderers/nodes → nodes}/accessors/PointUVNode.js +2 -2
- package/examples/jsm/nodes/accessors/PositionNode.js +41 -110
- package/examples/jsm/nodes/accessors/ReferenceNode.js +65 -0
- package/examples/jsm/nodes/accessors/ReflectNode.js +34 -121
- package/examples/jsm/nodes/accessors/SkinningNode.js +102 -0
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +21 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +100 -0
- package/examples/jsm/nodes/accessors/UVNode.js +17 -43
- package/examples/jsm/nodes/accessors/UserDataNode.js +23 -0
- package/examples/jsm/nodes/core/ArrayUniformNode.js +23 -0
- package/examples/jsm/nodes/core/AttributeNode.js +33 -30
- package/examples/jsm/{renderers/nodes → nodes}/core/BypassNode.js +2 -2
- package/examples/jsm/{renderers/nodes → nodes}/core/CodeNode.js +2 -30
- package/examples/jsm/nodes/core/ConstNode.js +10 -106
- package/examples/jsm/{renderers/nodes → nodes}/core/ContextNode.js +17 -3
- package/examples/jsm/nodes/core/ExpressionNode.js +24 -7
- package/examples/jsm/nodes/core/FunctionCallNode.js +26 -67
- package/examples/jsm/nodes/core/FunctionNode.js +43 -216
- package/examples/jsm/nodes/core/InputNode.js +28 -60
- package/examples/jsm/nodes/core/InstanceIndexNode.js +21 -0
- package/examples/jsm/nodes/core/Node.js +228 -94
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeAttribute.js +2 -2
- package/examples/jsm/nodes/core/NodeBuilder.js +388 -560
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeCode.js +0 -0
- package/examples/jsm/nodes/core/NodeFrame.js +30 -23
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeFunction.js +0 -0
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeFunctionInput.js +0 -0
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeKeywords.js +0 -0
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeParser.js +0 -0
- package/examples/jsm/nodes/core/NodeUniform.js +8 -6
- package/examples/jsm/nodes/core/NodeUtils.js +69 -37
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeVar.js +2 -2
- package/examples/jsm/{renderers/nodes → nodes}/core/NodeVary.js +2 -2
- package/examples/jsm/{renderers/nodes → nodes}/core/PropertyNode.js +0 -0
- package/examples/jsm/nodes/core/TempNode.js +20 -112
- package/examples/jsm/nodes/core/UniformNode.js +46 -0
- package/examples/jsm/nodes/core/VarNode.js +58 -27
- package/examples/jsm/{renderers/nodes → nodes}/core/VaryNode.js +0 -0
- package/examples/jsm/{renderers/nodes → nodes}/core/constants.js +0 -0
- package/examples/jsm/nodes/display/ColorSpaceNode.js +95 -0
- package/examples/jsm/nodes/display/FrontFacingNode.js +21 -0
- package/examples/jsm/nodes/display/NormalMapNode.js +86 -0
- package/examples/jsm/nodes/display/ToneMappingNode.js +51 -0
- package/examples/jsm/nodes/fog/FogNode.js +31 -0
- package/examples/jsm/nodes/fog/FogRangeNode.js +27 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +33 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +27 -0
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +18 -0
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +18 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +18 -0
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +94 -0
- package/examples/jsm/nodes/functions/light/getDistanceAttenuation.js +22 -0
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +12 -0
- package/examples/jsm/nodes/functions/material/getRoughness.js +18 -0
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +63 -0
- package/examples/jsm/nodes/lighting/AONode.js +25 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +37 -0
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +65 -0
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +50 -0
- package/examples/jsm/nodes/lighting/LightingContextNode.js +75 -0
- package/examples/jsm/nodes/lighting/LightingNode.js +19 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +120 -0
- package/examples/jsm/nodes/lighting/PunctualLightNode.js +68 -0
- package/examples/jsm/nodes/loaders/NodeLoader.js +107 -0
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +42 -0
- package/examples/jsm/nodes/loaders/NodeObjectLoader.js +70 -0
- package/examples/jsm/{renderers/nodes → nodes}/materials/LineBasicNodeMaterial.js +11 -4
- package/examples/jsm/nodes/materials/Materials.js +65 -0
- package/examples/jsm/{renderers/nodes → nodes}/materials/MeshBasicNodeMaterial.js +13 -4
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +162 -22
- package/examples/jsm/nodes/materials/NodeMaterial.js +128 -113
- package/examples/jsm/{renderers/nodes → nodes}/materials/PointsNodeMaterial.js +13 -4
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +84 -16
- package/examples/jsm/nodes/math/CondNode.js +26 -95
- package/examples/jsm/nodes/math/MathNode.js +164 -187
- package/examples/jsm/nodes/math/OperatorNode.js +161 -41
- package/examples/jsm/{renderers/nodes → nodes}/parsers/GLSLNodeFunction.js +2 -2
- package/examples/jsm/{renderers/nodes → nodes}/parsers/GLSLNodeParser.js +0 -0
- package/examples/jsm/{renderers/nodes → nodes}/parsers/WGSLNodeFunction.js +20 -5
- package/examples/jsm/{renderers/nodes → nodes}/parsers/WGSLNodeParser.js +0 -0
- package/examples/jsm/nodes/procedural/CheckerNode.js +16 -57
- package/examples/jsm/nodes/shadernode/ShaderNode.js +262 -0
- package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +274 -0
- package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +106 -0
- package/examples/jsm/{renderers/nodes → nodes}/utils/ArrayElementNode.js +3 -3
- package/examples/jsm/{renderers/nodes → nodes}/utils/ConvertNode.js +11 -3
- package/examples/jsm/nodes/utils/JoinNode.js +17 -89
- package/examples/jsm/nodes/utils/MatcapUVNode.js +25 -0
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +32 -0
- package/examples/jsm/{renderers/nodes → nodes}/utils/OscNode.js +18 -2
- package/examples/jsm/{renderers/nodes → nodes}/utils/SplitNode.js +35 -4
- package/examples/jsm/{renderers/nodes → nodes}/utils/SpriteSheetUVNode.js +3 -3
- package/examples/jsm/nodes/utils/TimerNode.js +30 -65
- package/examples/jsm/objects/Lensflare.js +6 -6
- package/examples/jsm/objects/LightningStorm.js +4 -4
- package/examples/jsm/objects/MarchingCubes.js +5 -9
- package/examples/jsm/objects/Reflector.js +8 -19
- package/examples/jsm/objects/ReflectorForSSRPass.js +2 -14
- package/examples/jsm/objects/Refractor.js +8 -19
- package/examples/jsm/objects/ShadowMesh.js +2 -2
- package/examples/jsm/objects/Sky.js +2 -2
- package/examples/jsm/objects/Water.js +3 -18
- package/examples/jsm/objects/Water2.js +2 -2
- package/examples/jsm/offscreen/jank.js +5 -5
- package/examples/jsm/offscreen/offscreen.js +1 -1
- package/examples/jsm/offscreen/scene.js +11 -11
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +5 -7
- package/examples/jsm/postprocessing/AfterimagePass.js +0 -10
- package/examples/jsm/postprocessing/BloomPass.js +48 -20
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
- package/examples/jsm/postprocessing/EffectComposer.js +1 -9
- package/examples/jsm/postprocessing/GlitchPass.js +7 -6
- package/examples/jsm/postprocessing/LUTPass.js +2 -2
- package/examples/jsm/postprocessing/OutlinePass.js +8 -15
- package/examples/jsm/postprocessing/SAOPass.js +2 -9
- package/examples/jsm/postprocessing/SMAAPass.js +2 -11
- package/examples/jsm/postprocessing/SSAARenderPass.js +1 -4
- package/examples/jsm/postprocessing/SSAOPass.js +13 -25
- package/examples/jsm/postprocessing/SSRPass.js +3 -9
- package/examples/jsm/postprocessing/SavePass.js +1 -3
- package/examples/jsm/postprocessing/TAARenderPass.js +4 -4
- package/examples/jsm/postprocessing/UnrealBloomPass.js +3 -8
- package/examples/jsm/renderers/CSS2DRenderer.js +21 -19
- package/examples/jsm/renderers/CSS3DRenderer.js +39 -34
- package/examples/jsm/renderers/Projector.js +101 -128
- package/examples/jsm/renderers/SVGRenderer.js +4 -4
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +127 -23
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +14 -3
- package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +5 -5
- package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +4 -4
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +16 -10
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +8 -7
- package/examples/jsm/renderers/webgpu/WebGPUBuffer.js +43 -0
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +14 -7
- package/examples/jsm/renderers/webgpu/WebGPUInfo.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUObjects.js +0 -6
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +20 -20
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +2 -1
- package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +66 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +49 -28
- package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +14 -14
- package/examples/jsm/renderers/webgpu/WebGPUSampler.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUStorageBuffer.js +5 -8
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +23 -20
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +38 -20
- package/examples/jsm/renderers/webgpu/WebGPUUniform.js +14 -14
- package/examples/jsm/renderers/webgpu/WebGPUUniformBuffer.js +5 -32
- package/examples/jsm/renderers/webgpu/WebGPUUniformsGroup.js +2 -2
- package/examples/jsm/renderers/webgpu/constants.js +3 -2
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +276 -278
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +20 -2
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +24 -14
- package/examples/jsm/shaders/BlendShader.js +2 -1
- package/examples/jsm/shaders/CopyShader.js +4 -3
- package/examples/jsm/shaders/DigitalGlitch.js +3 -3
- package/examples/jsm/shaders/FXAAShader.js +219 -1051
- package/examples/jsm/shaders/FreiChenShader.js +1 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +1 -1
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +0 -1
- package/examples/jsm/shaders/SSAOShader.js +1 -1
- package/examples/jsm/shaders/SSRShader.js +3 -3
- package/examples/jsm/shaders/ToneMapShader.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +292 -22
- package/examples/jsm/utils/GPUStatsPanel.js +1 -1
- package/examples/jsm/utils/LDrawUtils.js +202 -0
- package/examples/jsm/utils/SceneUtils.js +76 -2
- package/examples/jsm/utils/SkeletonUtils.js +1 -1
- package/examples/jsm/utils/UVsDebug.js +23 -32
- package/examples/jsm/webxr/ARButton.js +14 -4
- package/examples/jsm/webxr/OculusHandPointerModel.js +3 -3
- package/examples/jsm/webxr/Text2D.js +1 -1
- package/examples/jsm/webxr/VRButton.js +39 -1
- package/examples/jsm/webxr/XREstimatedLight.js +2 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +3 -7
- package/examples/jsm/webxr/XRHandModelFactory.js +3 -0
- package/package.json +53 -25
- package/src/Three.Legacy.js +41 -1912
- package/src/Three.js +6 -3
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/AnimationMixer.js +6 -3
- package/src/animation/AnimationObjectGroup.js +2 -2
- package/src/animation/PropertyBinding.js +8 -18
- package/src/audio/PositionalAudio.js +8 -0
- package/src/cameras/ArrayCamera.js +2 -3
- package/src/cameras/Camera.js +2 -2
- package/src/cameras/CubeCamera.js +8 -1
- package/src/cameras/OrthographicCamera.js +2 -2
- package/src/cameras/PerspectiveCamera.js +2 -2
- package/src/constants.js +8 -18
- package/src/core/BufferAttribute.js +7 -12
- package/src/core/BufferGeometry.js +6 -6
- package/src/core/GLBufferAttribute.js +2 -2
- package/src/core/InstancedBufferAttribute.js +2 -2
- package/src/core/InstancedBufferGeometry.js +2 -2
- package/src/core/InstancedInterleavedBuffer.js +2 -2
- package/src/core/InterleavedBuffer.js +2 -2
- package/src/core/InterleavedBufferAttribute.js +5 -11
- package/src/core/Object3D.js +6 -3
- package/src/core/Raycaster.js +2 -2
- package/src/extras/DataUtils.js +127 -40
- package/src/extras/Earcut.js +2 -2
- package/src/extras/ImageUtils.js +63 -0
- package/src/extras/PMREMGenerator.js +152 -174
- package/src/extras/core/CurvePath.js +3 -3
- package/src/extras/core/ShapePath.js +5 -6
- package/src/extras/curves/ArcCurve.js +2 -2
- package/src/extras/curves/CatmullRomCurve3.js +2 -2
- package/src/extras/curves/CubicBezierCurve.js +2 -2
- package/src/extras/curves/CubicBezierCurve3.js +2 -2
- package/src/extras/curves/EllipseCurve.js +2 -2
- package/src/extras/curves/LineCurve.js +2 -2
- package/src/extras/curves/LineCurve3.js +2 -1
- package/src/extras/curves/QuadraticBezierCurve.js +2 -2
- package/src/extras/curves/QuadraticBezierCurve3.js +2 -2
- package/src/extras/curves/SplineCurve.js +2 -2
- package/src/geometries/CapsuleGeometry.js +33 -0
- package/src/geometries/ExtrudeGeometry.js +2 -0
- package/src/geometries/Geometries.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -1
- package/src/geometries/TorusKnotGeometry.js +2 -2
- package/src/geometries/WireframeGeometry.js +3 -2
- package/src/helpers/BoxHelper.js +2 -2
- package/src/helpers/PointLightHelper.js +1 -1
- package/src/helpers/SkeletonHelper.js +3 -2
- package/src/lights/AmbientLight.js +2 -2
- package/src/lights/AmbientLightProbe.js +2 -2
- package/src/lights/DirectionalLight.js +2 -2
- package/src/lights/DirectionalLightShadow.js +2 -2
- package/src/lights/HemisphereLight.js +4 -4
- package/src/lights/HemisphereLightProbe.js +2 -2
- package/src/lights/Light.js +4 -4
- package/src/lights/LightProbe.js +2 -2
- package/src/lights/PointLight.js +4 -4
- package/src/lights/PointLightShadow.js +2 -2
- package/src/lights/RectAreaLight.js +2 -2
- package/src/lights/SpotLight.js +4 -4
- package/src/lights/SpotLightShadow.js +2 -2
- package/src/loaders/FileLoader.js +23 -4
- package/src/loaders/ImageBitmapLoader.js +2 -2
- package/src/loaders/ImageLoader.js +1 -1
- package/src/loaders/LoaderUtils.js +1 -1
- package/src/loaders/MaterialLoader.js +8 -3
- package/src/loaders/ObjectLoader.js +23 -25
- package/src/materials/LineBasicMaterial.js +6 -13
- package/src/materials/LineDashedMaterial.js +2 -15
- package/src/materials/Material.js +49 -15
- package/src/materials/Materials.js +66 -18
- package/src/materials/MeshBasicMaterial.js +6 -31
- package/src/materials/MeshDepthMaterial.js +2 -22
- package/src/materials/MeshDistanceMaterial.js +2 -22
- package/src/materials/MeshLambertMaterial.js +6 -34
- package/src/materials/MeshMatcapMaterial.js +6 -28
- package/src/materials/MeshNormalMaterial.js +2 -26
- package/src/materials/MeshPhongMaterial.js +6 -48
- package/src/materials/MeshPhysicalMaterial.js +32 -35
- package/src/materials/MeshStandardMaterial.js +6 -54
- package/src/materials/MeshToonMaterial.js +6 -38
- package/src/materials/PointsMaterial.js +6 -15
- package/src/materials/RawShaderMaterial.js +2 -2
- package/src/materials/ShaderMaterial.js +3 -17
- package/src/materials/ShadowMaterial.js +6 -8
- package/src/materials/SpriteMaterial.js +6 -12
- package/src/math/Box2.js +2 -2
- package/src/math/Box3.js +29 -15
- package/src/math/Color.js +85 -36
- package/src/math/ColorManagement.js +74 -0
- package/src/math/Euler.js +16 -14
- package/src/math/Interpolant.js +4 -9
- package/src/math/MathUtils.js +76 -7
- package/src/math/Matrix3.js +2 -2
- package/src/math/Matrix4.js +2 -3
- package/src/math/Plane.js +2 -2
- package/src/math/Quaternion.js +12 -3
- package/src/math/Spherical.js +1 -1
- package/src/math/SphericalHarmonics3.js +2 -2
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +12 -3
- package/src/math/Vector4.js +2 -2
- package/src/math/interpolants/DiscreteInterpolant.js +1 -1
- package/src/objects/Bone.js +2 -2
- package/src/objects/Group.js +2 -2
- package/src/objects/InstancedMesh.js +4 -4
- package/src/objects/Line.js +76 -107
- package/src/objects/LineLoop.js +2 -2
- package/src/objects/LineSegments.js +15 -23
- package/src/objects/Mesh.js +82 -104
- package/src/objects/Points.js +32 -54
- package/src/objects/SkinnedMesh.js +5 -8
- package/src/objects/Sprite.js +4 -4
- package/src/renderers/WebGL3DRenderTarget.js +22 -0
- package/src/renderers/WebGLArrayRenderTarget.js +22 -0
- package/src/renderers/WebGLCubeRenderTarget.js +7 -16
- package/src/renderers/WebGLMultipleRenderTargets.js +8 -5
- package/src/renderers/WebGLRenderTarget.js +19 -18
- package/src/renderers/WebGLRenderer.js +112 -133
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +46 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +12 -13
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +0 -2
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -4
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +0 -2
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +3 -19
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +107 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +1 -7
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +1 -7
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +25 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +43 -5
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +10 -3
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +1 -2
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +7 -7
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +1 -9
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +16 -31
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +9 -8
- package/src/renderers/shaders/ShaderChunk.js +6 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -2
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -3
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +3 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +6 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +10 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib.js +8 -2
- package/src/renderers/shaders/UniformsLib.js +2 -2
- package/src/renderers/webgl/WebGLAttributes.js +6 -6
- package/src/renderers/webgl/WebGLBackground.js +5 -2
- package/src/renderers/webgl/WebGLBindingStates.js +57 -29
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -4
- package/src/renderers/webgl/WebGLCubeUVMaps.js +29 -16
- package/src/renderers/webgl/WebGLGeometries.js +2 -2
- package/src/renderers/webgl/WebGLLights.js +0 -1
- package/src/renderers/webgl/WebGLMaterials.js +72 -187
- package/src/renderers/webgl/WebGLMorphtargets.js +59 -23
- package/src/renderers/webgl/WebGLProgram.js +56 -30
- package/src/renderers/webgl/WebGLPrograms.js +80 -130
- package/src/renderers/webgl/WebGLShaderCache.js +4 -3
- package/src/renderers/webgl/WebGLShadowMap.js +6 -8
- package/src/renderers/webgl/WebGLState.js +83 -2
- package/src/renderers/webgl/WebGLTextures.js +618 -375
- package/src/renderers/webgl/WebGLUniforms.js +79 -80
- package/src/renderers/webgl/WebGLUtils.js +97 -30
- package/src/renderers/webxr/WebXRManager.js +64 -47
- package/src/scenes/Fog.js +2 -2
- package/src/scenes/FogExp2.js +2 -2
- package/src/scenes/Scene.js +2 -2
- package/src/textures/CanvasTexture.js +2 -2
- package/src/textures/CompressedTexture.js +2 -2
- package/src/textures/CubeTexture.js +2 -2
- package/src/textures/{DataTexture3D.js → Data3DTexture.js} +4 -4
- package/src/textures/{DataTexture2DArray.js → DataArrayTexture.js} +4 -4
- package/src/textures/DataTexture.js +2 -5
- package/src/textures/DepthTexture.js +5 -5
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +123 -0
- package/src/textures/Texture.js +29 -98
- package/src/textures/VideoTexture.js +2 -4
- package/src/utils.js +15 -1
- package/examples/js/WebGL.js +0 -90
- package/examples/js/csm/Frustum.js +0 -133
- package/examples/js/deprecated/Geometry.js +0 -1656
- package/examples/js/loaders/VRMLoader.js +0 -72
- package/examples/js/objects/ReflectorRTT.js +0 -16
- package/examples/js/postprocessing/SSRrPass.js +0 -494
- package/examples/js/shaders/SSRrShader.js +0 -336
- package/examples/js/utils/RoughnessMipmapper.js +0 -268
- package/examples/jsm/deprecated/Geometry.js +0 -1869
- package/examples/jsm/libs/opentype.module.min.js +0 -119
- package/examples/jsm/loaders/NodeMaterialLoader.js +0 -263
- package/examples/jsm/loaders/VRMLoader.js +0 -78
- package/examples/jsm/nodes/accessors/ColorsNode.js +0 -56
- package/examples/jsm/nodes/accessors/LightNode.js +0 -60
- package/examples/jsm/nodes/accessors/ResolutionNode.js +0 -64
- package/examples/jsm/nodes/accessors/ScreenUVNode.js +0 -64
- package/examples/jsm/nodes/core/NodeLib.js +0 -64
- package/examples/jsm/nodes/core/StructNode.js +0 -106
- package/examples/jsm/nodes/effects/BlurNode.js +0 -171
- package/examples/jsm/nodes/effects/ColorAdjustmentNode.js +0 -140
- package/examples/jsm/nodes/effects/LuminanceNode.js +0 -75
- package/examples/jsm/nodes/inputs/BoolNode.js +0 -51
- package/examples/jsm/nodes/inputs/ColorNode.js +0 -58
- package/examples/jsm/nodes/inputs/CubeTextureNode.js +0 -108
- package/examples/jsm/nodes/inputs/FloatNode.js +0 -51
- package/examples/jsm/nodes/inputs/IntNode.js +0 -51
- package/examples/jsm/nodes/inputs/Matrix3Node.js +0 -63
- package/examples/jsm/nodes/inputs/Matrix4Node.js +0 -63
- package/examples/jsm/nodes/inputs/PropertyNode.js +0 -47
- package/examples/jsm/nodes/inputs/RTTNode.js +0 -157
- package/examples/jsm/nodes/inputs/ReflectorNode.js +0 -90
- package/examples/jsm/nodes/inputs/ScreenNode.js +0 -28
- package/examples/jsm/nodes/inputs/TextureNode.js +0 -116
- package/examples/jsm/nodes/inputs/Vector2Node.js +0 -57
- package/examples/jsm/nodes/inputs/Vector3Node.js +0 -58
- package/examples/jsm/nodes/inputs/Vector4Node.js +0 -59
- package/examples/jsm/nodes/materials/BasicNodeMaterial.js +0 -26
- package/examples/jsm/nodes/materials/PhongNodeMaterial.js +0 -36
- package/examples/jsm/nodes/materials/StandardNodeMaterial.js +0 -40
- package/examples/jsm/nodes/materials/nodes/BasicNode.js +0 -154
- package/examples/jsm/nodes/materials/nodes/MeshStandardNode.js +0 -116
- package/examples/jsm/nodes/materials/nodes/PhongNode.js +0 -409
- package/examples/jsm/nodes/materials/nodes/RawNode.js +0 -62
- package/examples/jsm/nodes/materials/nodes/SpriteNode.js +0 -236
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +0 -609
- package/examples/jsm/nodes/misc/BumpMapNode.js +0 -163
- package/examples/jsm/nodes/misc/NormalMapNode.js +0 -138
- package/examples/jsm/nodes/misc/TextureCubeNode.js +0 -86
- package/examples/jsm/nodes/misc/TextureCubeUVNode.js +0 -280
- package/examples/jsm/nodes/postprocessing/NodePass.js +0 -93
- package/examples/jsm/nodes/postprocessing/NodePostProcessing.js +0 -148
- package/examples/jsm/nodes/procedural/Fractal3DNode.js +0 -104
- package/examples/jsm/nodes/procedural/Noise2DNode.js +0 -149
- package/examples/jsm/nodes/procedural/Noise3DNode.js +0 -141
- package/examples/jsm/nodes/utils/BypassNode.js +0 -85
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +0 -154
- package/examples/jsm/nodes/utils/MaxMIPLevelNode.js +0 -56
- package/examples/jsm/nodes/utils/RemapNode.js +0 -155
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -101
- package/examples/jsm/nodes/utils/SubSlotNode.js +0 -77
- package/examples/jsm/nodes/utils/SwitchNode.js +0 -103
- package/examples/jsm/nodes/utils/UVTransformNode.js +0 -66
- package/examples/jsm/nodes/utils/VelocityNode.js +0 -170
- package/examples/jsm/objects/ReflectorRTT.js +0 -15
- package/examples/jsm/postprocessing/SSRrPass.js +0 -579
- package/examples/jsm/renderers/nodes/Nodes.js +0 -164
- package/examples/jsm/renderers/nodes/ShaderNode.js +0 -346
- package/examples/jsm/renderers/nodes/accessors/CameraNode.js +0 -68
- package/examples/jsm/renderers/nodes/accessors/NormalNode.js +0 -63
- package/examples/jsm/renderers/nodes/accessors/PositionNode.js +0 -67
- package/examples/jsm/renderers/nodes/accessors/ReferenceNode.js +0 -91
- package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +0 -107
- package/examples/jsm/renderers/nodes/accessors/UVNode.js +0 -25
- package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +0 -23
- package/examples/jsm/renderers/nodes/core/AttributeNode.js +0 -54
- package/examples/jsm/renderers/nodes/core/ExpressionNode.js +0 -32
- package/examples/jsm/renderers/nodes/core/FunctionCallNode.js +0 -67
- package/examples/jsm/renderers/nodes/core/FunctionNode.js +0 -87
- package/examples/jsm/renderers/nodes/core/InputNode.js +0 -66
- package/examples/jsm/renderers/nodes/core/Node.js +0 -104
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +0 -633
- package/examples/jsm/renderers/nodes/core/NodeFrame.js +0 -59
- package/examples/jsm/renderers/nodes/core/NodeUniform.js +0 -28
- package/examples/jsm/renderers/nodes/core/TempNode.js +0 -43
- package/examples/jsm/renderers/nodes/core/VarNode.js +0 -51
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +0 -133
- package/examples/jsm/renderers/nodes/display/NormalMapNode.js +0 -87
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +0 -122
- package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +0 -27
- package/examples/jsm/renderers/nodes/inputs/BufferNode.js +0 -25
- package/examples/jsm/renderers/nodes/inputs/ColorNode.js +0 -18
- package/examples/jsm/renderers/nodes/inputs/FloatNode.js +0 -17
- package/examples/jsm/renderers/nodes/inputs/IntNode.js +0 -17
- package/examples/jsm/renderers/nodes/inputs/Matrix3Node.js +0 -18
- package/examples/jsm/renderers/nodes/inputs/Matrix4Node.js +0 -18
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +0 -79
- package/examples/jsm/renderers/nodes/inputs/Vector2Node.js +0 -18
- package/examples/jsm/renderers/nodes/inputs/Vector3Node.js +0 -18
- package/examples/jsm/renderers/nodes/inputs/Vector4Node.js +0 -18
- package/examples/jsm/renderers/nodes/lights/LightContextNode.js +0 -59
- package/examples/jsm/renderers/nodes/lights/LightNode.js +0 -79
- package/examples/jsm/renderers/nodes/lights/LightsNode.js +0 -44
- package/examples/jsm/renderers/nodes/materials/Materials.js +0 -11
- package/examples/jsm/renderers/nodes/materials/MeshStandardNodeMaterial.js +0 -63
- package/examples/jsm/renderers/nodes/math/CondNode.js +0 -60
- package/examples/jsm/renderers/nodes/math/MathNode.js +0 -241
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +0 -174
- package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +0 -36
- package/examples/jsm/renderers/nodes/utils/JoinNode.js +0 -42
- package/examples/jsm/renderers/nodes/utils/TimerNode.js +0 -47
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +0 -20
- package/examples/jsm/shaders/SSRrShader.js +0 -307
- package/examples/jsm/utils/RoughnessMipmapper.js +0 -288
- 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:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
|
|
261
|
+
return mix(
|
|
262
|
+
rgbaM,
|
|
263
|
+
rgbaN,
|
|
264
|
+
dist * .5
|
|
265
|
+
);
|
|
266
|
+
}
|
|
550
267
|
|
|
551
|
-
|
|
552
|
-
|
|
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
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
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
|
-
|
|
1110
|
-
|
|
1111
|
-
}`
|
|
280
|
+
}
|
|
281
|
+
`
|
|
1112
282
|
};
|
|
1113
283
|
|
|
1114
284
|
THREE.FXAAShader = FXAAShader;
|