@driftengine/core 3.61.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 +202 -0
- package/NOTICE +9 -0
- package/README.md +9 -0
- package/dist/behavior/behaviorTree.d.ts +140 -0
- package/dist/behavior/behaviorTree.js +289 -0
- package/dist/build/shaderComments.d.ts +64 -0
- package/dist/build/shaderComments.js +0 -0
- package/dist/cinematic/player.d.ts +80 -0
- package/dist/cinematic/player.js +184 -0
- package/dist/cinematic/script.d.ts +63 -0
- package/dist/cinematic/script.js +141 -0
- package/dist/core/bootGate.d.ts +37 -0
- package/dist/core/bootGate.js +47 -0
- package/dist/core/loadTracker.d.ts +78 -0
- package/dist/core/loadTracker.js +106 -0
- package/dist/core/loop.d.ts +118 -0
- package/dist/core/loop.js +84 -0
- package/dist/core/messageQueue.d.ts +61 -0
- package/dist/core/messageQueue.js +104 -0
- package/dist/core/onceSet.d.ts +27 -0
- package/dist/core/onceSet.js +62 -0
- package/dist/core/preferences.d.ts +47 -0
- package/dist/core/preferences.js +140 -0
- package/dist/core/remoteSave.d.ts +154 -0
- package/dist/core/remoteSave.js +249 -0
- package/dist/core/rng.d.ts +64 -0
- package/dist/core/rng.js +72 -0
- package/dist/core/stepBudget.d.ts +91 -0
- package/dist/core/stepBudget.js +105 -0
- package/dist/core/storage.d.ts +52 -0
- package/dist/core/storage.js +85 -0
- package/dist/core/tickTrace.d.ts +72 -0
- package/dist/core/tickTrace.js +102 -0
- package/dist/core/timeCurve.d.ts +83 -0
- package/dist/core/timeCurve.js +107 -0
- package/dist/core/withDefaults.d.ts +21 -0
- package/dist/core/withDefaults.js +29 -0
- package/dist/dev/contactProbe.d.ts +41 -0
- package/dist/dev/contactProbe.js +58 -0
- package/dist/dev/fpsMeter.d.ts +45 -0
- package/dist/dev/fpsMeter.js +86 -0
- package/dist/environment/celestialClock.d.ts +141 -0
- package/dist/environment/celestialClock.js +262 -0
- package/dist/geometry/decal.d.ts +61 -0
- package/dist/geometry/decal.js +178 -0
- package/dist/geometry/filmPatch.d.ts +35 -0
- package/dist/geometry/filmPatch.js +112 -0
- package/dist/geometry/growable.d.ts +70 -0
- package/dist/geometry/growable.js +167 -0
- package/dist/geometry/lightVolume.d.ts +76 -0
- package/dist/geometry/lightVolume.js +65 -0
- package/dist/geometry/meshBuilder.d.ts +426 -0
- package/dist/geometry/meshBuilder.js +1184 -0
- package/dist/geometry/pixelFont.d.ts +59 -0
- package/dist/geometry/pixelFont.js +179 -0
- package/dist/geometry/ribbon.d.ts +101 -0
- package/dist/geometry/ribbon.js +546 -0
- package/dist/geometry/shellFill.d.ts +101 -0
- package/dist/geometry/shellFill.js +203 -0
- package/dist/geometry/spline.d.ts +162 -0
- package/dist/geometry/spline.js +527 -0
- package/dist/geometry/tangents.d.ts +30 -0
- package/dist/geometry/tangents.js +142 -0
- package/dist/geometry/textMesh.d.ts +51 -0
- package/dist/geometry/textMesh.js +57 -0
- package/dist/geometry/treeBuilder.d.ts +37 -0
- package/dist/geometry/treeBuilder.js +56 -0
- package/dist/host/display.d.ts +135 -0
- package/dist/host/display.js +114 -0
- package/dist/host/files.d.ts +25 -0
- package/dist/host/files.js +44 -0
- package/dist/host/lifecycle.d.ts +45 -0
- package/dist/host/lifecycle.js +28 -0
- package/dist/host/platformServices.d.ts +23 -0
- package/dist/host/platformServices.js +1 -0
- package/dist/host/screen.d.ts +49 -0
- package/dist/host/screen.js +90 -0
- package/dist/index.d.ts +289 -0
- package/dist/index.js +320 -0
- package/dist/input/actionMap.d.ts +181 -0
- package/dist/input/actionMap.js +314 -0
- package/dist/input/activeDevice.d.ts +55 -0
- package/dist/input/activeDevice.js +83 -0
- package/dist/input/gamepadIdentity.d.ts +43 -0
- package/dist/input/gamepadIdentity.js +108 -0
- package/dist/input/gamepadMapping.d.ts +56 -0
- package/dist/input/gamepadMapping.js +91 -0
- package/dist/input/input.d.ts +281 -0
- package/dist/input/input.js +703 -0
- package/dist/input/inputHarness.d.ts +42 -0
- package/dist/input/inputHarness.js +193 -0
- package/dist/input/rightGesture.d.ts +57 -0
- package/dist/input/rightGesture.js +49 -0
- package/dist/input/rumble.d.ts +71 -0
- package/dist/input/rumble.js +119 -0
- package/dist/input/touchControls.d.ts +138 -0
- package/dist/input/touchControls.js +352 -0
- package/dist/input/typingTarget.d.ts +6 -0
- package/dist/input/typingTarget.js +27 -0
- package/dist/math/bounds.d.ts +61 -0
- package/dist/math/bounds.js +121 -0
- package/dist/math/color.d.ts +8 -0
- package/dist/math/color.js +35 -0
- package/dist/math/exact.d.ts +66 -0
- package/dist/math/exact.js +262 -0
- package/dist/math/frustum.d.ts +44 -0
- package/dist/math/frustum.js +90 -0
- package/dist/math/intersect.d.ts +76 -0
- package/dist/math/intersect.js +185 -0
- package/dist/math/scalar.d.ts +51 -0
- package/dist/math/scalar.js +99 -0
- package/dist/math/spring.d.ts +59 -0
- package/dist/math/spring.js +88 -0
- package/dist/nav/navGraph.d.ts +71 -0
- package/dist/nav/navGraph.js +111 -0
- package/dist/nav/navPath.d.ts +93 -0
- package/dist/nav/navPath.js +162 -0
- package/dist/nav/navSearch.d.ts +74 -0
- package/dist/nav/navSearch.js +198 -0
- package/dist/physics/boxSurface.d.ts +48 -0
- package/dist/physics/boxSurface.js +73 -0
- package/dist/physics/colliderSurface.d.ts +46 -0
- package/dist/physics/colliderSurface.js +146 -0
- package/dist/physics/compositeSurface.d.ts +33 -0
- package/dist/physics/compositeSurface.js +108 -0
- package/dist/physics/heightSurface.d.ts +103 -0
- package/dist/physics/heightSurface.js +153 -0
- package/dist/physics/ribbonSurface.d.ts +239 -0
- package/dist/physics/ribbonSurface.js +522 -0
- package/dist/render/ambientOcclusionPass.d.ts +53 -0
- package/dist/render/ambientOcclusionPass.js +179 -0
- package/dist/render/areaLights.d.ts +116 -0
- package/dist/render/areaLights.js +91 -0
- package/dist/render/areaShadowSet.d.ts +184 -0
- package/dist/render/areaShadowSet.js +277 -0
- package/dist/render/atmosphere.d.ts +94 -0
- package/dist/render/atmosphere.js +91 -0
- package/dist/render/backend/api.d.ts +496 -0
- package/dist/render/backend/api.js +1 -0
- package/dist/render/backend/budget.d.ts +82 -0
- package/dist/render/backend/budget.js +99 -0
- package/dist/render/backend/createRenderer.d.ts +135 -0
- package/dist/render/backend/createRenderer.js +201 -0
- package/dist/render/backend/deadline.d.ts +24 -0
- package/dist/render/backend/deadline.js +38 -0
- package/dist/render/backend/probe.d.ts +30 -0
- package/dist/render/backend/probe.js +129 -0
- package/dist/render/backend/select.d.ts +70 -0
- package/dist/render/backend/select.js +249 -0
- package/dist/render/backend/timer.d.ts +50 -0
- package/dist/render/backend/timer.js +1 -0
- package/dist/render/backend/webgl2/instanced.d.ts +21 -0
- package/dist/render/backend/webgl2/instanced.js +42 -0
- package/dist/render/backend/webgl2/morphTexture.d.ts +21 -0
- package/dist/render/backend/webgl2/morphTexture.js +55 -0
- package/dist/render/backend/webgl2/renderer.d.ts +3027 -0
- package/dist/render/backend/webgl2/renderer.js +6041 -0
- package/dist/render/backend/webgl2/skinPaletteTexture.d.ts +32 -0
- package/dist/render/backend/webgl2/skinPaletteTexture.js +68 -0
- package/dist/render/backend/webgpu/boltPass.d.ts +42 -0
- package/dist/render/backend/webgpu/boltPass.js +160 -0
- package/dist/render/backend/webgpu/buffers.d.ts +159 -0
- package/dist/render/backend/webgpu/buffers.js +402 -0
- package/dist/render/backend/webgpu/causticsPass.d.ts +36 -0
- package/dist/render/backend/webgpu/causticsPass.js +138 -0
- package/dist/render/backend/webgpu/clusterBinner.d.ts +51 -0
- package/dist/render/backend/webgpu/clusterBinner.js +206 -0
- package/dist/render/backend/webgpu/depthPass.d.ts +114 -0
- package/dist/render/backend/webgpu/depthPass.js +228 -0
- package/dist/render/backend/webgpu/device.d.ts +52 -0
- package/dist/render/backend/webgpu/device.js +121 -0
- package/dist/render/backend/webgpu/drawCommand.d.ts +43 -0
- package/dist/render/backend/webgpu/drawCommand.js +54 -0
- package/dist/render/backend/webgpu/environmentTexels.d.ts +28 -0
- package/dist/render/backend/webgpu/environmentTexels.js +79 -0
- package/dist/render/backend/webgpu/filmPass.d.ts +29 -0
- package/dist/render/backend/webgpu/filmPass.js +97 -0
- package/dist/render/backend/webgpu/flatPass.d.ts +213 -0
- package/dist/render/backend/webgpu/flatPass.js +482 -0
- package/dist/render/backend/webgpu/flockPass.d.ts +34 -0
- package/dist/render/backend/webgpu/flockPass.js +129 -0
- package/dist/render/backend/webgpu/gpuTimestamps.d.ts +94 -0
- package/dist/render/backend/webgpu/gpuTimestamps.js +213 -0
- package/dist/render/backend/webgpu/insetPass.d.ts +19 -0
- package/dist/render/backend/webgpu/insetPass.js +108 -0
- package/dist/render/backend/webgpu/instanced.d.ts +27 -0
- package/dist/render/backend/webgpu/instanced.js +49 -0
- package/dist/render/backend/webgpu/lightVolumePass.d.ts +75 -0
- package/dist/render/backend/webgpu/lightVolumePass.js +154 -0
- package/dist/render/backend/webgpu/linePass.d.ts +90 -0
- package/dist/render/backend/webgpu/linePass.js +220 -0
- package/dist/render/backend/webgpu/morphTexture.d.ts +18 -0
- package/dist/render/backend/webgpu/morphTexture.js +51 -0
- package/dist/render/backend/webgpu/panelPass.d.ts +37 -0
- package/dist/render/backend/webgpu/panelPass.js +114 -0
- package/dist/render/backend/webgpu/particlePass.d.ts +89 -0
- package/dist/render/backend/webgpu/particlePass.js +280 -0
- package/dist/render/backend/webgpu/pipelineCache.d.ts +93 -0
- package/dist/render/backend/webgpu/pipelineCache.js +140 -0
- package/dist/render/backend/webgpu/plumePass.d.ts +69 -0
- package/dist/render/backend/webgpu/plumePass.js +213 -0
- package/dist/render/backend/webgpu/pointShadowPass.d.ts +88 -0
- package/dist/render/backend/webgpu/pointShadowPass.js +280 -0
- package/dist/render/backend/webgpu/postPass.d.ts +342 -0
- package/dist/render/backend/webgpu/postPass.js +366 -0
- package/dist/render/backend/webgpu/probePass.d.ts +108 -0
- package/dist/render/backend/webgpu/probePass.js +188 -0
- package/dist/render/backend/webgpu/reflectionPass.d.ts +29 -0
- package/dist/render/backend/webgpu/reflectionPass.js +87 -0
- package/dist/render/backend/webgpu/renderer.d.ts +3082 -0
- package/dist/render/backend/webgpu/renderer.js +10911 -0
- package/dist/render/backend/webgpu/scatterPass.d.ts +95 -0
- package/dist/render/backend/webgpu/scatterPass.js +266 -0
- package/dist/render/backend/webgpu/sdfTextPass.d.ts +86 -0
- package/dist/render/backend/webgpu/sdfTextPass.js +190 -0
- package/dist/render/backend/webgpu/shaderModules.d.ts +9 -0
- package/dist/render/backend/webgpu/shaderModules.js +45 -0
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +23 -0
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.js +208 -0
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +67 -0
- package/dist/render/backend/webgpu/skinPaletteRing.js +97 -0
- package/dist/render/backend/webgpu/skinPaletteTexture.d.ts +17 -0
- package/dist/render/backend/webgpu/skinPaletteTexture.js +68 -0
- package/dist/render/backend/webgpu/skyPass.d.ts +102 -0
- package/dist/render/backend/webgpu/skyPass.js +70 -0
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +41 -0
- package/dist/render/backend/webgpu/surfaceTexturePass.js +228 -0
- package/dist/render/backend/webgpu/textPass.d.ts +73 -0
- package/dist/render/backend/webgpu/textPass.js +190 -0
- package/dist/render/backend/webgpu/uniformRing.d.ts +133 -0
- package/dist/render/backend/webgpu/uniformRing.js +208 -0
- package/dist/render/backend/webgpu/waterPass.d.ts +73 -0
- package/dist/render/backend/webgpu/waterPass.js +160 -0
- package/dist/render/backend/webgpu/windStreakPass.d.ts +46 -0
- package/dist/render/backend/webgpu/windStreakPass.js +153 -0
- package/dist/render/billboard.d.ts +27 -0
- package/dist/render/billboard.js +79 -0
- package/dist/render/bloomChain.d.ts +66 -0
- package/dist/render/bloomChain.js +83 -0
- package/dist/render/bloomPass.d.ts +54 -0
- package/dist/render/bloomPass.js +219 -0
- package/dist/render/boltBatch.d.ts +39 -0
- package/dist/render/boltBatch.js +121 -0
- package/dist/render/boltPool.d.ts +135 -0
- package/dist/render/boltPool.js +259 -0
- package/dist/render/boom.d.ts +46 -0
- package/dist/render/boom.js +81 -0
- package/dist/render/camera.d.ts +119 -0
- package/dist/render/camera.js +304 -0
- package/dist/render/causticsRenderer.d.ts +63 -0
- package/dist/render/causticsRenderer.js +119 -0
- package/dist/render/cinematicCamera.d.ts +102 -0
- package/dist/render/cinematicCamera.js +227 -0
- package/dist/render/clusteredLights.d.ts +260 -0
- package/dist/render/clusteredLights.js +479 -0
- package/dist/render/colourGrade.d.ts +62 -0
- package/dist/render/colourGrade.js +91 -0
- package/dist/render/compute.d.ts +74 -0
- package/dist/render/compute.js +8 -0
- package/dist/render/contextLoss.d.ts +32 -0
- package/dist/render/contextLoss.js +46 -0
- package/dist/render/debugLines.d.ts +75 -0
- package/dist/render/debugLines.js +281 -0
- package/dist/render/decalPass.d.ts +34 -0
- package/dist/render/decalPass.js +103 -0
- package/dist/render/decalProjector.d.ts +140 -0
- package/dist/render/decalProjector.js +282 -0
- package/dist/render/decalQueue.d.ts +53 -0
- package/dist/render/decalQueue.js +87 -0
- package/dist/render/depthConvention.d.ts +314 -0
- package/dist/render/depthConvention.js +346 -0
- package/dist/render/drawingBuffer.d.ts +52 -0
- package/dist/render/drawingBuffer.js +67 -0
- package/dist/render/emptyTexture.d.ts +60 -0
- package/dist/render/emptyTexture.js +103 -0
- package/dist/render/envProbeArray.d.ts +85 -0
- package/dist/render/envProbeArray.js +164 -0
- package/dist/render/equirectToCube.d.ts +54 -0
- package/dist/render/equirectToCube.js +123 -0
- package/dist/render/flockGeometry.d.ts +23 -0
- package/dist/render/flockGeometry.js +43 -0
- package/dist/render/flockRenderer.d.ts +37 -0
- package/dist/render/flockRenderer.js +70 -0
- package/dist/render/frame/arena.d.ts +32 -0
- package/dist/render/frame/arena.js +65 -0
- package/dist/render/frame/index.d.ts +18 -0
- package/dist/render/frame/index.js +4 -0
- package/dist/render/frame/replay.d.ts +34 -0
- package/dist/render/frame/replay.js +48 -0
- package/dist/render/frame/resources.d.ts +25 -0
- package/dist/render/frame/resources.js +55 -0
- package/dist/render/frame/schedule.d.ts +37 -0
- package/dist/render/frame/schedule.js +61 -0
- package/dist/render/frameView.d.ts +19 -0
- package/dist/render/frameView.js +1 -0
- package/dist/render/gizmo.d.ts +236 -0
- package/dist/render/gizmo.js +727 -0
- package/dist/render/globalMedium.d.ts +124 -0
- package/dist/render/globalMedium.js +100 -0
- package/dist/render/globalMediumPass.d.ts +101 -0
- package/dist/render/globalMediumPass.js +250 -0
- package/dist/render/gpuCapability.d.ts +111 -0
- package/dist/render/gpuCapability.js +194 -0
- package/dist/render/gpuTimer.d.ts +87 -0
- package/dist/render/gpuTimer.js +145 -0
- package/dist/render/halfFloat.d.ts +4 -0
- package/dist/render/halfFloat.js +38 -0
- package/dist/render/handleRegistry.d.ts +54 -0
- package/dist/render/handleRegistry.js +84 -0
- package/dist/render/iesProfile.d.ts +64 -0
- package/dist/render/iesProfile.js +179 -0
- package/dist/render/imageTexels.d.ts +50 -0
- package/dist/render/imageTexels.js +91 -0
- package/dist/render/instancedMesh.d.ts +48 -0
- package/dist/render/instancedMesh.js +127 -0
- package/dist/render/instances.d.ts +69 -0
- package/dist/render/instances.js +52 -0
- package/dist/render/lightBudget.d.ts +397 -0
- package/dist/render/lightBudget.js +524 -0
- package/dist/render/lightMatrix.d.ts +3 -0
- package/dist/render/lightMatrix.js +45 -0
- package/dist/render/lightVolumeDraw.d.ts +132 -0
- package/dist/render/lightVolumeDraw.js +181 -0
- package/dist/render/lineBatch.d.ts +60 -0
- package/dist/render/lineBatch.js +160 -0
- package/dist/render/linePoints.d.ts +33 -0
- package/dist/render/linePoints.js +46 -0
- package/dist/render/livePointShadowSet.d.ts +72 -0
- package/dist/render/livePointShadowSet.js +258 -0
- package/dist/render/lod.d.ts +35 -0
- package/dist/render/lod.js +65 -0
- package/dist/render/mesh.d.ts +177 -0
- package/dist/render/mesh.js +466 -0
- package/dist/render/occlusion.d.ts +81 -0
- package/dist/render/occlusion.js +378 -0
- package/dist/render/oitPass.d.ts +67 -0
- package/dist/render/oitPass.js +213 -0
- package/dist/render/orderIndependent.d.ts +92 -0
- package/dist/render/orderIndependent.js +108 -0
- package/dist/render/particleBatch.d.ts +140 -0
- package/dist/render/particleBatch.js +186 -0
- package/dist/render/particleMaterial.d.ts +54 -0
- package/dist/render/particleMaterial.js +42 -0
- package/dist/render/particlePool.d.ts +124 -0
- package/dist/render/particlePool.js +182 -0
- package/dist/render/pass.d.ts +195 -0
- package/dist/render/pass.js +9 -0
- package/dist/render/passTarget.d.ts +86 -0
- package/dist/render/passTarget.js +121 -0
- package/dist/render/pickable.d.ts +31 -0
- package/dist/render/pickable.js +172 -0
- package/dist/render/planarReflection.d.ts +59 -0
- package/dist/render/planarReflection.js +194 -0
- package/dist/render/planarReflectionDraw.d.ts +31 -0
- package/dist/render/planarReflectionDraw.js +65 -0
- package/dist/render/plumeGeometry.d.ts +25 -0
- package/dist/render/plumeGeometry.js +61 -0
- package/dist/render/plumeMaterial.d.ts +31 -0
- package/dist/render/plumeMaterial.js +64 -0
- package/dist/render/plumeRenderer.d.ts +96 -0
- package/dist/render/plumeRenderer.js +185 -0
- package/dist/render/pointLightSelection.d.ts +175 -0
- package/dist/render/pointLightSelection.js +301 -0
- package/dist/render/pointShadowArray.d.ts +95 -0
- package/dist/render/pointShadowArray.js +219 -0
- package/dist/render/pointShadowBudget.d.ts +118 -0
- package/dist/render/pointShadowBudget.js +221 -0
- package/dist/render/pointShadowImage.d.ts +265 -0
- package/dist/render/pointShadowImage.js +339 -0
- package/dist/render/pointShadowMap.d.ts +93 -0
- package/dist/render/pointShadowMap.js +167 -0
- package/dist/render/pointShadowSystem.d.ts +195 -0
- package/dist/render/pointShadowSystem.js +336 -0
- package/dist/render/prefilterEnvMap.d.ts +124 -0
- package/dist/render/prefilterEnvMap.js +146 -0
- package/dist/render/prefilterPass.d.ts +44 -0
- package/dist/render/prefilterPass.js +98 -0
- package/dist/render/probeGrid.d.ts +122 -0
- package/dist/render/probeGrid.js +174 -0
- package/dist/render/rainField.d.ts +99 -0
- package/dist/render/rainField.js +168 -0
- package/dist/render/reflectionProbe.d.ts +188 -0
- package/dist/render/reflectionProbe.js +437 -0
- package/dist/render/renderQuality.d.ts +699 -0
- package/dist/render/renderQuality.js +293 -0
- package/dist/render/rendererHarness.d.ts +39 -0
- package/dist/render/rendererHarness.js +185 -0
- package/dist/render/resolutionGovernor.d.ts +107 -0
- package/dist/render/resolutionGovernor.js +144 -0
- package/dist/render/scatterDeform.d.ts +17 -0
- package/dist/render/scatterDeform.js +46 -0
- package/dist/render/sceneTarget.d.ts +288 -0
- package/dist/render/sceneTarget.js +856 -0
- package/dist/render/screenSpaceReflection.d.ts +233 -0
- package/dist/render/screenSpaceReflection.js +415 -0
- package/dist/render/sdfFont.d.ts +77 -0
- package/dist/render/sdfFont.js +86 -0
- package/dist/render/sdfTextLayout.d.ts +46 -0
- package/dist/render/sdfTextLayout.js +145 -0
- package/dist/render/sdfTextRenderer.d.ts +75 -0
- package/dist/render/sdfTextRenderer.js +194 -0
- package/dist/render/seaState.d.ts +25 -0
- package/dist/render/seaState.js +34 -0
- package/dist/render/segmentQuads.d.ts +29 -0
- package/dist/render/segmentQuads.js +75 -0
- package/dist/render/shader.d.ts +5 -0
- package/dist/render/shader.js +172 -0
- package/dist/render/shaders/ambientOcclusion.d.ts +45 -0
- package/dist/render/shaders/ambientOcclusion.js +352 -0
- package/dist/render/shaders/arcane.d.ts +19 -0
- package/dist/render/shaders/arcane.js +102 -0
- package/dist/render/shaders/bloom.d.ts +70 -0
- package/dist/render/shaders/bloom.js +227 -0
- package/dist/render/shaders/bolt.d.ts +17 -0
- package/dist/render/shaders/bolt.js +161 -0
- package/dist/render/shaders/caustics.d.ts +38 -0
- package/dist/render/shaders/caustics.js +167 -0
- package/dist/render/shaders/conditionals.d.ts +21 -0
- package/dist/render/shaders/conditionals.js +55 -0
- package/dist/render/shaders/decalProject.d.ts +25 -0
- package/dist/render/shaders/decalProject.js +125 -0
- package/dist/render/shaders/depth.d.ts +14 -0
- package/dist/render/shaders/depth.js +114 -0
- package/dist/render/shaders/depthOfField.d.ts +41 -0
- package/dist/render/shaders/depthOfField.js +139 -0
- package/dist/render/shaders/film.d.ts +15 -0
- package/dist/render/shaders/film.js +283 -0
- package/dist/render/shaders/fire.d.ts +12 -0
- package/dist/render/shaders/fire.js +178 -0
- package/dist/render/shaders/flat/directionalShadow.d.ts +1 -0
- package/dist/render/shaders/flat/directionalShadow.js +195 -0
- package/dist/render/shaders/flat/index.d.ts +135 -0
- package/dist/render/shaders/flat/index.js +387 -0
- package/dist/render/shaders/flat/lobes.d.ts +1 -0
- package/dist/render/shaders/flat/lobes.js +398 -0
- package/dist/render/shaders/flat/main.d.ts +2 -0
- package/dist/render/shaders/flat/main.js +1630 -0
- package/dist/render/shaders/flat/pointShadow.d.ts +1 -0
- package/dist/render/shaders/flat/pointShadow.js +322 -0
- package/dist/render/shaders/flat/preamble.d.ts +15 -0
- package/dist/render/shaders/flat/preamble.js +864 -0
- package/dist/render/shaders/flat/probeGrid.d.ts +21 -0
- package/dist/render/shaders/flat/probeGrid.js +151 -0
- package/dist/render/shaders/flat/surface.d.ts +2 -0
- package/dist/render/shaders/flat/surface.js +40 -0
- package/dist/render/shaders/flock.d.ts +11 -0
- package/dist/render/shaders/flock.js +102 -0
- package/dist/render/shaders/fog.d.ts +37 -0
- package/dist/render/shaders/fog.js +98 -0
- package/dist/render/shaders/fullscreen.d.ts +16 -0
- package/dist/render/shaders/fullscreen.js +27 -0
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.d.ts +65 -0
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.js +71 -0
- package/dist/render/shaders/generated/arcane.wgsl.d.ts +90 -0
- package/dist/render/shaders/generated/arcane.wgsl.js +96 -0
- package/dist/render/shaders/generated/bloom.wgsl.d.ts +69 -0
- package/dist/render/shaders/generated/bloom.wgsl.js +75 -0
- package/dist/render/shaders/generated/bolt.wgsl.d.ts +118 -0
- package/dist/render/shaders/generated/bolt.wgsl.js +124 -0
- package/dist/render/shaders/generated/caustics.wgsl.d.ts +118 -0
- package/dist/render/shaders/generated/caustics.wgsl.js +124 -0
- package/dist/render/shaders/generated/decalProject.wgsl.d.ts +61 -0
- package/dist/render/shaders/generated/decalProject.wgsl.js +67 -0
- package/dist/render/shaders/generated/depth.wgsl.d.ts +131 -0
- package/dist/render/shaders/generated/depth.wgsl.js +137 -0
- package/dist/render/shaders/generated/film.wgsl.d.ts +134 -0
- package/dist/render/shaders/generated/film.wgsl.js +140 -0
- package/dist/render/shaders/generated/fire.wgsl.d.ts +128 -0
- package/dist/render/shaders/generated/fire.wgsl.js +134 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +9163 -0
- package/dist/render/shaders/generated/flat.wgsl.js +9192 -0
- package/dist/render/shaders/generated/flock.wgsl.d.ts +73 -0
- package/dist/render/shaders/generated/flock.wgsl.js +79 -0
- package/dist/render/shaders/generated/fullscreen.wgsl.d.ts +12 -0
- package/dist/render/shaders/generated/fullscreen.wgsl.js +18 -0
- package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +130 -0
- package/dist/render/shaders/generated/globalMedium.wgsl.js +136 -0
- package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +230 -0
- package/dist/render/shaders/generated/lightVolume.wgsl.js +239 -0
- package/dist/render/shaders/generated/line.wgsl.d.ts +128 -0
- package/dist/render/shaders/generated/line.wgsl.js +134 -0
- package/dist/render/shaders/generated/octahedralResolve.wgsl.d.ts +51 -0
- package/dist/render/shaders/generated/octahedralResolve.wgsl.js +57 -0
- package/dist/render/shaders/generated/oitResolve.wgsl.d.ts +23 -0
- package/dist/render/shaders/generated/oitResolve.wgsl.js +29 -0
- package/dist/render/shaders/generated/panel.wgsl.d.ts +48 -0
- package/dist/render/shaders/generated/panel.wgsl.js +54 -0
- package/dist/render/shaders/generated/particle.wgsl.d.ts +332 -0
- package/dist/render/shaders/generated/particle.wgsl.js +338 -0
- package/dist/render/shaders/generated/prefilter.wgsl.d.ts +61 -0
- package/dist/render/shaders/generated/prefilter.wgsl.js +67 -0
- package/dist/render/shaders/generated/rush.wgsl.d.ts +131 -0
- package/dist/render/shaders/generated/rush.wgsl.js +137 -0
- package/dist/render/shaders/generated/scatter.wgsl.d.ts +195 -0
- package/dist/render/shaders/generated/scatter.wgsl.js +201 -0
- package/dist/render/shaders/generated/sdfText.wgsl.d.ts +69 -0
- package/dist/render/shaders/generated/sdfText.wgsl.js +75 -0
- package/dist/render/shaders/generated/sky.wgsl.d.ts +100 -0
- package/dist/render/shaders/generated/sky.wgsl.js +106 -0
- package/dist/render/shaders/generated/smoke.wgsl.d.ts +85 -0
- package/dist/render/shaders/generated/smoke.wgsl.js +91 -0
- package/dist/render/shaders/generated/ssrResolve.wgsl.d.ts +18 -0
- package/dist/render/shaders/generated/ssrResolve.wgsl.js +24 -0
- package/dist/render/shaders/generated/ssrTrace.wgsl.d.ts +86 -0
- package/dist/render/shaders/generated/ssrTrace.wgsl.js +92 -0
- package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +46 -0
- package/dist/render/shaders/generated/temporalResolve.wgsl.js +52 -0
- package/dist/render/shaders/generated/text.wgsl.d.ts +98 -0
- package/dist/render/shaders/generated/text.wgsl.js +104 -0
- package/dist/render/shaders/generated/water.wgsl.d.ts +247 -0
- package/dist/render/shaders/generated/water.wgsl.js +253 -0
- package/dist/render/shaders/generated/windStreaks.wgsl.d.ts +73 -0
- package/dist/render/shaders/generated/windStreaks.wgsl.js +79 -0
- package/dist/render/shaders/gerstner.d.ts +21 -0
- package/dist/render/shaders/gerstner.js +110 -0
- package/dist/render/shaders/globalMedium.d.ts +56 -0
- package/dist/render/shaders/globalMedium.js +393 -0
- package/dist/render/shaders/lightVolume.d.ts +61 -0
- package/dist/render/shaders/lightVolume.js +527 -0
- package/dist/render/shaders/line.d.ts +18 -0
- package/dist/render/shaders/line.js +122 -0
- package/dist/render/shaders/morph.d.ts +26 -0
- package/dist/render/shaders/morph.js +61 -0
- package/dist/render/shaders/octahedral.d.ts +76 -0
- package/dist/render/shaders/octahedral.js +161 -0
- package/dist/render/shaders/octahedralResolve.d.ts +25 -0
- package/dist/render/shaders/octahedralResolve.js +81 -0
- package/dist/render/shaders/oitResolve.d.ts +17 -0
- package/dist/render/shaders/oitResolve.js +42 -0
- package/dist/render/shaders/outputTransform.d.ts +37 -0
- package/dist/render/shaders/outputTransform.js +106 -0
- package/dist/render/shaders/panel.d.ts +17 -0
- package/dist/render/shaders/panel.js +50 -0
- package/dist/render/shaders/particle.d.ts +82 -0
- package/dist/render/shaders/particle.js +431 -0
- package/dist/render/shaders/prefilter.d.ts +37 -0
- package/dist/render/shaders/prefilter.js +276 -0
- package/dist/render/shaders/rush.d.ts +21 -0
- package/dist/render/shaders/rush.js +355 -0
- package/dist/render/shaders/scatter.d.ts +14 -0
- package/dist/render/shaders/scatter.js +206 -0
- package/dist/render/shaders/sdfText.d.ts +9 -0
- package/dist/render/shaders/sdfText.js +65 -0
- package/dist/render/shaders/skinning.d.ts +17 -0
- package/dist/render/shaders/skinning.js +59 -0
- package/dist/render/shaders/sky.d.ts +10 -0
- package/dist/render/shaders/sky.js +242 -0
- package/dist/render/shaders/smoke.d.ts +8 -0
- package/dist/render/shaders/smoke.js +88 -0
- package/dist/render/shaders/ssrResolve.d.ts +15 -0
- package/dist/render/shaders/ssrResolve.js +28 -0
- package/dist/render/shaders/ssrTrace.d.ts +22 -0
- package/dist/render/shaders/ssrTrace.js +230 -0
- package/dist/render/shaders/tangentFrame.d.ts +17 -0
- package/dist/render/shaders/tangentFrame.js +70 -0
- package/dist/render/shaders/temporalResolve.d.ts +1 -0
- package/dist/render/shaders/temporalResolve.js +150 -0
- package/dist/render/shaders/text.d.ts +17 -0
- package/dist/render/shaders/text.js +155 -0
- package/dist/render/shaders/vertexChannel.d.ts +39 -0
- package/dist/render/shaders/vertexChannel.js +69 -0
- package/dist/render/shaders/water.d.ts +18 -0
- package/dist/render/shaders/water.js +354 -0
- package/dist/render/shaders/windStreaks.d.ts +14 -0
- package/dist/render/shaders/windStreaks.js +129 -0
- package/dist/render/shadowCasters.d.ts +107 -0
- package/dist/render/shadowCasters.js +1 -0
- package/dist/render/shadowMap.d.ts +10 -0
- package/dist/render/shadowMap.js +80 -0
- package/dist/render/shotPlacement.d.ts +80 -0
- package/dist/render/shotPlacement.js +183 -0
- package/dist/render/skinPalette.d.ts +90 -0
- package/dist/render/skinPalette.js +136 -0
- package/dist/render/ssrPass.d.ts +59 -0
- package/dist/render/ssrPass.js +196 -0
- package/dist/render/surfaceSheet.d.ts +52 -0
- package/dist/render/surfaceSheet.js +99 -0
- package/dist/render/surfaceTexture.d.ts +197 -0
- package/dist/render/surfaceTexture.js +116 -0
- package/dist/render/temporalAa.d.ts +104 -0
- package/dist/render/temporalAa.js +194 -0
- package/dist/render/temporalPass.d.ts +54 -0
- package/dist/render/temporalPass.js +135 -0
- package/dist/render/textLayout.d.ts +88 -0
- package/dist/render/textLayout.js +201 -0
- package/dist/render/textRenderer.d.ts +32 -0
- package/dist/render/textRenderer.js +176 -0
- package/dist/render/thirdPersonCamera.d.ts +272 -0
- package/dist/render/thirdPersonCamera.js +479 -0
- package/dist/render/trample.d.ts +57 -0
- package/dist/render/trample.js +134 -0
- package/dist/render/translucentQueue.d.ts +76 -0
- package/dist/render/translucentQueue.js +90 -0
- package/dist/render/uniformVectorBudget.d.ts +105 -0
- package/dist/render/uniformVectorBudget.js +201 -0
- package/dist/render/uploadStep.d.ts +14 -0
- package/dist/render/uploadStep.js +14 -0
- package/dist/render/vertexDefaults.d.ts +48 -0
- package/dist/render/vertexDefaults.js +111 -0
- package/dist/render/visibility.d.ts +22 -0
- package/dist/render/visibility.js +47 -0
- package/dist/render/waterDraw.d.ts +57 -0
- package/dist/render/waterDraw.js +102 -0
- package/dist/render/waterGrid.d.ts +62 -0
- package/dist/render/waterGrid.js +151 -0
- package/dist/render/waterRenderer.d.ts +163 -0
- package/dist/render/waterRenderer.js +165 -0
- package/dist/render/wind.d.ts +45 -0
- package/dist/render/wind.js +32 -0
- package/dist/render/windField.d.ts +34 -0
- package/dist/render/windField.js +13 -0
- package/dist/render/windStreakDraw.d.ts +73 -0
- package/dist/render/windStreakDraw.js +86 -0
- package/dist/render/windStreakRenderer.d.ts +37 -0
- package/dist/render/windStreakRenderer.js +86 -0
- package/dist/scene/node.d.ts +128 -0
- package/dist/scene/node.js +319 -0
- package/dist/scene/visit.d.ts +38 -0
- package/dist/scene/visit.js +43 -0
- package/dist/ui/clipMime.d.ts +46 -0
- package/dist/ui/clipMime.js +88 -0
- package/dist/ui/exportTarget.d.ts +305 -0
- package/dist/ui/exportTarget.js +368 -0
- package/dist/ui/frameOverlay.d.ts +59 -0
- package/dist/ui/frameOverlay.js +76 -0
- package/dist/ui/framePacer.d.ts +142 -0
- package/dist/ui/framePacer.js +284 -0
- package/dist/ui/frameRecorder.d.ts +188 -0
- package/dist/ui/frameRecorder.js +221 -0
- package/dist/ui/fullscreen.d.ts +72 -0
- package/dist/ui/fullscreen.js +92 -0
- package/dist/ui/pixelCursor.d.ts +28 -0
- package/dist/ui/pixelCursor.js +66 -0
- package/dist/ui/splash.d.ts +86 -0
- package/dist/ui/splash.js +300 -0
- package/dist/ui/stillFrame.d.ts +22 -0
- package/dist/ui/stillFrame.js +40 -0
- package/package.json +60 -0
- package/src/behavior/behaviorTree.ts +346 -0
- package/src/build/shaderComments.ts +0 -0
- package/src/cinematic/player.ts +209 -0
- package/src/cinematic/script.ts +231 -0
- package/src/core/bootGate.ts +49 -0
- package/src/core/loadTracker.ts +144 -0
- package/src/core/loop.ts +211 -0
- package/src/core/messageQueue.ts +145 -0
- package/src/core/onceSet.ts +65 -0
- package/src/core/preferences.ts +177 -0
- package/src/core/remoteSave.ts +347 -0
- package/src/core/rng.ts +101 -0
- package/src/core/stepBudget.ts +136 -0
- package/src/core/storage.ts +114 -0
- package/src/core/tickTrace.ts +129 -0
- package/src/core/timeCurve.ts +175 -0
- package/src/core/withDefaults.ts +28 -0
- package/src/dev/contactProbe.ts +115 -0
- package/src/dev/fpsMeter.ts +101 -0
- package/src/environment/celestialClock.ts +385 -0
- package/src/geometry/decal.ts +260 -0
- package/src/geometry/filmPatch.ts +158 -0
- package/src/geometry/growable.ts +165 -0
- package/src/geometry/lightVolume.ts +161 -0
- package/src/geometry/meshBuilder.ts +1397 -0
- package/src/geometry/pixelFont.ts +189 -0
- package/src/geometry/ribbon.ts +790 -0
- package/src/geometry/shellFill.ts +265 -0
- package/src/geometry/spline.ts +659 -0
- package/src/geometry/tangents.ts +173 -0
- package/src/geometry/textMesh.ts +96 -0
- package/src/geometry/treeBuilder.ts +114 -0
- package/src/host/display.ts +180 -0
- package/src/host/files.ts +77 -0
- package/src/host/lifecycle.ts +63 -0
- package/src/host/platformServices.ts +23 -0
- package/src/host/screen.ts +134 -0
- package/src/index.ts +730 -0
- package/src/input/actionMap.ts +377 -0
- package/src/input/activeDevice.ts +86 -0
- package/src/input/gamepadIdentity.ts +131 -0
- package/src/input/gamepadMapping.ts +121 -0
- package/src/input/input.ts +872 -0
- package/src/input/inputHarness.ts +226 -0
- package/src/input/rightGesture.ts +76 -0
- package/src/input/rumble.ts +138 -0
- package/src/input/touchControls.ts +451 -0
- package/src/input/typingTarget.ts +26 -0
- package/src/math/bounds.ts +153 -0
- package/src/math/color.ts +37 -0
- package/src/math/exact.ts +274 -0
- package/src/math/frustum.ts +115 -0
- package/src/math/intersect.ts +228 -0
- package/src/math/scalar.ts +109 -0
- package/src/math/spring.ts +106 -0
- package/src/nav/navGraph.ts +168 -0
- package/src/nav/navPath.ts +217 -0
- package/src/nav/navSearch.ts +200 -0
- package/src/physics/boxSurface.ts +96 -0
- package/src/physics/colliderSurface.ts +213 -0
- package/src/physics/compositeSurface.ts +111 -0
- package/src/physics/heightSurface.ts +234 -0
- package/src/physics/ribbonSurface.ts +642 -0
- package/src/render/ambientOcclusionPass.ts +200 -0
- package/src/render/areaLights.ts +194 -0
- package/src/render/areaShadowSet.ts +405 -0
- package/src/render/atmosphere.ts +186 -0
- package/src/render/backend/api.ts +802 -0
- package/src/render/backend/budget.ts +139 -0
- package/src/render/backend/createRenderer.ts +343 -0
- package/src/render/backend/deadline.ts +37 -0
- package/src/render/backend/probe.ts +152 -0
- package/src/render/backend/select.ts +288 -0
- package/src/render/backend/timer.ts +59 -0
- package/src/render/backend/webgl2/instanced.ts +46 -0
- package/src/render/backend/webgl2/morphTexture.ts +58 -0
- package/src/render/backend/webgl2/renderer.ts +7484 -0
- package/src/render/backend/webgl2/skinPaletteTexture.ts +70 -0
- package/src/render/backend/webgpu/boltPass.ts +205 -0
- package/src/render/backend/webgpu/buffers.ts +553 -0
- package/src/render/backend/webgpu/causticsPass.ts +174 -0
- package/src/render/backend/webgpu/clusterBinner.ts +259 -0
- package/src/render/backend/webgpu/depthPass.ts +261 -0
- package/src/render/backend/webgpu/device.ts +148 -0
- package/src/render/backend/webgpu/drawCommand.ts +79 -0
- package/src/render/backend/webgpu/environmentTexels.ts +96 -0
- package/src/render/backend/webgpu/filmPass.ts +123 -0
- package/src/render/backend/webgpu/flatPass.ts +635 -0
- package/src/render/backend/webgpu/flockPass.ts +163 -0
- package/src/render/backend/webgpu/gpuTimestamps.ts +255 -0
- package/src/render/backend/webgpu/insetPass.ts +123 -0
- package/src/render/backend/webgpu/instanced.ts +55 -0
- package/src/render/backend/webgpu/lightVolumePass.ts +203 -0
- package/src/render/backend/webgpu/linePass.ts +270 -0
- package/src/render/backend/webgpu/morphTexture.ts +61 -0
- package/src/render/backend/webgpu/panelPass.ts +138 -0
- package/src/render/backend/webgpu/particlePass.ts +370 -0
- package/src/render/backend/webgpu/pipelineCache.ts +152 -0
- package/src/render/backend/webgpu/plumePass.ts +292 -0
- package/src/render/backend/webgpu/pointShadowPass.ts +368 -0
- package/src/render/backend/webgpu/postPass.ts +470 -0
- package/src/render/backend/webgpu/probePass.ts +218 -0
- package/src/render/backend/webgpu/reflectionPass.ts +137 -0
- package/src/render/backend/webgpu/renderer.ts +13004 -0
- package/src/render/backend/webgpu/scatterPass.ts +354 -0
- package/src/render/backend/webgpu/sdfTextPass.ts +220 -0
- package/src/render/backend/webgpu/shaderModules.ts +49 -0
- package/src/render/backend/webgpu/shaders/clusterBin.wgsl.ts +219 -0
- package/src/render/backend/webgpu/skinPaletteRing.ts +105 -0
- package/src/render/backend/webgpu/skinPaletteTexture.ts +79 -0
- package/src/render/backend/webgpu/skyPass.ts +85 -0
- package/src/render/backend/webgpu/surfaceTexturePass.ts +257 -0
- package/src/render/backend/webgpu/textPass.ts +224 -0
- package/src/render/backend/webgpu/uniformRing.ts +228 -0
- package/src/render/backend/webgpu/waterPass.ts +211 -0
- package/src/render/backend/webgpu/windStreakPass.ts +196 -0
- package/src/render/billboard.ts +108 -0
- package/src/render/bloomChain.ts +101 -0
- package/src/render/bloomPass.ts +256 -0
- package/src/render/boltBatch.ts +141 -0
- package/src/render/boltPool.ts +360 -0
- package/src/render/boom.ts +123 -0
- package/src/render/camera.ts +348 -0
- package/src/render/causticsRenderer.ts +171 -0
- package/src/render/cinematicCamera.ts +278 -0
- package/src/render/clusteredLights.ts +598 -0
- package/src/render/colourGrade.ts +109 -0
- package/src/render/compute.ts +83 -0
- package/src/render/contextLoss.ts +50 -0
- package/src/render/debugLines.ts +411 -0
- package/src/render/decalPass.ts +124 -0
- package/src/render/decalProjector.ts +390 -0
- package/src/render/decalQueue.ts +110 -0
- package/src/render/depthConvention.ts +383 -0
- package/src/render/drawingBuffer.ts +89 -0
- package/src/render/emptyTexture.ts +130 -0
- package/src/render/envProbeArray.ts +201 -0
- package/src/render/equirectToCube.ts +160 -0
- package/src/render/flockGeometry.ts +53 -0
- package/src/render/flockRenderer.ts +111 -0
- package/src/render/frame/arena.ts +93 -0
- package/src/render/frame/index.ts +29 -0
- package/src/render/frame/replay.ts +50 -0
- package/src/render/frame/resources.ts +61 -0
- package/src/render/frame/schedule.ts +85 -0
- package/src/render/frameView.ts +20 -0
- package/src/render/gizmo.ts +923 -0
- package/src/render/globalMedium.ts +154 -0
- package/src/render/globalMediumPass.ts +323 -0
- package/src/render/gpuCapability.ts +244 -0
- package/src/render/gpuTimer.ts +182 -0
- package/src/render/halfFloat.ts +39 -0
- package/src/render/handleRegistry.ts +96 -0
- package/src/render/iesProfile.ts +215 -0
- package/src/render/imageTexels.ts +109 -0
- package/src/render/instancedMesh.ts +187 -0
- package/src/render/instances.ts +92 -0
- package/src/render/lightBudget.ts +655 -0
- package/src/render/lightMatrix.ts +69 -0
- package/src/render/lightVolumeDraw.ts +216 -0
- package/src/render/lineBatch.ts +180 -0
- package/src/render/linePoints.ts +61 -0
- package/src/render/livePointShadowSet.ts +285 -0
- package/src/render/lod.ts +86 -0
- package/src/render/mesh.ts +536 -0
- package/src/render/occlusion.ts +406 -0
- package/src/render/oitPass.ts +230 -0
- package/src/render/orderIndependent.ts +136 -0
- package/src/render/particleBatch.ts +299 -0
- package/src/render/particleMaterial.ts +84 -0
- package/src/render/particlePool.ts +291 -0
- package/src/render/pass.ts +203 -0
- package/src/render/passTarget.ts +225 -0
- package/src/render/pickable.ts +222 -0
- package/src/render/planarReflection.ts +233 -0
- package/src/render/planarReflectionDraw.ts +87 -0
- package/src/render/plumeGeometry.ts +75 -0
- package/src/render/plumeMaterial.ts +99 -0
- package/src/render/plumeRenderer.ts +272 -0
- package/src/render/pointLightSelection.ts +447 -0
- package/src/render/pointShadowArray.ts +276 -0
- package/src/render/pointShadowBudget.ts +305 -0
- package/src/render/pointShadowImage.ts +470 -0
- package/src/render/pointShadowMap.ts +228 -0
- package/src/render/pointShadowSystem.ts +408 -0
- package/src/render/prefilterEnvMap.ts +162 -0
- package/src/render/prefilterPass.ts +115 -0
- package/src/render/probeGrid.ts +248 -0
- package/src/render/rainField.ts +240 -0
- package/src/render/reflectionProbe.ts +530 -0
- package/src/render/renderQuality.ts +1054 -0
- package/src/render/rendererHarness.ts +214 -0
- package/src/render/resolutionGovernor.ts +189 -0
- package/src/render/scatterDeform.ts +72 -0
- package/src/render/sceneTarget.ts +1032 -0
- package/src/render/screenSpaceReflection.ts +524 -0
- package/src/render/sdfFont.ts +157 -0
- package/src/render/sdfTextLayout.ts +206 -0
- package/src/render/sdfTextRenderer.ts +233 -0
- package/src/render/seaState.ts +55 -0
- package/src/render/segmentQuads.ts +92 -0
- package/src/render/shader.ts +190 -0
- package/src/render/shaders/ambientOcclusion.ts +354 -0
- package/src/render/shaders/arcane.ts +103 -0
- package/src/render/shaders/bloom.ts +232 -0
- package/src/render/shaders/bolt.ts +164 -0
- package/src/render/shaders/caustics.ts +169 -0
- package/src/render/shaders/conditionals.ts +58 -0
- package/src/render/shaders/decalProject.ts +127 -0
- package/src/render/shaders/depth.ts +131 -0
- package/src/render/shaders/depthOfField.ts +141 -0
- package/src/render/shaders/film.ts +285 -0
- package/src/render/shaders/fire.ts +180 -0
- package/src/render/shaders/flat/directionalShadow.ts +196 -0
- package/src/render/shaders/flat/index.ts +502 -0
- package/src/render/shaders/flat/lobes.ts +399 -0
- package/src/render/shaders/flat/main.ts +1631 -0
- package/src/render/shaders/flat/pointShadow.ts +323 -0
- package/src/render/shaders/flat/preamble.ts +875 -0
- package/src/render/shaders/flat/probeGrid.ts +152 -0
- package/src/render/shaders/flat/surface.ts +41 -0
- package/src/render/shaders/flock.ts +103 -0
- package/src/render/shaders/fog.ts +99 -0
- package/src/render/shaders/fullscreen.ts +28 -0
- package/src/render/shaders/generated/ambientOcclusion.wgsl.ts +74 -0
- package/src/render/shaders/generated/arcane.wgsl.ts +98 -0
- package/src/render/shaders/generated/bloom.wgsl.ts +79 -0
- package/src/render/shaders/generated/bolt.wgsl.ts +127 -0
- package/src/render/shaders/generated/caustics.wgsl.ts +127 -0
- package/src/render/shaders/generated/decalProject.wgsl.ts +69 -0
- package/src/render/shaders/generated/depth.wgsl.ts +142 -0
- package/src/render/shaders/generated/film.wgsl.ts +143 -0
- package/src/render/shaders/generated/fire.wgsl.ts +137 -0
- package/src/render/shaders/generated/flat.wgsl.ts +9195 -0
- package/src/render/shaders/generated/flock.wgsl.ts +82 -0
- package/src/render/shaders/generated/fullscreen.wgsl.ts +20 -0
- package/src/render/shaders/generated/globalMedium.wgsl.ts +139 -0
- package/src/render/shaders/generated/lightVolume.wgsl.ts +242 -0
- package/src/render/shaders/generated/line.wgsl.ts +137 -0
- package/src/render/shaders/generated/octahedralResolve.wgsl.ts +60 -0
- package/src/render/shaders/generated/oitResolve.wgsl.ts +31 -0
- package/src/render/shaders/generated/panel.wgsl.ts +57 -0
- package/src/render/shaders/generated/particle.wgsl.ts +343 -0
- package/src/render/shaders/generated/prefilter.wgsl.ts +69 -0
- package/src/render/shaders/generated/rush.wgsl.ts +139 -0
- package/src/render/shaders/generated/scatter.wgsl.ts +205 -0
- package/src/render/shaders/generated/sdfText.wgsl.ts +78 -0
- package/src/render/shaders/generated/sky.wgsl.ts +109 -0
- package/src/render/shaders/generated/smoke.wgsl.ts +93 -0
- package/src/render/shaders/generated/ssrResolve.wgsl.ts +26 -0
- package/src/render/shaders/generated/ssrTrace.wgsl.ts +94 -0
- package/src/render/shaders/generated/temporalResolve.wgsl.ts +54 -0
- package/src/render/shaders/generated/text.wgsl.ts +107 -0
- package/src/render/shaders/generated/water.wgsl.ts +256 -0
- package/src/render/shaders/generated/windStreaks.wgsl.ts +82 -0
- package/src/render/shaders/gerstner.ts +110 -0
- package/src/render/shaders/globalMedium.ts +396 -0
- package/src/render/shaders/lightVolume.ts +546 -0
- package/src/render/shaders/line.ts +125 -0
- package/src/render/shaders/morph.ts +62 -0
- package/src/render/shaders/octahedral.ts +170 -0
- package/src/render/shaders/octahedralResolve.ts +83 -0
- package/src/render/shaders/oitResolve.ts +42 -0
- package/src/render/shaders/outputTransform.ts +107 -0
- package/src/render/shaders/panel.ts +51 -0
- package/src/render/shaders/particle.ts +438 -0
- package/src/render/shaders/prefilter.ts +278 -0
- package/src/render/shaders/rush.ts +357 -0
- package/src/render/shaders/scatter.ts +211 -0
- package/src/render/shaders/sdfText.ts +68 -0
- package/src/render/shaders/skinning.ts +59 -0
- package/src/render/shaders/sky.ts +243 -0
- package/src/render/shaders/smoke.ts +89 -0
- package/src/render/shaders/ssrResolve.ts +28 -0
- package/src/render/shaders/ssrTrace.ts +233 -0
- package/src/render/shaders/tangentFrame.ts +70 -0
- package/src/render/shaders/temporalResolve.ts +151 -0
- package/src/render/shaders/text.ts +156 -0
- package/src/render/shaders/vertexChannel.ts +71 -0
- package/src/render/shaders/water.ts +356 -0
- package/src/render/shaders/windStreaks.ts +130 -0
- package/src/render/shadowCasters.ts +124 -0
- package/src/render/shadowMap.ts +89 -0
- package/src/render/shotPlacement.ts +266 -0
- package/src/render/skinPalette.ts +157 -0
- package/src/render/ssrPass.ts +241 -0
- package/src/render/surfaceSheet.ts +158 -0
- package/src/render/surfaceTexture.ts +310 -0
- package/src/render/temporalAa.ts +221 -0
- package/src/render/temporalPass.ts +153 -0
- package/src/render/textLayout.ts +239 -0
- package/src/render/textRenderer.ts +201 -0
- package/src/render/thirdPersonCamera.ts +578 -0
- package/src/render/trample.ts +140 -0
- package/src/render/translucentQueue.ts +161 -0
- package/src/render/uniformVectorBudget.ts +246 -0
- package/src/render/uploadStep.ts +14 -0
- package/src/render/vertexDefaults.ts +115 -0
- package/src/render/visibility.ts +56 -0
- package/src/render/waterDraw.ts +167 -0
- package/src/render/waterGrid.ts +180 -0
- package/src/render/waterRenderer.ts +352 -0
- package/src/render/wind.ts +79 -0
- package/src/render/windField.ts +50 -0
- package/src/render/windStreakDraw.ts +131 -0
- package/src/render/windStreakRenderer.ts +130 -0
- package/src/scene/node.ts +336 -0
- package/src/scene/visit.ts +82 -0
- package/src/ui/clipMime.ts +109 -0
- package/src/ui/exportTarget.ts +491 -0
- package/src/ui/frameOverlay.ts +159 -0
- package/src/ui/framePacer.ts +351 -0
- package/src/ui/frameRecorder.ts +333 -0
- package/src/ui/fullscreen.ts +113 -0
- package/src/ui/pixelCursor.ts +99 -0
- package/src/ui/splash.ts +347 -0
- package/src/ui/stillFrame.ts +44 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/** Shader compilation with fail-fast diagnostics (init-time only, never per-frame). */
|
|
2
|
+
|
|
3
|
+
export function compileProgram(
|
|
4
|
+
gl: WebGL2RenderingContext,
|
|
5
|
+
vertexSource: string,
|
|
6
|
+
fragmentSource: string,
|
|
7
|
+
label: string,
|
|
8
|
+
): WebGLProgram {
|
|
9
|
+
const vs = compileStage(gl, gl.VERTEX_SHADER, vertexSource, `${label}.vert`);
|
|
10
|
+
const fs = compileStage(gl, gl.FRAGMENT_SHADER, fragmentSource, `${label}.frag`);
|
|
11
|
+
|
|
12
|
+
const program = gl.createProgram();
|
|
13
|
+
if (program === null) throw new Error(`[${label}] createProgram failed`);
|
|
14
|
+
|
|
15
|
+
gl.attachShader(program, vs);
|
|
16
|
+
gl.attachShader(program, fs);
|
|
17
|
+
gl.linkProgram(program);
|
|
18
|
+
gl.deleteShader(vs);
|
|
19
|
+
gl.deleteShader(fs);
|
|
20
|
+
|
|
21
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
22
|
+
const log = gl.getProgramInfoLog(program);
|
|
23
|
+
gl.deleteProgram(program);
|
|
24
|
+
throw new Error(`[${label}] link failed: ${log ?? 'no log'}`);
|
|
25
|
+
}
|
|
26
|
+
return program;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether a uniform lookup that cannot reach the GPU is reported.
|
|
31
|
+
*
|
|
32
|
+
* Two ways it cannot: the program has no such uniform, or the program is not the one
|
|
33
|
+
* currently bound. Both upload nothing; only the second one leaves a GL error behind.
|
|
34
|
+
*
|
|
35
|
+
* **Why this exists.** `gl.uniform*(null, value)` is legal and does *nothing*: no error,
|
|
36
|
+
* no warning, no exception. Every uniform in this renderer is written through
|
|
37
|
+
* `uniforms['name'] ?? null`, so a name that stops matching — renamed, optimised out,
|
|
38
|
+
* spelled for a different driver's convention — silently stops being uploaded, and the
|
|
39
|
+
* effect it drove quietly ceases to exist. There is no symptom except a picture that is
|
|
40
|
+
* subtly or completely wrong, and no thread from the picture back to the cause.
|
|
41
|
+
*
|
|
42
|
+
* That is not a hypothetical. It has now cost this project a trample field that shipped
|
|
43
|
+
* uploading to nothing, and a night spent on a black courtyard while four separate
|
|
44
|
+
* theories were argued from source because nothing anywhere said a word.
|
|
45
|
+
*
|
|
46
|
+
* Off by default, because a renderer that warns in a frame loop is its own problem, and
|
|
47
|
+
* because deliberate optional lookups exist — a shader compiled without point shadows
|
|
48
|
+
* genuinely has no `uPointShadowIndex[0]`. On, it names the program and the uniform once
|
|
49
|
+
* each, which is enough to find it and quiet enough to leave on while looking.
|
|
50
|
+
*/
|
|
51
|
+
let strictUniforms = false;
|
|
52
|
+
const reportedMisses = new Set<string>();
|
|
53
|
+
|
|
54
|
+
export function setUniformStrictMode(on: boolean): void {
|
|
55
|
+
strictUniforms = on;
|
|
56
|
+
if (!on) reportedMisses.clear();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Locations of every active uniform, keyed by name. */
|
|
60
|
+
export function uniformLocations(
|
|
61
|
+
gl: WebGL2RenderingContext,
|
|
62
|
+
program: WebGLProgram,
|
|
63
|
+
label = 'program',
|
|
64
|
+
): Record<string, WebGLUniformLocation> {
|
|
65
|
+
const locations: Record<string, WebGLUniformLocation> = {};
|
|
66
|
+
const count = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS) as number;
|
|
67
|
+
for (let i = 0; i < count; i++) {
|
|
68
|
+
const info = gl.getActiveUniform(program, i);
|
|
69
|
+
if (info === null) continue;
|
|
70
|
+
const location = gl.getUniformLocation(program, info.name);
|
|
71
|
+
if (location === null) continue;
|
|
72
|
+
locations[info.name] = location;
|
|
73
|
+
/*
|
|
74
|
+
* An array uniform is registered under **both** spellings, whichever one the driver
|
|
75
|
+
* reported it under.
|
|
76
|
+
*
|
|
77
|
+
* Passing `undefined` (or `null`) to `uniformNfv` is a **silent no-op**: the uniform
|
|
78
|
+
* never gets its data, there is no GL error, nothing throws, and the effect simply
|
|
79
|
+
* does not exist. That is how a trample field for the foliage once shipped uploading
|
|
80
|
+
* to nothing while every test passed and the console stayed clean.
|
|
81
|
+
*
|
|
82
|
+
* The subtlety, and the reason this is written symmetrically, is that **the reported
|
|
83
|
+
* name is not portable**. GLES 3.0 §2.12.6 lets an implementation return an active
|
|
84
|
+
* array's name either as `uThing[0]` or as bare `uThing`, and both are conformant.
|
|
85
|
+
* ANGLE — so every desktop browser, and Chrome on Android — returns the subscript.
|
|
86
|
+
* WebKit's Metal backend, so every browser on iOS, returns the bare name.
|
|
87
|
+
*
|
|
88
|
+
* Assuming the subscript cost a fortnight. On iOS the whole point-light system
|
|
89
|
+
* uploaded to `null`: positions, colours, radii and weights all stayed at zero, so
|
|
90
|
+
* point lights contributed exactly nothing. A scene with a sun looked perfect, and a
|
|
91
|
+
* scene lit only by lamps rendered its geometry to ambient alone — a dark room with
|
|
92
|
+
* its fire still burning, because emission needs no light to arrive. It reproduced on
|
|
93
|
+
* nothing the author owned, and it could not show up in any diagnostic, because from
|
|
94
|
+
* the API's point of view nothing went wrong.
|
|
95
|
+
*
|
|
96
|
+
* Registering both means no caller can hold it wrong, and no caller has to know a
|
|
97
|
+
* WebGL naming convention in order to write to an array — that is a fact about the
|
|
98
|
+
* API, not about the shader anybody is trying to use.
|
|
99
|
+
*/
|
|
100
|
+
const subscript = info.name.indexOf('[');
|
|
101
|
+
if (subscript > 0) {
|
|
102
|
+
const bare = info.name.slice(0, subscript);
|
|
103
|
+
if (locations[bare] === undefined) locations[bare] = location;
|
|
104
|
+
} else if (info.size > 1) {
|
|
105
|
+
/*
|
|
106
|
+
* `size` is what separates an array reported bare from an ordinary scalar, which
|
|
107
|
+
* the name alone cannot: it is the element count, and it is 1 for everything that
|
|
108
|
+
* is not an array. Registering `uViewProj[0]` for a matrix would be harmless but
|
|
109
|
+
* meaningless, and a lookup map that answers to names nothing declared is a map
|
|
110
|
+
* that stops being evidence of what the shader contains.
|
|
111
|
+
*/
|
|
112
|
+
const subscripted = `${info.name}[0]`;
|
|
113
|
+
if (locations[subscripted] === undefined) locations[subscripted] = location;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (!strictUniforms) return locations;
|
|
118
|
+
/*
|
|
119
|
+
* A proxy rather than a changed call site, deliberately: the point is to cover *every*
|
|
120
|
+
* lookup in the renderer, including the ones nobody thought to check, and a guard that
|
|
121
|
+
* has to be adopted one call at a time protects only the places somebody already
|
|
122
|
+
* suspected.
|
|
123
|
+
*/
|
|
124
|
+
return new Proxy(locations, {
|
|
125
|
+
get(target, key) {
|
|
126
|
+
if (typeof key !== 'string') return target[key as unknown as string];
|
|
127
|
+
if (!(key in target)) {
|
|
128
|
+
const at = `${label}.${key}`;
|
|
129
|
+
if (!reportedMisses.has(at)) {
|
|
130
|
+
reportedMisses.add(at);
|
|
131
|
+
console.warn(
|
|
132
|
+
`Renderer: \`${label}\` has no uniform \`${key}\`. Writing to it does nothing — ` +
|
|
133
|
+
`WebGL treats a missing location as a silent no-op, so whatever this drove is ` +
|
|
134
|
+
`simply absent.`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
} else if (gl.getParameter(gl.CURRENT_PROGRAM) !== program) {
|
|
138
|
+
/*
|
|
139
|
+
* The other half of the same failure, and the one that leaves evidence somewhere
|
|
140
|
+
* else entirely.
|
|
141
|
+
*
|
|
142
|
+
* A location belongs to the program it was queried from, so writing it while a
|
|
143
|
+
* different program is bound uploads nothing and raises `INVALID_OPERATION`. The
|
|
144
|
+
* shape it takes in a renderer: one pass binds its program once and every other
|
|
145
|
+
* pass interrupts it, so a call made after an interruption addresses a program
|
|
146
|
+
* that has not been current since — and then draws through whichever program *is*
|
|
147
|
+
* bound, because a draw call takes the program it finds rather than the one whose
|
|
148
|
+
* uniforms were just written.
|
|
149
|
+
*
|
|
150
|
+
* Worth reporting separately from a missing name because the damage travels. A
|
|
151
|
+
* pending GL error is not attached to the call that raised it: the next
|
|
152
|
+
* `getError` anywhere in the codebase reads it and concludes that whatever *it*
|
|
153
|
+
* was checking has failed. One such check read exactly this error as a driver
|
|
154
|
+
* refusing to resolve depth, and switched an effect off for the session.
|
|
155
|
+
*/
|
|
156
|
+
const at = `${label}.${key}@program`;
|
|
157
|
+
if (!reportedMisses.has(at)) {
|
|
158
|
+
reportedMisses.add(at);
|
|
159
|
+
console.warn(
|
|
160
|
+
`Renderer: \`${label}.${key}\` was looked up while a different program is ` +
|
|
161
|
+
`bound. A uniform location belongs to its own program, so this write uploads ` +
|
|
162
|
+
`nothing, raises INVALID_OPERATION, and leaves an error for the next ` +
|
|
163
|
+
`getError anywhere to misread. Bind \`${label}\` first.`,
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return target[key];
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function compileStage(
|
|
173
|
+
gl: WebGL2RenderingContext,
|
|
174
|
+
type: number,
|
|
175
|
+
source: string,
|
|
176
|
+
label: string,
|
|
177
|
+
): WebGLShader {
|
|
178
|
+
const shader = gl.createShader(type);
|
|
179
|
+
if (shader === null) throw new Error(`[${label}] createShader failed`);
|
|
180
|
+
|
|
181
|
+
gl.shaderSource(shader, source);
|
|
182
|
+
gl.compileShader(shader);
|
|
183
|
+
|
|
184
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
185
|
+
const log = gl.getShaderInfoLog(shader);
|
|
186
|
+
gl.deleteShader(shader);
|
|
187
|
+
throw new Error(`[${label}] compile failed: ${log ?? 'no log'}`);
|
|
188
|
+
}
|
|
189
|
+
return shader;
|
|
190
|
+
}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { glslIsFarDepth, glslSceneDepthToNdc } from '../depthConvention.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Ambient occlusion from depth: the estimate, and the blur that makes it usable.
|
|
4
|
+
*
|
|
5
|
+
* Contact shading — the darkening where two surfaces meet, under a wheel arch, along a panel
|
|
6
|
+
* gap, where a plinth stands on a floor. It is most of what makes a model sit in a room
|
|
7
|
+
* rather than float in it, and its absence does not read as a missing effect. It reads as
|
|
8
|
+
* the geometry having been pasted over the picture.
|
|
9
|
+
*
|
|
10
|
+
* **Two passes rather than one, and that is the whole design decision.** Occlusion estimated
|
|
11
|
+
* inside the composite pass and used directly was built first and looked at: twelve depth
|
|
12
|
+
* samples per pixel is a noisy estimate of a smooth quantity, and a frame of it is salt and
|
|
13
|
+
* pepper over every surface. Every renderer that ships this blurs it, and a blur needs the
|
|
14
|
+
* estimate to exist somewhere first. So the estimate lands in its own single-channel target,
|
|
15
|
+
* gets smoothed by a separable pass that will not cross a depth edge, and the composite
|
|
16
|
+
* multiplies by the result.
|
|
17
|
+
*
|
|
18
|
+
* The pairing that makes twelve taps enough: the sampling directions are turned by a
|
|
19
|
+
* rotation that repeats every four pixels, and the blur runs over eight. Every four-pixel run
|
|
20
|
+
* contains all sixteen rotations exactly once, so averaging one recovers a sixteen-times-denser
|
|
21
|
+
* kernel; averaging two also halves what is left of the noise, and — the part that decides the
|
|
22
|
+
* width — leaves a pixel hard against a silhouette with four consecutive taps still on its own
|
|
23
|
+
* side of the edge. Neither half works alone: a random per-pixel rotation leaves noise the blur
|
|
24
|
+
* can only soften, and a window narrower than two periods leaves the tile itself on screen
|
|
25
|
+
* wherever the depth test cuts the window short, as a dotted line along every edge.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The estimate. Writes one channel: 1 is open sky, 0 is fully enclosed.
|
|
30
|
+
*
|
|
31
|
+
* The estimator is the Alchemy/scalable-AO one — for each neighbour, the vector v from this
|
|
32
|
+
* surface to it, weighted max(0, v·n) / (v·v). Two properties earn it its place over a
|
|
33
|
+
* hemisphere of offset points: nothing has to be oriented, so there is no tangent frame and
|
|
34
|
+
* no rotation matrix per pixel, and the 1 / v·v term falls away on its own, so a neighbour
|
|
35
|
+
* further off contributes less without a second range test doing it by hand.
|
|
36
|
+
*/
|
|
37
|
+
export const AO_FRAG = `#version 300 es
|
|
38
|
+
precision highp float;
|
|
39
|
+
|
|
40
|
+
in vec2 vUv;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* **highp, and the whole effect depends on it.** GLSL ES gives a fragment shader's samplers a
|
|
44
|
+
* default precision of *lowp*, whatever the precision highp float line above says — that
|
|
45
|
+
* sets the default for float, not for a sampler. A lowp sampler may hand back eight bits,
|
|
46
|
+
* and eight bits of depth is a scene collapsed onto a couple of hundred planes.
|
|
47
|
+
*
|
|
48
|
+
* This was built without the qualifier and looked at first. The picture says exactly what it
|
|
49
|
+
* is once you know: the reconstructed normal came back as (0, 0, 1) over every surface,
|
|
50
|
+
* because within one of those planes the depth does not change between neighbouring pixels
|
|
51
|
+
* and the cross product of the two derivatives has nothing to work with. What reached the
|
|
52
|
+
* screen was contour banding along the planes themselves — rings up the car's flanks and
|
|
53
|
+
* stripes across the floor, which is a topographic map of the quantisation.
|
|
54
|
+
*/
|
|
55
|
+
uniform highp sampler2D uDepth;
|
|
56
|
+
/**
|
|
57
|
+
* The projection's x and y scales, which turn a world radius into a screen one.
|
|
58
|
+
*
|
|
59
|
+
* mat4[0][0] and [1][1] of the perspective matrix and nothing else, so the whole projection
|
|
60
|
+
* does not have to be uploaded to answer "how much of the frame does half a metre cover at
|
|
61
|
+
* this depth". It carries the aspect ratio with it, which is why the reach is a vec2: a
|
|
62
|
+
* circle on screen is not a circle in UV.
|
|
63
|
+
*/
|
|
64
|
+
uniform vec2 uProjScale;
|
|
65
|
+
/** Clip back to view space, so a depth sample becomes a position that can be compared. */
|
|
66
|
+
uniform mat4 uInvProjection;
|
|
67
|
+
/** How far the sampling reaches, in metres of the world. */
|
|
68
|
+
uniform float uRadius;
|
|
69
|
+
|
|
70
|
+
out float fragColor;
|
|
71
|
+
|
|
72
|
+
/** How many depths each pixel compares itself against. Fixed, so the cost is fixed. */
|
|
73
|
+
const int AO_TAPS = 12;
|
|
74
|
+
/**
|
|
75
|
+
* The golden angle, in radians.
|
|
76
|
+
*
|
|
77
|
+
* Successive taps turned by it never line up into spokes, which a rational fraction of a
|
|
78
|
+
* turn does: a kernel that repeats a direction is blind along it, and it is blind the same
|
|
79
|
+
* way in every pixel, so it reads as a pattern in the surface rather than as noise.
|
|
80
|
+
*/
|
|
81
|
+
const float AO_GOLDEN_ANGLE = 2.39996323;
|
|
82
|
+
/**
|
|
83
|
+
* How far the sampling may reach across the frame, whatever the depth says.
|
|
84
|
+
*
|
|
85
|
+
* A surface almost touching the near plane projects half a metre onto most of the screen,
|
|
86
|
+
* and without a ceiling those pixels each read the whole frame's depth: the effect stops
|
|
87
|
+
* being contact shading and becomes an expensive wide darkening. 6% of the frame.
|
|
88
|
+
*/
|
|
89
|
+
const float AO_MAX_REACH_UV = 0.06;
|
|
90
|
+
/**
|
|
91
|
+
* Self-occlusion guard, as a fraction of the pixel's own view depth.
|
|
92
|
+
*
|
|
93
|
+
* Depth is quantised, so a flat surface samples itself very slightly in front of itself and
|
|
94
|
+
* every flat surface in the world comes back faintly dirty. The error grows with distance,
|
|
95
|
+
* which is why the guard is proportional to depth rather than a constant.
|
|
96
|
+
*/
|
|
97
|
+
const float AO_BIAS = 0.004;
|
|
98
|
+
/**
|
|
99
|
+
* The floor under the 1 / (v·v) weighting, in square metres.
|
|
100
|
+
*
|
|
101
|
+
* Not a guard against dividing by zero, which is what a value near the float epsilon would
|
|
102
|
+
* be. The nearest taps land about a centimetre away, where v·v is 1e-4 and the weight is ten
|
|
103
|
+
* thousand — so a depth quantised to a millimetre yields several units of occlusion out of
|
|
104
|
+
* nothing at all. Measured that way first, with 1e-4 here: a flat floor came back as static.
|
|
105
|
+
* A hundredth of a square metre is a tenth of a metre of separation, which is the scale
|
|
106
|
+
* below which two samples are the same surface rather than one occluding the other.
|
|
107
|
+
*/
|
|
108
|
+
const float AO_EPSILON = 0.01;
|
|
109
|
+
/**
|
|
110
|
+
* How many times further one neighbour may be than the other before the pair straddles an edge.
|
|
111
|
+
*
|
|
112
|
+
* Eight, and deliberately far above anything a continuous surface produces. On a plane seen at a
|
|
113
|
+
* grazing angle the two one-sided depth deltas do differ — depth grows nonlinearly with screen
|
|
114
|
+
* position — but only by a few percent except within a pixel or two of the vanishing point. A
|
|
115
|
+
* silhouette is not a factor of eight, it is a factor of hundreds, so the gate can afford to sit
|
|
116
|
+
* high and it is worth putting it there: every fragment this test lets through keeps the plain
|
|
117
|
+
* quad derivative, which is the picture that shipped.
|
|
118
|
+
*/
|
|
119
|
+
const float AO_EDGE_RATIO = 8.0;
|
|
120
|
+
/**
|
|
121
|
+
* The floor under that ratio, as a fraction of the pixel's own view depth.
|
|
122
|
+
*
|
|
123
|
+
* **Without it the test is a comparison of two quantisation errors**, which is how a flat floor
|
|
124
|
+
* acquires a horizontal band at every contour of constant depth. Five percent of the distance is
|
|
125
|
+
* far above any depth buffer's quantum, above the difference two sides of a grazing plane show,
|
|
126
|
+
* and far below the step at any edge worth shading — a kerb against a deck is metres of it.
|
|
127
|
+
*/
|
|
128
|
+
const float AO_EDGE_FLOOR = 0.05;
|
|
129
|
+
|
|
130
|
+
/** View-space position of whatever is at this pixel, from its depth alone. */
|
|
131
|
+
vec3 viewPosition(vec2 uv, float depth) {
|
|
132
|
+
vec4 clip = vec4(uv * 2.0 - 1.0, ${glslSceneDepthToNdc('depth')}, 1.0);
|
|
133
|
+
vec4 view = uInvProjection * clip;
|
|
134
|
+
return view.xyz / view.w;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void main() {
|
|
138
|
+
/*
|
|
139
|
+
* One output pixel, in UV, along each axis.
|
|
140
|
+
*
|
|
141
|
+
* Taken before anything branches, because that is where a derivative is defined, and taken of
|
|
142
|
+
* vUv rather than of a reconstructed position: vUv is linear across a fullscreen triangle, so
|
|
143
|
+
* these are exact and constant. They are the *output's* pixel, which is what the neighbour
|
|
144
|
+
* taps below want — this estimate runs at half the frame on one backend and at full size on
|
|
145
|
+
* the other, and a step measured in the depth texture's texels would be wrong on one of them.
|
|
146
|
+
*/
|
|
147
|
+
vec2 stepX = dFdx(vUv);
|
|
148
|
+
vec2 stepY = dFdy(vUv);
|
|
149
|
+
|
|
150
|
+
float depth = textureLod(uDepth, vUv, 0.0).r;
|
|
151
|
+
vec3 p = viewPosition(vUv, depth);
|
|
152
|
+
/*
|
|
153
|
+
* Both derivatives taken before anything branches on the depth. dFdx is only defined where
|
|
154
|
+
* every pixel of the quad reaches it, so a sky pixel returning early would leave the
|
|
155
|
+
* derivative undefined for the *geometry* pixels beside it — a wrong normal along every
|
|
156
|
+
* horizon in the frame, from a shader that reads as correct.
|
|
157
|
+
*/
|
|
158
|
+
vec3 dpdx = dFdx(p);
|
|
159
|
+
vec3 dpdy = dFdy(p);
|
|
160
|
+
/* Nothing occludes the sky, and there is no surface here to occlude. */
|
|
161
|
+
if (${glslIsFarDepth('depth')}) {
|
|
162
|
+
fragColor = 1.0;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/*
|
|
167
|
+
* At a silhouette, the quad derivative above is replaced by the one-sided difference that
|
|
168
|
+
* stays on this pixel's own surface. **Everywhere else it is left exactly alone**, and that
|
|
169
|
+
* restraint is the whole design of these twelve lines.
|
|
170
|
+
*
|
|
171
|
+
* **What it fixes.** A hardware derivative is a difference across a 2x2 quad, and every
|
|
172
|
+
* silhouette in the frame puts two surfaces in one quad: the difference is a secant from the
|
|
173
|
+
* near surface to the far one, metres long, and the cross product of two such secants is a
|
|
174
|
+
* normal roughly *perpendicular* to the real one. The dot of v with n for taps on the
|
|
175
|
+
* neighbouring surface comes back large and positive, the sum saturates, and the pixel clamps
|
|
176
|
+
* to black — every platform edge, every kerb and the character's own outline carrying black
|
|
177
|
+
* speckle. Speckle rather than a clean line, because the rotation tile below turns each
|
|
178
|
+
* pixel's taps differently, and the depth-aware blur that follows is designed *not* to cross
|
|
179
|
+
* an edge, so it preserved the garbage precisely where the garbage was.
|
|
180
|
+
*
|
|
181
|
+
* **What it must not do, learned the hard way.** The textbook cure is to take both one-sided
|
|
182
|
+
* differences everywhere and keep whichever has the smaller depth delta. That was built and
|
|
183
|
+
* shipped to a reporter, and it bands: the two sides of a flat surface differ by a
|
|
184
|
+
* quantisation step or by nothing, so "smaller delta" selects whichever side happens to read
|
|
185
|
+
* zero, the choice flips wherever the depth steps, and on a plane receding from the camera
|
|
186
|
+
* that is a contour — a horizontal stripe across the floor, over the whole world. The header
|
|
187
|
+
* above this shader describes the same picture arriving from a lowp sampler and names it: a
|
|
188
|
+
* topographic map of the quantisation.
|
|
189
|
+
*
|
|
190
|
+
* So the substitution is gated on a *discontinuity*, not on a preference. One side must be
|
|
191
|
+
* several times the other **and** clear of a floor proportional to this pixel's own distance,
|
|
192
|
+
* which no quantisation step and no continuous slope can reach. On everything that is not an
|
|
193
|
+
* edge these lines change nothing at all, which is what makes them safe to add.
|
|
194
|
+
*/
|
|
195
|
+
vec3 right = viewPosition(vUv + stepX, textureLod(uDepth, vUv + stepX, 0.0).r);
|
|
196
|
+
vec3 left = viewPosition(vUv - stepX, textureLod(uDepth, vUv - stepX, 0.0).r);
|
|
197
|
+
vec3 down = viewPosition(vUv + stepY, textureLod(uDepth, vUv + stepY, 0.0).r);
|
|
198
|
+
vec3 up = viewPosition(vUv - stepY, textureLod(uDepth, vUv - stepY, 0.0).r);
|
|
199
|
+
|
|
200
|
+
/* View distance is positive down -z, and the floor is a fraction of this pixel's own. */
|
|
201
|
+
float here = -p.z;
|
|
202
|
+
float edgeFloor = AO_EDGE_FLOOR * here;
|
|
203
|
+
float rightGap = abs(-right.z - here);
|
|
204
|
+
float leftGap = abs(-left.z - here);
|
|
205
|
+
float downGap = abs(-down.z - here);
|
|
206
|
+
float upGap = abs(-up.z - here);
|
|
207
|
+
|
|
208
|
+
/* Both arms written towards increasing x and y, so which one wins cannot flip the handedness
|
|
209
|
+
of the cross product below — only the eye-facing test after it would have to notice. */
|
|
210
|
+
if (rightGap > leftGap * AO_EDGE_RATIO + edgeFloor) dpdx = p - left;
|
|
211
|
+
else if (leftGap > rightGap * AO_EDGE_RATIO + edgeFloor) dpdx = right - p;
|
|
212
|
+
if (downGap > upGap * AO_EDGE_RATIO + edgeFloor) dpdy = p - up;
|
|
213
|
+
else if (upGap > downGap * AO_EDGE_RATIO + edgeFloor) dpdy = down - p;
|
|
214
|
+
|
|
215
|
+
vec3 n = normalize(cross(dpdx, dpdy));
|
|
216
|
+
/*
|
|
217
|
+
* Turned to face the eye. Which sign the cross product comes out with is a fact about the
|
|
218
|
+
* screen-space winding and the handedness of the projection, and a normal pointing away
|
|
219
|
+
* from the camera makes every v·n come back zero, which is a frame with no occlusion in it
|
|
220
|
+
* anywhere. In view space the eye is the origin, so a normal facing it satisfies n·p < 0.
|
|
221
|
+
*/
|
|
222
|
+
if (dot(n, p) > 0.0) n = -n;
|
|
223
|
+
|
|
224
|
+
/*
|
|
225
|
+
* The radius as a fraction of the frame. A metre subtends less of the screen the further
|
|
226
|
+
* away it is, which is the entire reason this is computed per pixel rather than handed in.
|
|
227
|
+
*/
|
|
228
|
+
vec2 reach = min(
|
|
229
|
+
uRadius * uProjScale * 0.5 / max(-p.z, 1e-3),
|
|
230
|
+
vec2(AO_MAX_REACH_UV)
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
/*
|
|
234
|
+
* A rotation that repeats every four pixels: sixteen distinct turns laid out over a 4x4
|
|
235
|
+
* tile. Paired with the four-wide blur that follows, every blurred pixel averages all
|
|
236
|
+
* sixteen, which is what makes twelve taps enough. A per-pixel hash would decorrelate
|
|
237
|
+
* neighbours better in principle and is worse here, because the blur can then only soften
|
|
238
|
+
* the noise rather than complete the kernel.
|
|
239
|
+
*/
|
|
240
|
+
float tile = mod(gl_FragCoord.x, 4.0) + 4.0 * mod(gl_FragCoord.y, 4.0);
|
|
241
|
+
float turn = tile * (6.2831853 / 16.0);
|
|
242
|
+
|
|
243
|
+
float sum = 0.0;
|
|
244
|
+
for (int i = 0; i < AO_TAPS; i++) {
|
|
245
|
+
float t = (float(i) + 0.5) / float(AO_TAPS);
|
|
246
|
+
float angle = turn + float(i) * AO_GOLDEN_ANGLE;
|
|
247
|
+
/* The square root spreads the taps evenly over the disk; without it they crowd the
|
|
248
|
+
centre, where they are measuring the pixel's own depth. */
|
|
249
|
+
vec2 uv = vUv + vec2(cos(angle), sin(angle)) * sqrt(t) * reach;
|
|
250
|
+
|
|
251
|
+
/*
|
|
252
|
+
* textureLod, not texture, and it is the rule rather than a preference: this sample sits
|
|
253
|
+
* inside a loop whose iterations a compiler cannot prove uniform, and an implicit
|
|
254
|
+
* derivative there is what lets one flatten the body and pay for every arm. The fetch is
|
|
255
|
+
* identical — the depth texture has one storage level and NEAREST filters, so there is no
|
|
256
|
+
* mip for a derivative to select. See AGENTS.md, 2026-08-07.
|
|
257
|
+
*/
|
|
258
|
+
float sampled = textureLod(uDepth, uv, 0.0).r;
|
|
259
|
+
if (${glslIsFarDepth('sampled')}) continue;
|
|
260
|
+
|
|
261
|
+
vec3 v = viewPosition(uv, sampled) - p;
|
|
262
|
+
float vv = dot(v, v);
|
|
263
|
+
/* Past the radius it is a different surface rather than a neighbour of this one. */
|
|
264
|
+
if (vv > uRadius * uRadius) continue;
|
|
265
|
+
sum += max(0.0, dot(v, n) - AO_BIAS * (-p.z)) / (vv + AO_EPSILON);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
fragColor = clamp(1.0 - 2.0 * uRadius * sum / float(AO_TAPS), 0.0, 1.0);
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* One direction of the blur. Run twice, across and then down.
|
|
274
|
+
*
|
|
275
|
+
* Separable, so a four-wide square costs eight taps rather than sixteen, and **depth-aware**,
|
|
276
|
+
* so it does not carry a car's occlusion out onto the wall behind it. That second part is
|
|
277
|
+
* what separates a blur from a smear: an ordinary gaussian over this estimate produces a
|
|
278
|
+
* dark halo around every silhouette, which is more obviously wrong than the noise it was
|
|
279
|
+
* added to remove.
|
|
280
|
+
*/
|
|
281
|
+
export const AO_BLUR_FRAG = `#version 300 es
|
|
282
|
+
precision highp float;
|
|
283
|
+
|
|
284
|
+
in vec2 vUv;
|
|
285
|
+
|
|
286
|
+
uniform sampler2D uAo;
|
|
287
|
+
/** highp for the same reason as the estimate: a lowp sampler may return eight bits, and a
|
|
288
|
+
blur that decides what an edge is from eight-bit depth finds edges that are not there. */
|
|
289
|
+
uniform highp sampler2D uDepth;
|
|
290
|
+
/** One texel across, in UV, along the axis being blurred. The other component is zero. */
|
|
291
|
+
uniform vec2 uStep;
|
|
292
|
+
/**
|
|
293
|
+
* Turns a depth sample into view-space metres, as (m22, m32, m23, m33) of the inverse
|
|
294
|
+
* projection. The whole matrix is not needed to answer how far away a pixel is, and the blur
|
|
295
|
+
* asks that question five times per pixel.
|
|
296
|
+
*/
|
|
297
|
+
uniform vec4 uDepthToViewZ;
|
|
298
|
+
|
|
299
|
+
out float fragColor;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* How far apart two pixels may be, as a fraction of their distance from the eye, before they
|
|
303
|
+
* stop being the same surface.
|
|
304
|
+
*
|
|
305
|
+
* Relative rather than absolute, because the same 5 cm step is a cliff on a dashboard and
|
|
306
|
+
* nothing at all on a far wall.
|
|
307
|
+
*/
|
|
308
|
+
const float AO_BLUR_DEPTH_TOLERANCE = 0.02;
|
|
309
|
+
|
|
310
|
+
float viewZ(float depth) {
|
|
311
|
+
float ndc = ${glslSceneDepthToNdc('depth')};
|
|
312
|
+
return (uDepthToViewZ.x * ndc + uDepthToViewZ.y) / (uDepthToViewZ.z * ndc + uDepthToViewZ.w);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
void main() {
|
|
316
|
+
float centre = viewZ(textureLod(uDepth, vUv, 0.0).r);
|
|
317
|
+
float tolerance = AO_BLUR_DEPTH_TOLERANCE * abs(centre) + 1e-4;
|
|
318
|
+
float sum = 0.0;
|
|
319
|
+
float weight = 0.0;
|
|
320
|
+
/*
|
|
321
|
+
* **Eight consecutive pixels: two whole periods of the rotation tile, not one.**
|
|
322
|
+
*
|
|
323
|
+
* One period was the original design and it is a quarter of a denoiser. The estimate is
|
|
324
|
+
* twelve taps of a noisy quantity, and it is only usable because a run of pixels averages
|
|
325
|
+
* the sixteen rotations of the 4x4 tile back into one kernel — but averaging four estimates
|
|
326
|
+
* divides their noise by two, and two of those four are the *same* pixel's neighbours seen
|
|
327
|
+
* from one side. What reached the screen was a soft field with a visible grain in it, and
|
|
328
|
+
* along every silhouette something worse.
|
|
329
|
+
*
|
|
330
|
+
* **The edge is what forces the second period.** The weight below is designed to fall to zero
|
|
331
|
+
* across a depth edge, so a pixel beside a rail keeps only the taps on its own side. With a
|
|
332
|
+
* four-wide window that can be a single tap — one rotation out of sixteen, at the tile's own
|
|
333
|
+
* four-pixel period, running along the edge. That is the dotted line reported along every
|
|
334
|
+
* rail, and no amount of care in the estimate removes it, because the estimate was never
|
|
335
|
+
* meant to stand alone. Eight wide, a pixel hard against an edge still has four consecutive
|
|
336
|
+
* taps on its own side, which is every phase exactly once — the kernel the estimate was
|
|
337
|
+
* designed around, recovered on the one side it can be recovered from.
|
|
338
|
+
*
|
|
339
|
+
* The cost is four more taps an axis on a single-channel target, and what it buys back is the
|
|
340
|
+
* halving of the noise that the four-wide window was already relying on and not getting.
|
|
341
|
+
*/
|
|
342
|
+
for (int i = -3; i <= 4; i++) {
|
|
343
|
+
vec2 uv = vUv + uStep * float(i);
|
|
344
|
+
float z = viewZ(textureLod(uDepth, uv, 0.0).r);
|
|
345
|
+
/* One if this neighbour is on the same surface, falling to zero across an edge. */
|
|
346
|
+
float w = max(0.0, 1.0 - abs(z - centre) / tolerance);
|
|
347
|
+
sum += textureLod(uAo, uv, 0.0).r * w;
|
|
348
|
+
weight += w;
|
|
349
|
+
}
|
|
350
|
+
/* An isolated pixel — a thin rail against a far wall — keeps its own estimate rather than
|
|
351
|
+
dividing by nothing. */
|
|
352
|
+
fragColor = weight > 0.0 ? sum / weight : textureLod(uAo, vUv, 0.0).r;
|
|
353
|
+
}
|
|
354
|
+
`;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { FOG_GLSL } from './fog.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An arcane aura: the volume a floating object sits inside.
|
|
5
|
+
*
|
|
6
|
+
* Pairs with `PLUME_VERT`, exactly as `FIRE_FRAG` does — the vertex stage only builds
|
|
7
|
+
* a world-fixed cross of quads, and which effect that cross becomes is entirely a
|
|
8
|
+
* fragment-stage decision. So this costs no new renderer and no new geometry path.
|
|
9
|
+
*
|
|
10
|
+
* Where a flame is carved *vertically* — a taper toward the tip, a threshold rising
|
|
11
|
+
* with height, so it licks and breaks up — a spell is carved *radially*. Everything
|
|
12
|
+
* below works in polar coordinates about the quad centre: a bright thin core, a wide
|
|
13
|
+
* soft corona, and two noise bands turning in opposite directions.
|
|
14
|
+
*
|
|
15
|
+
* The counter-rotation is the whole effect. One band turning alone reads as a sheet
|
|
16
|
+
* being spun, which is the same flatness `BLADES` describes for a billboarded fire;
|
|
17
|
+
* two bands shearing against each other have no single rotation to read, so the eye
|
|
18
|
+
* gets motion without direction. That is what separates a spell from a lamp on a
|
|
19
|
+
* dimmer.
|
|
20
|
+
*/
|
|
21
|
+
export const ARCANE_FRAG = `#version 300 es
|
|
22
|
+
precision highp float;
|
|
23
|
+
|
|
24
|
+
in vec2 vUv;
|
|
25
|
+
in float vSeed;
|
|
26
|
+
in float vDistance;
|
|
27
|
+
in vec3 vWorldPos;
|
|
28
|
+
|
|
29
|
+
uniform float uTime;
|
|
30
|
+
${FOG_GLSL}
|
|
31
|
+
uniform int uNoiseOctaves;
|
|
32
|
+
uniform vec4 uClipPlane;
|
|
33
|
+
uniform int uClipEnabled;
|
|
34
|
+
/** The caller's colour, so an aura shifts with the world's own palette. */
|
|
35
|
+
uniform vec3 uTint;
|
|
36
|
+
|
|
37
|
+
out vec4 outColor;
|
|
38
|
+
|
|
39
|
+
float hash21(vec2 p) {
|
|
40
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
float valueNoise(vec2 p) {
|
|
44
|
+
vec2 i = floor(p);
|
|
45
|
+
vec2 f = fract(p);
|
|
46
|
+
vec2 u = f * f * (3.0 - 2.0 * f);
|
|
47
|
+
return mix(
|
|
48
|
+
mix(hash21(i), hash21(i + vec2(1.0, 0.0)), u.x),
|
|
49
|
+
mix(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(1.0, 1.0)), u.x),
|
|
50
|
+
u.y
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void main() {
|
|
55
|
+
if (uClipEnabled != 0 && dot(vec4(vWorldPos, 1.0), uClipPlane) < 0.0) discard;
|
|
56
|
+
|
|
57
|
+
// Polar about the quad centre. This is the line that makes it an orb rather
|
|
58
|
+
// than a column; everything downstream reads radius and angle, never height.
|
|
59
|
+
float radius = length(vUv - 0.5) * 2.0;
|
|
60
|
+
if (radius >= 1.0) discard;
|
|
61
|
+
|
|
62
|
+
vec2 d = vUv - 0.5;
|
|
63
|
+
float angle = atan(d.y, d.x);
|
|
64
|
+
float t = uTime + vSeed * 37.0;
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* Two bands, turning opposite ways at different rates. Sampled in (angle, radius)
|
|
68
|
+
* space so the noise wraps around the disc instead of sliding across it — noise in
|
|
69
|
+
* UV space would drift off one edge and read as a texture being scrolled.
|
|
70
|
+
*/
|
|
71
|
+
float inner = valueNoise(vec2(angle * 1.9 + t * 0.55, radius * 4.2));
|
|
72
|
+
float outer = valueNoise(vec2(angle * 3.1 - t * 0.34, radius * 2.6));
|
|
73
|
+
float swirl = inner * 0.62 + outer * 0.38;
|
|
74
|
+
if (uNoiseOctaves > 1) {
|
|
75
|
+
swirl = mix(swirl, swirl * valueNoise(vec2(angle * 6.3 + t * 0.9, radius * 8.0)) * 2.0, 0.35);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* Core and corona as two separate falloffs rather than one curve. A single falloff
|
|
80
|
+
* gives a blob; what makes this read as *contained energy* is a small bright centre
|
|
81
|
+
* with a much wider, much fainter halo, so the object inside stays legible.
|
|
82
|
+
*/
|
|
83
|
+
float core = 1.0 - smoothstep(0.0, 0.28, radius);
|
|
84
|
+
float corona = (1.0 - smoothstep(0.18, 1.0, radius)) * (0.35 + swirl * 0.65);
|
|
85
|
+
float body = core * 0.9 + corona;
|
|
86
|
+
if (body <= 0.02) discard;
|
|
87
|
+
|
|
88
|
+
// Hot centre through the tint to a dark rim, so the core reads as white-hot
|
|
89
|
+
// energy and the edge as the colour it is made of.
|
|
90
|
+
vec3 col = mix(uTint * 0.35, uTint, smoothstep(0.0, 0.55, body));
|
|
91
|
+
col = mix(col, vec3(1.0), smoothstep(0.82, 1.4, body));
|
|
92
|
+
col *= uTint;
|
|
93
|
+
|
|
94
|
+
float alpha = clamp(body * 1.6, 0.0, 1.0);
|
|
95
|
+
// Additive light must lose alpha as it scatters, or mixing its colour alone
|
|
96
|
+
// still makes a distant aura glow through fog and through water.
|
|
97
|
+
float fog = mediumFog(vDistance, vWorldPos.y);
|
|
98
|
+
col = mix(col, mediumColor(), fog);
|
|
99
|
+
alpha *= 1.0 - fog;
|
|
100
|
+
|
|
101
|
+
outColor = vec4(col, alpha);
|
|
102
|
+
}
|
|
103
|
+
`;
|