@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,276 @@
|
|
|
1
|
+
/** The convolutions that fill one level of one probe layer, reflection and ambient alike. */
|
|
2
|
+
import { OCTAHEDRAL_GLSL } from './octahedral.js';
|
|
3
|
+
/**
|
|
4
|
+
* One level of one probe layer, convolved with the lobe that level stands for.
|
|
5
|
+
*
|
|
6
|
+
* **Directions, not texture coordinates**, for the same reason the mip blit it replaces used
|
|
7
|
+
* them: the neighbouring texels across a cube edge belong to a different face, and taking them
|
|
8
|
+
* from the same face is exactly how a seam appears along every edge. The fragment rebuilds the
|
|
9
|
+
* direction its texel stands for and samples the cube, which crosses edges the way the hardware
|
|
10
|
+
* does when the shader reads it back later.
|
|
11
|
+
*
|
|
12
|
+
* **The target is one octahedral layer rather than six cube faces**, so a level is one draw
|
|
13
|
+
* instead of six and there is no face basis at all — `octInsetDir` turns a texel into the
|
|
14
|
+
* direction it holds, and in the level's one-texel gutter that direction is the folded one. The
|
|
15
|
+
* source stays a cube, which is what `sourceLevelForSample`'s six-face solid angle assumes.
|
|
16
|
+
*
|
|
17
|
+
* **Two kernels, one pass.** Levels up to the GGX chain's top convolve against the lobe; the level
|
|
18
|
+
* above it convolves against the cosine and is the scene's diffuse ambient. They differ in the
|
|
19
|
+
* weight and in nothing else, so `uPrefilterIrradiance` chooses between them and the whole rest of
|
|
20
|
+
* the shader is shared. That fold is what lets one binding carry both terms and keeps the last
|
|
21
|
+
* texture unit free.
|
|
22
|
+
*
|
|
23
|
+
* **It samples a cube and writes an array, which are different objects by construction.**
|
|
24
|
+
* `uPrefilterSource` is the captured probe with its box-filtered chain, and it is one scratch cube
|
|
25
|
+
* reused by every probe in the grid rather than one per layer. That buys two things: WebGL2's
|
|
26
|
+
* feedback-loop check is per texture object, so a draw sampling the source while a layer of the
|
|
27
|
+
* target is attached never arises; and a level is never convolved from a level that was already
|
|
28
|
+
* convolved, which applies the lobe twice and compounds up the chain.
|
|
29
|
+
*
|
|
30
|
+
* **The approximation, stated because it is the one people are surprised by.** This is the split
|
|
31
|
+
* of the specular integral everybody uses: the view direction is assumed equal to the normal and
|
|
32
|
+
* to the reflection direction, so a level cannot know about stretched grazing highlights and a
|
|
33
|
+
* rough metal seen edge-on reflects a slightly rounder lobe than it should. That is what buys a
|
|
34
|
+
* bake that depends on roughness alone rather than on roughness and view angle, which is the
|
|
35
|
+
* difference between one cube and a cube per camera. **What would make it wrong** is a scene
|
|
36
|
+
* where grazing metal is the subject rather than incidental.
|
|
37
|
+
*/
|
|
38
|
+
export const PREFILTER_FRAG = `#version 300 es
|
|
39
|
+
precision highp float;
|
|
40
|
+
|
|
41
|
+
${OCTAHEDRAL_GLSL}
|
|
42
|
+
|
|
43
|
+
in vec2 vUv;
|
|
44
|
+
|
|
45
|
+
/** The captured probe, box-filtered, which this convolves. Never the cube being written. */
|
|
46
|
+
uniform highp samplerCube uPrefilterSource;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The edge of the level being written, in texels, which is what the inset is derived from.
|
|
50
|
+
*
|
|
51
|
+
* The level's own size rather than the array's, because a gutter is one texel at every level and
|
|
52
|
+
* its share of the map therefore doubles as the chain coarsens. A base edge passed here instead
|
|
53
|
+
* would inset every level by the base's fraction, which is a fifth of a texel at the top of the
|
|
54
|
+
* chain and reads as the reflection sliding as roughness rises.
|
|
55
|
+
*/
|
|
56
|
+
uniform float uPrefilterEdge;
|
|
57
|
+
|
|
58
|
+
/** 1 on the level holding the cosine convolution, 0 on every level of the reflection chain. */
|
|
59
|
+
uniform float uPrefilterIrradiance;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 1 when the reflection chain is a box filter rather than a GGX convolution.
|
|
63
|
+
*
|
|
64
|
+
* RenderQuality.environmentPrefilter is off by default, and that default is a correction rather
|
|
65
|
+
* than a preference: the prefilter shipped wired straight into the lit pass and changed the
|
|
66
|
+
* picture of every consumer that had a probe, which was reported as metals reading opaque. A
|
|
67
|
+
* profile that has not asked for the lobe chain must get the same reflection it had before probes
|
|
68
|
+
* moved into an array, so the box arm exists and is what that profile bakes.
|
|
69
|
+
*
|
|
70
|
+
* The array edge is twice the source cube's face, so one array level matches one cube level in
|
|
71
|
+
* angular density and the box arm is a single fetch at the same index. There is no second
|
|
72
|
+
* texture: the flag decides what is convolved into the layer rather than which of two chains is
|
|
73
|
+
* bound, so it is read at bake time and a profile that changes it has to bake again.
|
|
74
|
+
*/
|
|
75
|
+
uniform float uPrefilterBox;
|
|
76
|
+
|
|
77
|
+
/** The level being written, for the box arm, which reads the source chain at the same index. */
|
|
78
|
+
uniform float uPrefilterLevel;
|
|
79
|
+
|
|
80
|
+
/** The roughness this level stands for, from roughnessForLevel. 0 is a mirror. */
|
|
81
|
+
uniform float uPrefilterRoughness;
|
|
82
|
+
/** Samples per texel, from PREFILTER_SAMPLE_COUNTS. A power of two; see the count's own note. */
|
|
83
|
+
uniform float uPrefilterSamples;
|
|
84
|
+
/** The source cube's face width in texels, for the solid-angle comparison below. */
|
|
85
|
+
uniform float uPrefilterSourceTexels;
|
|
86
|
+
/** The source chain's top level, so a wide sample cannot ask for a level that is not there. */
|
|
87
|
+
uniform float uPrefilterSourceMaxLod;
|
|
88
|
+
|
|
89
|
+
out vec4 fragColor;
|
|
90
|
+
|
|
91
|
+
const float PI = 3.14159265359;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The radical inverse of a 32-bit integer, base two: the second dimension of a Hammersley set.
|
|
95
|
+
*
|
|
96
|
+
* A bit reversal, written as the standard five-shift sequence rather than a loop, because a loop
|
|
97
|
+
* over 32 bits per sample per texel is the one place in a bake where the arithmetic is the cost.
|
|
98
|
+
* **This is why every sample count is a power of two** — the sequence's stratification is only
|
|
99
|
+
* even when the count is, and an uneven one shows as a faint directional bias in a rough level
|
|
100
|
+
* rather than as an error anybody would notice.
|
|
101
|
+
*/
|
|
102
|
+
float radicalInverse(uint bits) {
|
|
103
|
+
bits = (bits << 16u) | (bits >> 16u);
|
|
104
|
+
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
105
|
+
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
106
|
+
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
107
|
+
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
108
|
+
return float(bits) * 2.3283064365386963e-10;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A half vector drawn from the GGX distribution about the normal, for one Hammersley pair.
|
|
113
|
+
*
|
|
114
|
+
* Importance sampling rather than a uniform hemisphere: at low roughness the lobe occupies a
|
|
115
|
+
* vanishing fraction of the hemisphere, so uniform samples would put almost every one of them
|
|
116
|
+
* where the weight is zero and the few that land in the lobe would carry all the variance.
|
|
117
|
+
*/
|
|
118
|
+
vec3 importanceSampleGgx(vec2 xi, vec3 n, float roughness) {
|
|
119
|
+
float a = roughness * roughness;
|
|
120
|
+
|
|
121
|
+
float phi = 2.0 * PI * xi.x;
|
|
122
|
+
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));
|
|
123
|
+
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
|
124
|
+
|
|
125
|
+
vec3 h = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* Any tangent will do as long as it is not parallel to the normal, and the choice of which
|
|
129
|
+
* axis to cross against has to depend on the normal or it degenerates at the poles — which is
|
|
130
|
+
* one face of six coming out as noise, on the two faces the axis points at.
|
|
131
|
+
*/
|
|
132
|
+
vec3 up = abs(n.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
133
|
+
vec3 tangentX = normalize(cross(up, n));
|
|
134
|
+
vec3 tangentY = cross(n, tangentX);
|
|
135
|
+
|
|
136
|
+
return normalize(tangentX * h.x + tangentY * h.y + n * h.z);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* A direction drawn from the cosine lobe about the normal, for the diffuse level.
|
|
141
|
+
*
|
|
142
|
+
* **Cosine-weighted, which is what makes the estimator a plain mean.** Irradiance is
|
|
143
|
+
* integral of L cos(theta), the cosine pdf is cos(theta) / pi, so the estimate is
|
|
144
|
+
* pi / N * sum(L) — and what the lit pass wants is radiance rather than irradiance, so the pi
|
|
145
|
+
* divides straight back out. irradianceSh.ts folds the same division into its band factors and
|
|
146
|
+
* says so, which is what makes a grid of one reproduce what the projection produced.
|
|
147
|
+
*/
|
|
148
|
+
vec3 importanceSampleCosine(vec2 xi, vec3 n) {
|
|
149
|
+
float phi = 2.0 * PI * xi.x;
|
|
150
|
+
float cosTheta = sqrt(max(1.0 - xi.y, 0.0));
|
|
151
|
+
float sinTheta = sqrt(xi.y);
|
|
152
|
+
|
|
153
|
+
vec3 h = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
|
|
154
|
+
|
|
155
|
+
vec3 up = abs(n.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
156
|
+
vec3 tangentX = normalize(cross(up, n));
|
|
157
|
+
vec3 tangentY = cross(n, tangentX);
|
|
158
|
+
|
|
159
|
+
return normalize(tangentX * h.x + tangentY * h.y + n * h.z);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Trowbridge-Reitz, in its own normalisation, because this is a probability rather than a look. */
|
|
163
|
+
float ggxDistribution(float ndh, float roughness) {
|
|
164
|
+
float a = roughness * roughness;
|
|
165
|
+
float a2 = a * a;
|
|
166
|
+
float d = ndh * ndh * (a2 - 1.0) + 1.0;
|
|
167
|
+
return a2 / max(PI * d * d, 1e-8);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void main() {
|
|
171
|
+
vec3 n = octInsetDir(vUv, uPrefilterEdge);
|
|
172
|
+
|
|
173
|
+
float texelSolidAngle = 4.0 * PI / (6.0 * uPrefilterSourceTexels * uPrefilterSourceTexels);
|
|
174
|
+
|
|
175
|
+
/*
|
|
176
|
+
* The box chain, which is one fetch: the source's own level at the same index, resampled through
|
|
177
|
+
* the octahedral mapping. It is what a profile that has not asked for the lobe chain gets, and
|
|
178
|
+
* it is the picture every consumer with a probe already had.
|
|
179
|
+
*/
|
|
180
|
+
if (uPrefilterBox > 0.5 && uPrefilterIrradiance <= 0.5) {
|
|
181
|
+
fragColor = vec4(
|
|
182
|
+
textureLod(uPrefilterSource, n, min(uPrefilterLevel, uPrefilterSourceMaxLod)).rgb,
|
|
183
|
+
1.0
|
|
184
|
+
);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
* **The diffuse level, and it is a mean rather than a weighted sum.** Every cosine sample is
|
|
190
|
+
* drawn with the weight already in its density, so there is nothing to accumulate a weight for
|
|
191
|
+
* and nothing to divide by but the count. A sample below the horizon cannot occur, which is the
|
|
192
|
+
* other half of why this arm has no continue in it.
|
|
193
|
+
*/
|
|
194
|
+
if (uPrefilterIrradiance > 0.5) {
|
|
195
|
+
vec3 diffuse = vec3(0.0);
|
|
196
|
+
int cosineSamples = int(uPrefilterSamples);
|
|
197
|
+
for (int i = 0; i < cosineSamples; i++) {
|
|
198
|
+
vec2 xi = vec2(float(i) / uPrefilterSamples, radicalInverse(uint(i)));
|
|
199
|
+
vec3 l = importanceSampleCosine(xi, n);
|
|
200
|
+
/*
|
|
201
|
+
* The same filtered importance sampling the reflection uses, against the cosine density.
|
|
202
|
+
* A diffuse sample is wide — a sixth of the sphere at the median — so reading the base level
|
|
203
|
+
* would carry a bright window through as a handful of fireflies in the ambient, which is the
|
|
204
|
+
* one place they cannot be blurred out later.
|
|
205
|
+
*/
|
|
206
|
+
float pdf = max(dot(n, l) / PI, 1e-4);
|
|
207
|
+
float sampleSolidAngle = 1.0 / (uPrefilterSamples * pdf);
|
|
208
|
+
float lod = clamp(
|
|
209
|
+
0.5 * log2(sampleSolidAngle / texelSolidAngle),
|
|
210
|
+
0.0,
|
|
211
|
+
uPrefilterSourceMaxLod
|
|
212
|
+
);
|
|
213
|
+
diffuse += textureLod(uPrefilterSource, l, lod).rgb;
|
|
214
|
+
}
|
|
215
|
+
fragColor = vec4(diffuse / max(uPrefilterSamples, 1.0), 1.0);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
* A mirror is a fetch rather than an integral, and it is a separate arm on purpose: at
|
|
221
|
+
* roughness 0 the distribution is a delta, every importance sample collapses onto the same
|
|
222
|
+
* direction, and the sum is one sample's worth of noise where the answer is exactly the texel.
|
|
223
|
+
*/
|
|
224
|
+
if (uPrefilterRoughness <= 0.0) {
|
|
225
|
+
fragColor = vec4(textureLod(uPrefilterSource, n, 0.0).rgb, 1.0);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
vec3 sum = vec3(0.0);
|
|
230
|
+
float weight = 0.0;
|
|
231
|
+
|
|
232
|
+
int samples = int(uPrefilterSamples);
|
|
233
|
+
for (int i = 0; i < samples; i++) {
|
|
234
|
+
vec2 xi = vec2(float(i) / uPrefilterSamples, radicalInverse(uint(i)));
|
|
235
|
+
vec3 h = importanceSampleGgx(xi, n, uPrefilterRoughness);
|
|
236
|
+
vec3 l = normalize(2.0 * dot(n, h) * h - n);
|
|
237
|
+
|
|
238
|
+
float ndl = dot(n, l);
|
|
239
|
+
if (ndl <= 0.0) continue;
|
|
240
|
+
|
|
241
|
+
/*
|
|
242
|
+
* Filtered importance sampling. A sample covers 1 / (count * pdf) of the sphere; when that
|
|
243
|
+
* is much wider than a texel, reading the base level lets a few very bright texels land in
|
|
244
|
+
* some samples and not others, and the variance survives the average as fireflies. The half
|
|
245
|
+
* in front of the logarithm is a length ratio against an area one — a level step doubles a
|
|
246
|
+
* texel's width and quadruples its solid angle. sourceLevelForSample holds the same
|
|
247
|
+
* arithmetic on the CPU and its test carries the hand-derived numbers.
|
|
248
|
+
*/
|
|
249
|
+
float ndh = max(dot(n, h), 0.0);
|
|
250
|
+
float pdf = max(ggxDistribution(ndh, uPrefilterRoughness) * 0.25, 1e-8);
|
|
251
|
+
float sampleSolidAngle = 1.0 / (uPrefilterSamples * pdf);
|
|
252
|
+
float lod = clamp(
|
|
253
|
+
0.5 * log2(sampleSolidAngle / texelSolidAngle),
|
|
254
|
+
0.0,
|
|
255
|
+
uPrefilterSourceMaxLod
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
/*
|
|
259
|
+
* textureLod rather than texture, and the 2026-08-07 rule is why: this fetch sits inside a
|
|
260
|
+
* loop with a continue in it, which no compiler can prove uniform, and an implicit derivative
|
|
261
|
+
* in non-uniform control flow is what lets a driver flatten the loop and cost every arm.
|
|
262
|
+
* The level is wanted here anyway, so the rule costs nothing at all.
|
|
263
|
+
*/
|
|
264
|
+
sum += textureLod(uPrefilterSource, l, lod).rgb * ndl;
|
|
265
|
+
weight += ndl;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/*
|
|
269
|
+
* Normalised by the accumulated weight rather than by the sample count, because samples with
|
|
270
|
+
* a light below the horizon were skipped and dividing by the count would darken every rough
|
|
271
|
+
* level by the fraction that missed — which reads as roughness losing energy and is exactly
|
|
272
|
+
* the artefact uEnvironmentGain has been compensating for.
|
|
273
|
+
*/
|
|
274
|
+
fragColor = vec4(sum / max(weight, 1e-4), 1.0);
|
|
275
|
+
}
|
|
276
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The speed rush: a radial blur over a finished frame.
|
|
3
|
+
*
|
|
4
|
+
* The post-process seam, and the first effect hung off it. A game asks for speed to be
|
|
5
|
+
* *felt* rather than only read, and the two halves of that are zoom — which a camera can
|
|
6
|
+
* do on its own, by widening its field of view — and blur, which nothing can do without a
|
|
7
|
+
* finished frame to sample. So this is a fullscreen pass over the resolved scene.
|
|
8
|
+
*
|
|
9
|
+
* **Peripheral on purpose.** Blurring what a player is looking at fights the game; blurring
|
|
10
|
+
* what is rushing past them is the sensation itself. So the centre stays sharp and the
|
|
11
|
+
* softening lives at the edges, and the sharp region *narrows* as speed builds, which reads
|
|
12
|
+
* as the world closing in rather than as a filter fading up.
|
|
13
|
+
*
|
|
14
|
+
* The taps are radial — each sample steps *outward from the centre*, along the direction
|
|
15
|
+
* the world is streaming past — rather than a box or a gaussian. A symmetric blur just
|
|
16
|
+
* loses detail; smearing along the flow is what the eye reads as motion. Six taps, because
|
|
17
|
+
* this is a second pass over every pixel on a renderer whose hard gate is 60 fps on a
|
|
18
|
+
* mid-range phone: the cost is fixed and small, and at zero strength the loop still runs
|
|
19
|
+
* but every tap lands on the same texel, so the frame is bit-identical to no blur at all.
|
|
20
|
+
*/
|
|
21
|
+
export declare const RUSH_FRAG: string;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The speed rush: a radial blur over a finished frame.
|
|
3
|
+
*
|
|
4
|
+
* The post-process seam, and the first effect hung off it. A game asks for speed to be
|
|
5
|
+
* *felt* rather than only read, and the two halves of that are zoom — which a camera can
|
|
6
|
+
* do on its own, by widening its field of view — and blur, which nothing can do without a
|
|
7
|
+
* finished frame to sample. So this is a fullscreen pass over the resolved scene.
|
|
8
|
+
*
|
|
9
|
+
* **Peripheral on purpose.** Blurring what a player is looking at fights the game; blurring
|
|
10
|
+
* what is rushing past them is the sensation itself. So the centre stays sharp and the
|
|
11
|
+
* softening lives at the edges, and the sharp region *narrows* as speed builds, which reads
|
|
12
|
+
* as the world closing in rather than as a filter fading up.
|
|
13
|
+
*
|
|
14
|
+
* The taps are radial — each sample steps *outward from the centre*, along the direction
|
|
15
|
+
* the world is streaming past — rather than a box or a gaussian. A symmetric blur just
|
|
16
|
+
* loses detail; smearing along the flow is what the eye reads as motion. Six taps, because
|
|
17
|
+
* this is a second pass over every pixel on a renderer whose hard gate is 60 fps on a
|
|
18
|
+
* mid-range phone: the cost is fixed and small, and at zero strength the loop still runs
|
|
19
|
+
* but every tap lands on the same texel, so the frame is bit-identical to no blur at all.
|
|
20
|
+
*/
|
|
21
|
+
/* The vertex stage is `FULLSCREEN_VERT`, shared with the occlusion pass and its blur. */
|
|
22
|
+
import { glslSceneDepthToNdc } from '../depthConvention.js';
|
|
23
|
+
import { DEPTH_OF_FIELD_GLSL } from './depthOfField.js';
|
|
24
|
+
export const RUSH_FRAG = `#version 300 es
|
|
25
|
+
precision highp float;
|
|
26
|
+
|
|
27
|
+
in vec2 vUv;
|
|
28
|
+
|
|
29
|
+
uniform sampler2D uScene;
|
|
30
|
+
/** 0 for a stationary character, 1 at the fastest the game allows. */
|
|
31
|
+
uniform float uStrength;
|
|
32
|
+
/**
|
|
33
|
+
* How far the outermost tap reaches, in UV, and where the sharp centre ends.
|
|
34
|
+
*
|
|
35
|
+
* Both scale with strength inside the shader rather than being pre-multiplied by the
|
|
36
|
+
* caller, so a single uniform drives the whole effect and there is one place to reason
|
|
37
|
+
* about what "full speed" looks like.
|
|
38
|
+
*/
|
|
39
|
+
uniform float uReach;
|
|
40
|
+
/*
|
|
41
|
+
* The grade, which used to live in the mesh pass and now lives here.
|
|
42
|
+
*
|
|
43
|
+
* **It moved because a curve applied before the buffer throws away the range the buffer keeps.**
|
|
44
|
+
* The mesh shader graded and clipped, so everything downstream saw a scene already squashed into
|
|
45
|
+
* 0 to 1 and a star was indistinguishable from white paint. Grading at the end means the scene
|
|
46
|
+
* target holds what the scene actually emitted.
|
|
47
|
+
*
|
|
48
|
+
* It also fixes an inconsistency nobody had noticed: the mesh pass was the *only* pass that
|
|
49
|
+
* graded, so the sky, the particles, the wet film and the water were composited ungraded beside
|
|
50
|
+
* a world that was. One curve at the end covers every pass by construction.
|
|
51
|
+
*
|
|
52
|
+
* Zero is no transform, which leaves the scene exactly as it arrived and is the default.
|
|
53
|
+
*/
|
|
54
|
+
uniform int uOutputTransform;
|
|
55
|
+
uniform float uOutputExposure;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The frame's depth, and the matrix that carries a pixel back to where it was last frame.
|
|
59
|
+
*
|
|
60
|
+
* uReprojection is the previous view-projection times the inverse of this frame's, so one
|
|
61
|
+
* matrix multiply takes a point from this frame's clip space to the last one's. Built on the
|
|
62
|
+
* CPU because it is one multiply per frame there and would be one per *pixel* here.
|
|
63
|
+
*
|
|
64
|
+
* **highp on the sampler, and it is not decoration.** GLSL ES gives a fragment shader's
|
|
65
|
+
* samplers a default
|
|
66
|
+
* precision of *lowp*, whatever precision highp float says at the top of the file — that
|
|
67
|
+
* line sets the default for float, not for a sampler. A lowp sampler is entitled to hand
|
|
68
|
+
* back eight bits, and a depth buffer read at eight bits is a scene flattened onto about two
|
|
69
|
+
* hundred and fifty planes.
|
|
70
|
+
*
|
|
71
|
+
* Measured on this driver rather than assumed: with the qualifier absent, every depth sample
|
|
72
|
+
* in the frame came back an exact multiple of a power of two, the low bits of the encoded
|
|
73
|
+
* depth were zero across the whole image, and a run of pixels along a wall read one identical
|
|
74
|
+
* value. With it, they vary per pixel. Camera motion blur has been reprojecting through that
|
|
75
|
+
* since it shipped, which is a smear built on a staircase.
|
|
76
|
+
*/
|
|
77
|
+
uniform highp sampler2D uDepth;
|
|
78
|
+
uniform mat4 uReprojection;
|
|
79
|
+
/** 0 disables camera motion blur entirely, and is the default. */
|
|
80
|
+
uniform float uMotionStrength;
|
|
81
|
+
/** A ceiling on the smear, in UV, so a fast turn softens the frame rather than erasing it. */
|
|
82
|
+
uniform float uMotionMax;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Ambient occlusion, already estimated and blurred by its own pass. 1 is open, 0 is enclosed.
|
|
86
|
+
*
|
|
87
|
+
* Read rather than computed here, and that is a decision made by looking: twelve depth taps
|
|
88
|
+
* per pixel is a noisy estimate of a smooth quantity, and used raw it is salt and pepper over
|
|
89
|
+
* every surface in the frame. See ambientOcclusion.ts for the pass and the sampling.
|
|
90
|
+
*
|
|
91
|
+
* uAoStrength is how much of it to apply, 0 for none, and 0 is the default. It also carries
|
|
92
|
+
* the honest failure: the pass that fills this can decline to run, and this then arrives as
|
|
93
|
+
* zero rather than as a multiply by a texture nobody wrote.
|
|
94
|
+
*/
|
|
95
|
+
uniform sampler2D uAo;
|
|
96
|
+
uniform float uAoStrength;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The bloom chain's top level, already thresholded, blurred and summed by its own pass.
|
|
100
|
+
*
|
|
101
|
+
* Added rather than mixed, in linear scene units, before the grade: bloom is light arriving at
|
|
102
|
+
* the eye from beside a bright thing, so it adds to what is there and then rolls off through
|
|
103
|
+
* the same curve as everything else. Mixing would darken the source to pay for its own halo,
|
|
104
|
+
* which is the look of a filter rather than of a bright object.
|
|
105
|
+
*
|
|
106
|
+
* uBloomStrength is how much of it to add, and 0 is the default and the whole of the off path:
|
|
107
|
+
* the branch below means a frame without bloom performs no fetch and no arithmetic, so it is
|
|
108
|
+
* the frame that existed before the effect did rather than one multiplied by zero.
|
|
109
|
+
*/
|
|
110
|
+
uniform sampler2D uBloom;
|
|
111
|
+
uniform float uBloomStrength;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The frame veil: a flat colour composited last, over the graded picture. See
|
|
115
|
+
* Renderer.setFrameVeil for the full ruling this ordering encodes; the short version:
|
|
116
|
+
*
|
|
117
|
+
* **After the tone map**, because a transition has to hit exact black and exact white
|
|
118
|
+
* deterministically — (0,0,0,1) pure black, (1,1,1,1) pure white — and a curve built to
|
|
119
|
+
* roll off makes "full white" an asymptote no caller could solve for.
|
|
120
|
+
*
|
|
121
|
+
* **Before anything that would run after this** — a vignette, a grain pass — were either ever
|
|
122
|
+
* added here, because the consumer's complaint was a veil painted over an *already finished*
|
|
123
|
+
* frame, which flattens that texture instead of fading with it. Mixed in here, ahead of the
|
|
124
|
+
* last operation the pass has, a dip takes the picture down with it rather than covering it.
|
|
125
|
+
*
|
|
126
|
+
* **Never feeds the bloom above**, by construction: bloom is resolved from the pre-tonemap
|
|
127
|
+
* scene before this fragment shader ever runs (see SceneTarget.resolve and runBloom), so a
|
|
128
|
+
* veil composited after it cannot brighten a threshold it never reaches. Dipping to white is a
|
|
129
|
+
* cut, not a light.
|
|
130
|
+
*
|
|
131
|
+
* uVeilAlpha 0 is the default and the whole of the off path: withVeil returns the pixel
|
|
132
|
+
* unmixed, so a frame with no veil performs no extra arithmetic.
|
|
133
|
+
*/
|
|
134
|
+
uniform vec3 uVeilColor;
|
|
135
|
+
uniform float uVeilAlpha;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The colour grade: a lookup table over display values, sampled after the tone map.
|
|
139
|
+
*
|
|
140
|
+
* **After the curve, because a grade is display-referred.** Every \`.cube\` a grading tool exports
|
|
141
|
+
* maps display values to display values — that is what a colourist was looking at when they made
|
|
142
|
+
* it — so applying it to scene units would be applying it to something it was never authored
|
|
143
|
+
* against. The transform above is a *conversion* and this is a *look*, and the look goes last of
|
|
144
|
+
* the two.
|
|
145
|
+
*
|
|
146
|
+
* **Before the veil, and \`uVeilAlpha\`'s own comment is the ruling.** It says the veil goes
|
|
147
|
+
* "before anything that would run after this — a vignette, a grain pass — were either ever added
|
|
148
|
+
* here, because the consumer's complaint was a veil painted over an *already finished* frame". A
|
|
149
|
+
* grade is exactly such a thing, so it arrives ahead of the veil and a dip to black takes the
|
|
150
|
+
* graded picture down with it rather than covering it.
|
|
151
|
+
*
|
|
152
|
+
* **\`uGradeStrength\` 0 is the default and the whole of the off path.** The branch below is on a
|
|
153
|
+
* uniform, which is provably uniform control flow, so a frame with no grade performs no fetch at
|
|
154
|
+
* all — this is not the 2026-08-07 case, where a compiler cannot prove a branch uniform and may
|
|
155
|
+
* flatten it. The fetch is still \`textureLod\` because the table has one storage level and there
|
|
156
|
+
* is nothing to select between.
|
|
157
|
+
*
|
|
158
|
+
* **The coordinate lands on texel centres.** A lattice value of \`i\` sits at \`(i + 0.5) / size\`,
|
|
159
|
+
* so the ends of the range reach the first and last texels exactly rather than half a texel short.
|
|
160
|
+
* Sampling at \`c\` directly would compress the whole table by one texel and darken every white in
|
|
161
|
+
* the frame by a fraction nobody would trace to a coordinate.
|
|
162
|
+
*/
|
|
163
|
+
/*
|
|
164
|
+
* **\`highp\` spelled out, because GLSL ES 3.00 gives \`sampler3D\` no default precision.**
|
|
165
|
+
*
|
|
166
|
+
* \`sampler2D\` has one in the fragment stage and every other sampler in this corpus relies on
|
|
167
|
+
* it; a 3D sampler does not, and the compiler answers \`'sampler3D' : No precision specified\`.
|
|
168
|
+
* The generator does not care: naga takes the declaration without a qualifier and produces
|
|
169
|
+
* correct WGSL, so this compiles, generates, validates and then **fails at runtime on WebGL2
|
|
170
|
+
* only** — the backend with nothing beneath it. That is the same shape as \`unpackUnorm4x8\` in
|
|
171
|
+
* the splat shader, a 3.10 builtin the generator accepts because it raises the version before
|
|
172
|
+
* handing the source to glslang.
|
|
173
|
+
*
|
|
174
|
+
* Found by driving the page rather than by review, on the first capture.
|
|
175
|
+
* \`samplerPrecision.test.ts\` asserts it from here on, over the whole corpus.
|
|
176
|
+
*/
|
|
177
|
+
uniform highp sampler3D uGradeLut;
|
|
178
|
+
uniform float uGradeStrength;
|
|
179
|
+
uniform float uGradeSize;
|
|
180
|
+
|
|
181
|
+
out vec4 fragColor;
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
* Depth of field, spliced in whole from depthOfField.ts.
|
|
185
|
+
*
|
|
186
|
+
* Below the uniforms it reads — uScene, uDepth and vUv — and above the functions that use it,
|
|
187
|
+
* because GLSL has no forward declarations and the order in this file is the order the compiler
|
|
188
|
+
* sees.
|
|
189
|
+
*/
|
|
190
|
+
${DEPTH_OF_FIELD_GLSL}
|
|
191
|
+
|
|
192
|
+
/*
|
|
193
|
+
* The same curve the mesh pass used to apply, moved here whole rather than reimplemented, so
|
|
194
|
+
* the two cannot drift. See the uniforms above for why it moved.
|
|
195
|
+
*/
|
|
196
|
+
vec3 linearToSrgb(vec3 c) {
|
|
197
|
+
vec3 low = c * 12.92;
|
|
198
|
+
vec3 high = 1.055 * pow(max(c, vec3(0.0)), vec3(1.0 / 2.4)) - 0.055;
|
|
199
|
+
return mix(low, high, step(vec3(0.0031308), c));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
vec3 acesFilmic(vec3 x) {
|
|
203
|
+
x *= uOutputExposure;
|
|
204
|
+
const mat3 ACES_INPUT = mat3(
|
|
205
|
+
0.59719, 0.07600, 0.02840,
|
|
206
|
+
0.35458, 0.90834, 0.13383,
|
|
207
|
+
0.04823, 0.01566, 0.83777
|
|
208
|
+
);
|
|
209
|
+
const mat3 ACES_OUTPUT = mat3(
|
|
210
|
+
1.60475, -0.10208, -0.00327,
|
|
211
|
+
-0.53108, 1.10813, -0.07276,
|
|
212
|
+
-0.07367, -0.00605, 1.07602
|
|
213
|
+
);
|
|
214
|
+
vec3 v = ACES_INPUT * x;
|
|
215
|
+
vec3 a = v * (v + 0.0245786) - 0.000090537;
|
|
216
|
+
vec3 b = v * (0.983729 * v + 0.4329510) + 0.238081;
|
|
217
|
+
return clamp(ACES_OUTPUT * (a / b), 0.0, 1.0);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
vec3 grade(vec3 c) {
|
|
221
|
+
if (uOutputTransform == 0) return c;
|
|
222
|
+
if (uOutputTransform == 2) c = acesFilmic(c);
|
|
223
|
+
return linearToSrgb(c);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** The frame's bloom, added in scene units. See the uniforms above for why it goes here. */
|
|
227
|
+
vec3 withBloom(vec3 c) {
|
|
228
|
+
if (uBloomStrength <= 0.0) return c;
|
|
229
|
+
return c + textureLod(uBloom, vUv, 0.0).rgb * uBloomStrength;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** The grade, sampled after the curve and before the veil. See uGradeLut's own comment. */
|
|
233
|
+
vec3 applyColourGrade(vec3 c) {
|
|
234
|
+
if (uGradeStrength <= 0.0) return c;
|
|
235
|
+
vec3 clamped = clamp(c, 0.0, 1.0);
|
|
236
|
+
vec3 uvw = (clamped * (uGradeSize - 1.0) + 0.5) / uGradeSize;
|
|
237
|
+
return mix(c, textureLod(uGradeLut, uvw, 0.0).rgb, uGradeStrength);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** The veil, mixed in last of everything this pass does. See uVeilAlpha's own comment. */
|
|
241
|
+
vec3 withVeil(vec3 c) {
|
|
242
|
+
if (uVeilAlpha <= 0.0) return c;
|
|
243
|
+
return mix(c, uVeilColor, uVeilAlpha);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Camera motion blur: reproject each pixel through the previous view and smear along the
|
|
248
|
+
* difference.
|
|
249
|
+
*
|
|
250
|
+
* Camera blur rather than per-object, deliberately. Per-object needs a velocity buffer —
|
|
251
|
+
* every mesh writing its own screen-space motion into a second render target, so a second
|
|
252
|
+
* set of matrices per draw and a wider G-buffer — which is a structural change to a forward
|
|
253
|
+
* renderer that writes one colour target. Camera blur needs only the previous
|
|
254
|
+
* view-projection, which the renderer already has every reason to keep, and it covers the
|
|
255
|
+
* case that actually matters: a camera whipping round a turntable or through a world.
|
|
256
|
+
*
|
|
257
|
+
* **The velocity comes from the rendered camera, not from the simulation step.** Sampling
|
|
258
|
+
* along a velocity derived from the fixed 1/60 step makes the blur pulse at 60 Hz against a
|
|
259
|
+
* display running at any other rate, which reads as a stutter and gets blamed on frame
|
|
260
|
+
* pacing. The matrix handed in is the one the frame was actually drawn with, interpolation
|
|
261
|
+
* included.
|
|
262
|
+
*
|
|
263
|
+
* The sky is included rather than masked out: at depth 1 a pure rotation still reprojects
|
|
264
|
+
* correctly, and a camera turning past a horizon *should* smear it.
|
|
265
|
+
*/
|
|
266
|
+
vec3 cameraBlur(vec3 scene) {
|
|
267
|
+
float depth = textureLod(uDepth, vUv, 0.0).r;
|
|
268
|
+
vec4 clip = vec4(vUv * 2.0 - 1.0, ${glslSceneDepthToNdc('depth')}, 1.0);
|
|
269
|
+
vec4 previous = uReprojection * clip;
|
|
270
|
+
/* Behind the previous eye: there is no last-frame position to smear toward. */
|
|
271
|
+
if (previous.w <= 0.0) return scene;
|
|
272
|
+
|
|
273
|
+
vec2 wasUv = (previous.xy / previous.w) * 0.5 + 0.5;
|
|
274
|
+
vec2 velocity = (vUv - wasUv) * uMotionStrength;
|
|
275
|
+
|
|
276
|
+
float distance = length(velocity);
|
|
277
|
+
if (distance < 1e-4) return scene;
|
|
278
|
+
if (distance > uMotionMax) velocity *= uMotionMax / distance;
|
|
279
|
+
|
|
280
|
+
/*
|
|
281
|
+
* Centred on the pixel rather than trailing behind it. A one-sided smear moves the whole
|
|
282
|
+
* image against the direction of travel, which reads as the frame lagging; sampling both
|
|
283
|
+
* ways keeps the subject where it is and softens around it.
|
|
284
|
+
*/
|
|
285
|
+
vec3 sum = scene;
|
|
286
|
+
for (int i = 1; i <= 4; i++) {
|
|
287
|
+
float t = float(i) / 4.0 * 0.5;
|
|
288
|
+
sum += textureLod(uScene, vUv + velocity * t, 0.0).rgb;
|
|
289
|
+
sum += textureLod(uScene, vUv - velocity * t, 0.0).rgb;
|
|
290
|
+
}
|
|
291
|
+
return sum / 9.0;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
void main() {
|
|
295
|
+
vec3 scene = textureLod(uScene, vUv, 0.0).rgb;
|
|
296
|
+
if (uMotionStrength > 0.0) scene = cameraBlur(scene);
|
|
297
|
+
/*
|
|
298
|
+
* Defocus after the camera smear and before everything else, because a lens is the last thing
|
|
299
|
+
* in front of the sensor and the two blurs are both properties of the *camera* rather than of
|
|
300
|
+
* the scene. Occlusion, bloom and the grade all follow, so a defocused highlight blooms — which
|
|
301
|
+
* is what a defocused highlight does.
|
|
302
|
+
*/
|
|
303
|
+
if (uDofStrength > 0.0) scene = depthOfField(scene);
|
|
304
|
+
|
|
305
|
+
/*
|
|
306
|
+
* Occlusion applied after the blurs rather than before, so a smear of a darkened image is
|
|
307
|
+
* not then darkened again along its own trail. mix from 1 rather than a multiply by the
|
|
308
|
+
* strength, so the parameter reads as "how much of this occlusion", and 0 is exactly the
|
|
309
|
+
* frame that existed before the effect did.
|
|
310
|
+
*/
|
|
311
|
+
float ao = mix(1.0, textureLod(uAo, vUv, 0.0).r, uAoStrength);
|
|
312
|
+
|
|
313
|
+
/*
|
|
314
|
+
* Distance from the centre, corrected so the falloff is a circle on screen rather than
|
|
315
|
+
* an ellipse stretched by the aspect. Without this the effect is much stronger at the
|
|
316
|
+
* left and right edges of a wide window than at the top and bottom, which reads as a
|
|
317
|
+
* bug rather than as speed.
|
|
318
|
+
*/
|
|
319
|
+
vec2 fromCentre = vUv - 0.5;
|
|
320
|
+
float radius = length(fromCentre * vec2(1.0, 0.62)) * 2.0;
|
|
321
|
+
|
|
322
|
+
/*
|
|
323
|
+
* The clear centre narrows as speed builds: 0.62 of the frame at a standstill down to
|
|
324
|
+
* about 0.3 flat out. Smoothstep rather than a hard edge, or the boundary itself becomes
|
|
325
|
+
* a visible ring.
|
|
326
|
+
*/
|
|
327
|
+
float inner = mix(0.62, 0.30, uStrength);
|
|
328
|
+
float edge = smoothstep(inner, 1.0, radius);
|
|
329
|
+
float amount = edge * uStrength;
|
|
330
|
+
if (amount <= 0.0) {
|
|
331
|
+
fragColor = vec4(withVeil(applyColourGrade(grade(withBloom(scene * ao)))), 1.0);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/*
|
|
336
|
+
* Outward along the radius, which is the direction the world streams past a character
|
|
337
|
+
* moving forward. Accumulated from the centre-most tap outward with the unblurred
|
|
338
|
+
* sample included, so a pixel never loses its own colour entirely.
|
|
339
|
+
*/
|
|
340
|
+
vec2 step = normalize(fromCentre + vec2(1e-6)) * uReach * amount;
|
|
341
|
+
vec3 sum = scene;
|
|
342
|
+
for (int i = 1; i <= 6; i++) {
|
|
343
|
+
/* textureLod for the same reason as the occlusion taps: this loop is reached through a
|
|
344
|
+
branch on amount, which varies across the frame, so it is not uniform control flow.
|
|
345
|
+
Identical output — the scene texture has one storage level. */
|
|
346
|
+
sum += textureLod(uScene, vUv + step * (float(i) / 6.0), 0.0).rgb;
|
|
347
|
+
}
|
|
348
|
+
vec3 blurred = sum / 7.0;
|
|
349
|
+
|
|
350
|
+
fragColor = vec4(
|
|
351
|
+
withVeil(applyColourGrade(grade(withBloom(mix(scene, blurred, amount) * ao)))),
|
|
352
|
+
1.0
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
`;
|