@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,864 @@
|
|
|
1
|
+
/** Version, inputs, uniforms and the defines the rest of the fragment shader is written against. */
|
|
2
|
+
import { COOKIE_TILE } from '../../lightBudget.js';
|
|
3
|
+
import { CLUSTER_TEXELS, CLUSTER_X, CLUSTER_Y, CLUSTER_Z, LIGHT_REGION_TEXELS, LIGHT_TEXELS, MAX_LIGHTS_PER_CLUSTER, TABLE_WIDTH, } from '../../clusteredLights.js';
|
|
4
|
+
import { MAX_SHADOW_FILTER_TAPS } from '../../renderQuality.js';
|
|
5
|
+
import { FOG_GLSL } from '../fog.js';
|
|
6
|
+
/**
|
|
7
|
+
* The preamble, built for one light budget.
|
|
8
|
+
*
|
|
9
|
+
* **A function rather than the constant it was, and the budget is why.** `MAX_LIGHTS` and
|
|
10
|
+
* `MAX_AREA_LIGHTS` size twenty and fourteen uniform arrays between them, and an array costs a
|
|
11
|
+
* whole row of the uniform grid per element whatever its base type — so these two numbers are
|
|
12
|
+
* most of what the lit shader spends against `MAX_FRAGMENT_UNIFORM_VECTORS`, and on a part that
|
|
13
|
+
* offers 256 of them they are the difference between a program that links and a black page. See
|
|
14
|
+
* `uniformVectorBudget.ts` for the counting and for the ladder the renderer walks.
|
|
15
|
+
*
|
|
16
|
+
* Rebuilt per call rather than memoised: it is 0.84 ms for the whole fragment source, measured,
|
|
17
|
+
* and a renderer builds it once at construction.
|
|
18
|
+
*/
|
|
19
|
+
export function preambleGlsl({ maxLights, maxAreaLights }) {
|
|
20
|
+
return `#version 300 es
|
|
21
|
+
precision highp float;
|
|
22
|
+
|
|
23
|
+
in vec3 vNormal;
|
|
24
|
+
in vec3 vColor;
|
|
25
|
+
in vec3 vWorldPos;
|
|
26
|
+
in float vEmissive;
|
|
27
|
+
in float vSpecular;
|
|
28
|
+
in vec4 vLightPos;
|
|
29
|
+
in vec2 vUv;
|
|
30
|
+
in vec3 vEmissiveColor;
|
|
31
|
+
in float vRoughness;
|
|
32
|
+
/*
|
|
33
|
+
* How far a bump may tilt the shading normal, and how much roughness that tilt is worth.
|
|
34
|
+
*
|
|
35
|
+
* A surface whose normal wanders cannot hold a highlight narrower than the wander, so the
|
|
36
|
+
* roughness has to grow with the relief or the picture is sparkle. Stated as a constant pair
|
|
37
|
+
* because the amplitude is known here rather than measured off the screen.
|
|
38
|
+
*/
|
|
39
|
+
#define RELIEF_TILT 1.6
|
|
40
|
+
#define RELIEF_ROUGHNESS 0.35
|
|
41
|
+
/**
|
|
42
|
+
* The furthest a texture-derived bump may turn the shading normal, as a tangent.
|
|
43
|
+
*
|
|
44
|
+
* 1.0 is 45°. See the cap's own comment at the sampling site for why a limit has to exist at
|
|
45
|
+
* all: past this the perturbation is the same size as the surface it perturbs, and what comes
|
|
46
|
+
* out is decided by the last bits of a screen-space derivative rather than by the picture.
|
|
47
|
+
*/
|
|
48
|
+
#define RELIEF_MAX_TILT 1.0
|
|
49
|
+
in float vGrain;
|
|
50
|
+
in float vRelief;
|
|
51
|
+
in vec4 vTangent;
|
|
52
|
+
/*
|
|
53
|
+
* **Declared after vTangent because the vertex stage declares them there.**
|
|
54
|
+
*
|
|
55
|
+
* GLSL ES links varyings by *name*, so on WebGL2 the order is free and this pair sat above
|
|
56
|
+
* vTangent for a whole build without anything going wrong. The generated path does not: GLSL to
|
|
57
|
+
* SPIR-V assigns varying locations by *declaration order*, so a stage that lists them in a
|
|
58
|
+
* different order hands WebGPU a vec4 where it expects a float.
|
|
59
|
+
*
|
|
60
|
+
* The failure is total and silent in the picture -- "The component count (4) of the vertex output
|
|
61
|
+
* at location 11 is different from the component count (1) of the fragment input at location 11",
|
|
62
|
+
* on a pipeline that is then never created, so the backend draws nothing at all while WebGL2 is
|
|
63
|
+
* pixel-perfect. Found by this row's own check on its first WebGPU run.
|
|
64
|
+
*
|
|
65
|
+
* **The rule this is an instance of: the two stages' varying blocks are one list in two places.**
|
|
66
|
+
* Adding a varying to one and not the other in the same position is a WebGPU-only defect that no
|
|
67
|
+
* WebGL2 capture can show.
|
|
68
|
+
*/
|
|
69
|
+
in float vSkyDirect;
|
|
70
|
+
in float vAlpha;
|
|
71
|
+
/*
|
|
72
|
+
* The refraction thickness lane. **Declared here in the position the vertex stage declares it**,
|
|
73
|
+
* which is the rule 3.42.0 paid for: GLSL links varyings by name so WebGL2 does not care, and the
|
|
74
|
+
* generated path assigns locations by declaration order, so a stage that lists them differently
|
|
75
|
+
* hands WebGPU a mismatched component count and no pipeline is created at all.
|
|
76
|
+
*/
|
|
77
|
+
in float vThickness;
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* Refraction: the colour the frame had already drawn when the first refracting draw arrived.
|
|
81
|
+
*
|
|
82
|
+
* **A uniform and a branch, never a permutation.** One more flatFrag axis is about 247 KB gzipped
|
|
83
|
+
* paid by every consumer whether or not they refract, against 19.8 KB for a branch -- which is the
|
|
84
|
+
* price table Track D's three shipped rows measured.
|
|
85
|
+
*
|
|
86
|
+
* uRefractStrength at 0 is every draw that shipped before this existed, and it is the default, so
|
|
87
|
+
* the sampler is bound to an empty texture and read nowhere on a frame that refracts nothing.
|
|
88
|
+
*/
|
|
89
|
+
uniform sampler2D uRefractScene;
|
|
90
|
+
uniform float uRefractStrength;
|
|
91
|
+
uniform vec3 uRefractTint;
|
|
92
|
+
uniform float uRefractThickness;
|
|
93
|
+
flat in int vHasTangents;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Surface colour from an image the consumer supplied, multiplied into the vertex colour.
|
|
97
|
+
*
|
|
98
|
+
* The engine still ships and fetches no image assets — see surfaceTexture.ts. What this
|
|
99
|
+
* samples is whatever the caller handed over, which for a procedurally generated canvas
|
|
100
|
+
* is zero payload and no pipeline, exactly as vertex colour is.
|
|
101
|
+
*
|
|
102
|
+
* Multiplied rather than replacing, so vertex colour keeps working as the per-surface
|
|
103
|
+
* tint it already is: one greyscale tile image lit by different vertex colours is how a
|
|
104
|
+
* biome recolours a whole world without a second texture, and a mesh whose texture is
|
|
105
|
+
* white shades identically to one with no texture at all.
|
|
106
|
+
*/
|
|
107
|
+
uniform sampler2D uAlbedo;
|
|
108
|
+
/** 0 leaves every textured path unevaluated, for the majority of geometry with no image. */
|
|
109
|
+
uniform int uAlbedoEnabled;
|
|
110
|
+
/**
|
|
111
|
+
* Alpha below which a textured fragment is thrown away entirely, 0 to disable.
|
|
112
|
+
*
|
|
113
|
+
* The billboard case: a face, a leaf, a sign is an image with a *shape*, and drawing its
|
|
114
|
+
* transparent corners as opaque black is the difference between a creature floating in
|
|
115
|
+
* the dark and a rectangle with a creature on it. A cutout rather than blending because
|
|
116
|
+
* these are depth-writing world geometry — blending them would need sorting, and a hard
|
|
117
|
+
* edge is what a cutout is for.
|
|
118
|
+
*
|
|
119
|
+
* Zero by default, so a texture with no alpha to speak of costs one compare and nothing
|
|
120
|
+
* else changes.
|
|
121
|
+
*/
|
|
122
|
+
uniform float uAlbedoCutout;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* A normal map, in the surface's own space.
|
|
126
|
+
*
|
|
127
|
+
* highp for the reason the depth samplers give: a lowp sampler may hand back eight bits, and eight
|
|
128
|
+
* bits of a direction is a surface quantised into visible facets.
|
|
129
|
+
*
|
|
130
|
+
* Sampled linear and never sRGB. These bytes are a direction, not a colour; decoding them as
|
|
131
|
+
* display values bends every normal toward the surface and reads as a green tint over everything.
|
|
132
|
+
* SurfaceTextureOptions.colorSpace already defaults to linear and says why.
|
|
133
|
+
*/
|
|
134
|
+
uniform highp sampler2D uNormalMap;
|
|
135
|
+
/**
|
|
136
|
+
* How hard the map turns the shading normal. 0 is no map at all, and gates the whole block.
|
|
137
|
+
*
|
|
138
|
+
* A uniform rather than a permutation flag, following uAlbedoEnabled: a fifth boolean would take
|
|
139
|
+
* the exhaustive permutation sweep from sixteen shaders to thirty-two, and the generated WGSL that
|
|
140
|
+
* consumers bundle as source from 766 KB to about 1.5 MB. A permutation is the right tool for the
|
|
141
|
+
* shadow samplers, where a profile with shadows off should declare none of them; it is the wrong
|
|
142
|
+
* tool for one image on a shader that already declares one.
|
|
143
|
+
*/
|
|
144
|
+
uniform float uNormalStrength;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Occlusion, roughness and metallic in one image. glTF's packing, because that is what an import
|
|
148
|
+
* carries: R is occlusion, G roughness, B metallic.
|
|
149
|
+
*
|
|
150
|
+
* highp for the reason the normal map gives: a lowp sampler may hand back eight bits, and eight
|
|
151
|
+
* bits of roughness is a highlight that steps between widths as a surface curves.
|
|
152
|
+
*
|
|
153
|
+
* Sampled linear and never sRGB. These three numbers *are* the data, not a picture of it, and
|
|
154
|
+
* decoding them as display values would bend every one of them toward its floor.
|
|
155
|
+
*/
|
|
156
|
+
uniform highp sampler2D uOrmMap;
|
|
157
|
+
/**
|
|
158
|
+
* 1 when a map is bound. Gates the whole block, following uAlbedoEnabled.
|
|
159
|
+
*
|
|
160
|
+
* A uniform rather than a fifth permutation flag: FlatShaderOptions has four booleans and
|
|
161
|
+
* flatSource.test.ts sweeps all sixteen exhaustively, so a fifth takes that to thirty-two and
|
|
162
|
+
* roughly doubles the generated WGSL that consumers bundle as source, this engine having no build
|
|
163
|
+
* step. A permutation is the right tool for the shadow samplers, where a profile with shadows off
|
|
164
|
+
* should declare none of them. It is the wrong tool for one more image.
|
|
165
|
+
*/
|
|
166
|
+
uniform int uOrmEnabled;
|
|
167
|
+
/**
|
|
168
|
+
* What each channel is scaled by, component-aligned with the map: r occlusion, g roughness,
|
|
169
|
+
* b metallic. The alignment is the documentation.
|
|
170
|
+
*
|
|
171
|
+
* **r is applied as a mix from 1 and not as a multiply**, because that is what glTF's
|
|
172
|
+
* occlusionTexture.strength is: 1 + strength * (texel - 1). A multiply at 0 means fully occluded,
|
|
173
|
+
* which is the opposite of what a caller asking for no occlusion means.
|
|
174
|
+
*/
|
|
175
|
+
uniform vec3 uOrmScale;
|
|
176
|
+
/**
|
|
177
|
+
* 1 when \`uEnvironment\` holds the GGX-prefiltered cube, 0 when it holds the capture's box chain.
|
|
178
|
+
*
|
|
179
|
+
* **Two chains whose levels mean different things, so two pieces of arithmetic downstream.** A box
|
|
180
|
+
* level is a smaller picture and wants the texel-footprint floor; a prefiltered level is a lobe and
|
|
181
|
+
* wants a roughness combined in quadrature. Likewise the weight: the split sum is the correct share
|
|
182
|
+
* of a *prefiltered* environment and asserts an integral that was never performed over a box chain.
|
|
183
|
+
*
|
|
184
|
+
* A uniform rather than a permutation flag, following \`uOrmEnabled\`: a fifth boolean doubles the
|
|
185
|
+
* generated WGSL every consumer bundles as source, and this is a few multiply-adds.
|
|
186
|
+
*/
|
|
187
|
+
uniform float uEnvironmentPrefiltered;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Where a surface glows, and in what colour.
|
|
191
|
+
*
|
|
192
|
+
* **sRGB, unlike the two maps above it.** A normal map is a direction and an ORM map is three
|
|
193
|
+
* numbers; this one is a colour somebody chose, so it is decoded the way the albedo is. Getting
|
|
194
|
+
* that backwards is not subtle — an emissive map read as linear comes out visibly dark and muddy
|
|
195
|
+
* where it should be saturated — but it is silent, because a glow that is too dim reads as a
|
|
196
|
+
* material choice rather than as a decode.
|
|
197
|
+
*
|
|
198
|
+
* A uniform gate rather than a permutation flag, for exactly the reasons \`uOrmEnabled\` gives
|
|
199
|
+
* above, and now with a number behind them: a fifth flag was built and measured at 49% of the
|
|
200
|
+
* bundle. See \`ARCHITECTURE.md\` §1.
|
|
201
|
+
*/
|
|
202
|
+
uniform highp sampler2D uEmissiveMap;
|
|
203
|
+
/** 1 when a map is bound. Gates the sample, following uOrmEnabled. */
|
|
204
|
+
uniform int uEmissiveMapEnabled;
|
|
205
|
+
/**
|
|
206
|
+
* What the map is scaled by, per channel. 1 is the identity and the default.
|
|
207
|
+
*
|
|
208
|
+
* The counterpart of \`uOrmScale\`: a factor that multiplies a texture is not a value, and this is
|
|
209
|
+
* where the multiplier lives once an image supplies the shape.
|
|
210
|
+
*/
|
|
211
|
+
uniform vec3 uEmissiveScale;
|
|
212
|
+
|
|
213
|
+
#if DIRECTIONAL_SHADOWS
|
|
214
|
+
/*
|
|
215
|
+
* The share marker below is what lets the environment probe exist, and it costs nothing.
|
|
216
|
+
*
|
|
217
|
+
* A device's sampler ceiling is per shader stage. This project's adapter offers exactly
|
|
218
|
+
* sixteen and the widest permutation of this shader declared seventeen — one albedo, these
|
|
219
|
+
* three maps, twelve point-shadow cubes and the probe's cube — so the probe was the one that
|
|
220
|
+
* gave way, and reflective surfaces kept a sky-and-ground gradient on hardware that could
|
|
221
|
+
* have mirrored the room.
|
|
222
|
+
*
|
|
223
|
+
* Every one of the fifteen shadow bindings was already one object: the WebGPU renderer hands
|
|
224
|
+
* them all the same shadow sampler, and flatPass declares them all non-filtering. So
|
|
225
|
+
* declaring one instead of fifteen changes nothing about how any of them is read, and takes
|
|
226
|
+
* the count to three. WebGL2 has no such limit and ignores the marker, which is a line
|
|
227
|
+
* comment to it.
|
|
228
|
+
*
|
|
229
|
+
* Marked on each declaration rather than matched on a name in the generator, deliberately.
|
|
230
|
+
* flatPass records what a name rule cost: a point-shadow cube's name does not end the way the
|
|
231
|
+
* three directional maps' names do, and a pattern wide enough to catch it also caught the
|
|
232
|
+
* probe's colour cube — whose mip chain is its roughness, so it needs a filtering sampler and
|
|
233
|
+
* cannot share a non-filtering one.
|
|
234
|
+
*
|
|
235
|
+
* Two things this comment may not contain, both learned here. No backticks: this is inside a
|
|
236
|
+
* template literal and one of them ends the shader. And no uniform names from the probe's
|
|
237
|
+
* half of the file, because a test asserts that a profile without a probe mentions them
|
|
238
|
+
* nowhere — a comment is source too, and it failed that test first.
|
|
239
|
+
*/
|
|
240
|
+
uniform highp sampler2D uStaticShadowMap; // wgsl:share shadow
|
|
241
|
+
uniform highp sampler2D uPeeledShadowMap; // wgsl:share shadow
|
|
242
|
+
uniform highp sampler2D uDynamicShadowMap; // wgsl:share shadow
|
|
243
|
+
/** 0 disables directional shadows when their source is not emitting. */
|
|
244
|
+
uniform float uShadowStrength;
|
|
245
|
+
uniform float uShadowMapSize;
|
|
246
|
+
/** Orthographic depth span, used to keep the residual bias in world metres. */
|
|
247
|
+
uniform float uShadowDepthSpan;
|
|
248
|
+
/** Horizontal world-space reach over which directional occlusion dissolves. */
|
|
249
|
+
uniform float uShadowMaxDistance;
|
|
250
|
+
/** 0 for a cheaper single-static-depth quality profile. */
|
|
251
|
+
uniform int uPeeledShadowEnabled;
|
|
252
|
+
/** Maximum horizontal projection per vertical metre for directional shadows. */
|
|
253
|
+
uniform float uShadowMaxSlope;
|
|
254
|
+
#endif
|
|
255
|
+
/** One sampling budget drives both directional and point-light filtering. */
|
|
256
|
+
uniform int uShadowFilterTaps;
|
|
257
|
+
uniform vec3 uDirectionalDir; // surface → dominant source, normalized
|
|
258
|
+
uniform vec3 uDirectionalColor;
|
|
259
|
+
uniform vec3 uAmbient;
|
|
260
|
+
/**
|
|
261
|
+
* Ambient arriving from below, for a hemispheric fill.
|
|
262
|
+
*
|
|
263
|
+
* Ambient from a single colour lights a floor and a ceiling identically, which is the
|
|
264
|
+
* one thing real ambient never does: skylight comes from above and bounce comes off
|
|
265
|
+
* whatever you are standing on. A room whose floor is carpet and whose ceiling is white
|
|
266
|
+
* tile reads as neither if both get the same fill — the whole scene takes one flat tint.
|
|
267
|
+
*
|
|
268
|
+
* Defaults to uAmbient, so a consumer that sets only the one colour gets exactly the
|
|
269
|
+
* uniform fill it always did.
|
|
270
|
+
*/
|
|
271
|
+
uniform vec3 uAmbientGround;
|
|
272
|
+
${FOG_GLSL}
|
|
273
|
+
uniform vec3 uCameraPos;
|
|
274
|
+
/** Optional world plane; reflection passes retain only the viewer's side. */
|
|
275
|
+
uniform vec4 uClipPlane;
|
|
276
|
+
uniform int uClipEnabled;
|
|
277
|
+
uniform float uEmissiveGain;
|
|
278
|
+
uniform float uNightFactor;
|
|
279
|
+
#if NIGHT_EMISSIVE
|
|
280
|
+
/**
|
|
281
|
+
* Emission that only shows where the dominant light does not reach. 0 is off and is the default.
|
|
282
|
+
*
|
|
283
|
+
* The case it exists for is a lamp field on something that turns. Where the lights are is a
|
|
284
|
+
* property of the surface, so it is authored per vertex; whether they are visible is a property
|
|
285
|
+
* of where the sun is, and until this term nothing multiplied the two. Measured on the rotating
|
|
286
|
+
* planet it was reported from, a patch bright enough to read on the night side was sixteen times
|
|
287
|
+
* too bright on the day side, and the ratio is fixed by the lighting rather than by the value.
|
|
288
|
+
*
|
|
289
|
+
* The cut at the terminator is hard on purpose. Softening it is what puts the lights back on the
|
|
290
|
+
* day side, which is the whole of the defect being fixed.
|
|
291
|
+
*/
|
|
292
|
+
uniform float uNightEmissive;
|
|
293
|
+
#endif
|
|
294
|
+
/**
|
|
295
|
+
* How solid this draw is, 0 to 1.
|
|
296
|
+
*
|
|
297
|
+
* One uniform rather than a second material, for the same reason uTint is one:
|
|
298
|
+
* everything else about a translucent piece of the world — its lighting, its fog,
|
|
299
|
+
* its emissive — is what the flat shader already does, and duplicating the whole
|
|
300
|
+
* of that to change one channel is how a renderer ends up with two shaders that
|
|
301
|
+
* disagree about the sun. The caller owns the blend state; this owns the number.
|
|
302
|
+
*/
|
|
303
|
+
uniform float uOpacity;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Whether this draw is accumulating into the order-independent transparency buffers, and
|
|
307
|
+
* therefore weights its own output. 0 is every draw that is not, which is every draw on every
|
|
308
|
+
* published scene.
|
|
309
|
+
*
|
|
310
|
+
* **A uniform rather than a permutation, and the cost is why.** Writing the accumulation and the
|
|
311
|
+
* revealage from one pass needs a second fragment output, which is another \`flatFrag\` axis —
|
|
312
|
+
* measured in \`scripts/wgsl.ts\` at about 247 KB gzipped, doubling the sixteen fragment variants,
|
|
313
|
+
* and paid by every consumer whether or not they ever switch this on. A branch on a uniform costs
|
|
314
|
+
* a compare, and the geometry is submitted twice instead. See \`orderIndependent.ts\`.
|
|
315
|
+
*
|
|
316
|
+
* **The revealage pass does not read this.** It draws with this at 0 and a blend of
|
|
317
|
+
* \`(ZERO, ONE_MINUS_SRC_ALPHA)\`, so the colour it computes is multiplied away and only its alpha
|
|
318
|
+
* reaches the target — which is exactly the point: both passes run the same code to decide what
|
|
319
|
+
* alpha this fragment has, so they cannot disagree about it.
|
|
320
|
+
*/
|
|
321
|
+
uniform float uOitWeighted;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Whether the fragment stage runs any lighting: ambient, the sun, point lights, specular,
|
|
325
|
+
* reflectivity, procedural grain, emissive and the arrival highlight. 1 keeps every one of
|
|
326
|
+
* them, which is what every draw did before this existed and what an opaque draw always
|
|
327
|
+
* does. 0 leaves the surface exactly its own vertex colour times its own texture — three.js
|
|
328
|
+
* calls that \`meshBasicMaterial\`, and it is what a flat glow shell or a flat backdrop plate
|
|
329
|
+
* needs: colour and opacity, and nothing else touching it.
|
|
330
|
+
*
|
|
331
|
+
* **A uniform branch rather than a fifth permutation, and that is a cost decision, not a
|
|
332
|
+
* style one.** \`POINT_SHADOWS\`, \`ENVIRONMENT_PROBE\` and the like are \`#if\`'d out because
|
|
333
|
+
* leaving them in adds a sampler or a uniform-block member a profile without the feature
|
|
334
|
+
* would still declare and still pay a bind group layout for — sixteen shader permutations
|
|
335
|
+
* already, doubled again by the translucent pipeline on WebGPU. This adds no binding and no
|
|
336
|
+
* block member the shader does not already carry the size of; it is one \`int\` beside
|
|
337
|
+
* \`uOpacity\`, read once. And the branch it drives is on a value that is the same for every
|
|
338
|
+
* fragment in one draw call, which is exactly the guarantee \`uReflectivity\` and
|
|
339
|
+
* \`uAlbedoEnabled\` already lean on above: a compiler asked to predicate a whole wavefront on
|
|
340
|
+
* one uniform skips the untaken side rather than computing both and discarding one, which is
|
|
341
|
+
* only true because nothing here reads it through a *varying*-dependent branch.
|
|
342
|
+
*/
|
|
343
|
+
uniform int uLightingEnabled;
|
|
344
|
+
/**
|
|
345
|
+
* Whether this draw recedes into the medium: the atmospheric haze and the underwater tint
|
|
346
|
+
* both, folded together because both are the *camera's* medium rather than a property of the
|
|
347
|
+
* surface — see \`mediumFog\`/\`mediumColor\` in \`fog.ts\`. 1 keeps both, matching every draw
|
|
348
|
+
* before this existed.
|
|
349
|
+
*
|
|
350
|
+
* **Independent of \`uLightingEnabled\`, and that is the point of it being a second uniform
|
|
351
|
+
* rather than the same one.** "Unlit but still fading into the haze" is a real thing to
|
|
352
|
+
* want — a marker at the edge of view distance should still say it is far away even if
|
|
353
|
+
* nothing about it is shaded — so coupling the two would take away a look this shader can
|
|
354
|
+
* otherwise express for free. The caller chooses the combination; this only offers both.
|
|
355
|
+
*
|
|
356
|
+
* **The trade-off worth stating: with this at 0, the underwater tint is skipped too, which
|
|
357
|
+
* is the one place this draw can now disagree with the rest of a submerged world.** Every
|
|
358
|
+
* other pass applies \`uUnderwaterFactor\` unconditionally so that crossing the surface changes
|
|
359
|
+
* the whole scene together — see the comment on \`waterTransmission\` below. A translucent draw
|
|
360
|
+
* that asked to be unfogged is asking for its colour untouched by the medium full stop, which
|
|
361
|
+
* is what "exactly as its colour says" has to mean for it; the cost is that such a draw will
|
|
362
|
+
* not tint if the camera goes under water, unlike everything else in the frame.
|
|
363
|
+
*/
|
|
364
|
+
uniform int uFogEnabled;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* A pass-level scale over the grain the geometry declared, 0 to 1.
|
|
368
|
+
*
|
|
369
|
+
* Which surfaces are mineral is aGrain, per vertex, because it is a property of a
|
|
370
|
+
* material and nothing else in the frame can know it. This is the override on top: an
|
|
371
|
+
* imported model that declares nothing is drawn with the pass's own answer, and a scene
|
|
372
|
+
* can dial a whole draw down without rebuilding its geometry.
|
|
373
|
+
*/
|
|
374
|
+
uniform float uGrain;
|
|
375
|
+
/*
|
|
376
|
+
* The material's own relief: how strong, and how many bumps to a metre.
|
|
377
|
+
*
|
|
378
|
+
* Two numbers rather than one because they are what separates the surfaces this exists for.
|
|
379
|
+
* Asphalt is coarse and deep, orange peel on paint is fine and shallow, cast concrete sits
|
|
380
|
+
* between them, and the geometry carrying them is identical in all three cases. See
|
|
381
|
+
* Renderer.setSurfaceRelief.
|
|
382
|
+
*/
|
|
383
|
+
uniform float uRelief;
|
|
384
|
+
uniform float uReliefCycles;
|
|
385
|
+
/**
|
|
386
|
+
* How hard the bound surface texture's own luminance turns the shading normal, 0 for not at all.
|
|
387
|
+
*
|
|
388
|
+
* **The other half of relief, and the half a photograph can give.** \`uRelief\` invents structure
|
|
389
|
+
* from noise, which is right for asphalt and concrete because their structure has no particular
|
|
390
|
+
* arrangement. A rock, a bark, a beaten-metal plate does: the bumps are *where the picture says
|
|
391
|
+
* they are*, and noise cannot know. This reads the height off the image already bound as colour,
|
|
392
|
+
* so one photograph lights as the surface it is a photograph of.
|
|
393
|
+
*
|
|
394
|
+
* **The image serves both roles rather than a second sampler being added**, which is a decision
|
|
395
|
+
* and not a shortcut. This shader's widest permutation already declares one sampler more than
|
|
396
|
+
* this project's adapter offers, and is legal only because of the \`wgsl:share\` markers on the
|
|
397
|
+
* shadow cubemaps; a second image sampler here is not the free addition it would be in a smaller
|
|
398
|
+
* shader. It is also what the consumer this was built for actually does — three.js's own
|
|
399
|
+
* \`bumpMap\` is a height field, and a scene handing one image to \`map\` and \`bumpMap\` together
|
|
400
|
+
* is the ordinary case rather than an unusual one.
|
|
401
|
+
*
|
|
402
|
+
* Scaled exactly as three.js's \`bumpScale\` is, so a scene porting one carries the number across
|
|
403
|
+
* rather than refitting it, and negative inverts the relief there and here alike. Not clamped to
|
|
404
|
+
* 0..1 like its neighbours for the same reason: this is an amplitude against a luminance
|
|
405
|
+
* gradient, not a fraction of anything.
|
|
406
|
+
*/
|
|
407
|
+
uniform float uTextureRelief;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* How much of the environment this material mirrors, 0 to 1.
|
|
411
|
+
*
|
|
412
|
+
* Specular here is a highlight lobe and nothing else: a surface reflected the four lamps
|
|
413
|
+
* above it and not the room around it. That is why polished paint read as opaque no matter
|
|
414
|
+
* how tight the lobe was made, because what makes a car body look wet is mostly the world
|
|
415
|
+
* in it rather than the lights on it.
|
|
416
|
+
*
|
|
417
|
+
* Off by default, so every scene written before it is unchanged.
|
|
418
|
+
*/
|
|
419
|
+
uniform float uReflectivity;
|
|
420
|
+
/**
|
|
421
|
+
* How bright the environment these surfaces reflect is, as a multiplier on it.
|
|
422
|
+
*
|
|
423
|
+
* **This exists because a metal has no other way to be lit.** Its Fresnel base is its own albedo,
|
|
424
|
+
* so \`f0\` is 1 and the environment blend reaches full weight at every angle: what a metal shows
|
|
425
|
+
* is \`environment * albedo\` and nothing else — no ambient, no direct diffuse. When the only
|
|
426
|
+
* environment available is a low-resolution cube of a room, a metal is exactly as bright as that
|
|
427
|
+
* room's own surfaces happen to be, and in an interior lit by a handful of lamps that is dark. A
|
|
428
|
+
* consumer reported it as an imported model reading dark in every world at once, which is the tell
|
|
429
|
+
* that it is not any one world's lighting.
|
|
430
|
+
*
|
|
431
|
+
* It is a **stand-in for image-based lighting** and it says so. A real prefiltered environment
|
|
432
|
+
* carries the sky and the sources a probe of nearby geometry never sees, and it would make this
|
|
433
|
+
* unnecessary; until there is one, the honest thing is one named number rather than thirty worlds
|
|
434
|
+
* each re-lit around the same missing term. See the \`image-based-lighting\` row in
|
|
435
|
+
* docs/CAPABILITIES.md.
|
|
436
|
+
*
|
|
437
|
+
* Applies to whatever the surface reflects, probe or hemispheric approximation alike, and to the
|
|
438
|
+
* probe's own irradiance where a caller asked for that. **1 is the default and the identity**, so
|
|
439
|
+
* every scene written before this is unchanged.
|
|
440
|
+
*/
|
|
441
|
+
uniform float uEnvironmentGain;
|
|
442
|
+
/**
|
|
443
|
+
* The room itself, as a cubemap baked from one point, and whether one exists.
|
|
444
|
+
*
|
|
445
|
+
* highp because a lowp sampler may hand back eight bits and this one carries an image the eye
|
|
446
|
+
* looks *at* rather than a term that modulates something else. See the depth samplers.
|
|
447
|
+
*
|
|
448
|
+
* Sampled at a mip level chosen by roughness, which is the cheapest honest gloss blur there
|
|
449
|
+
* is: a polished surface takes level 0 and a satin one takes a blurred level, for the price of
|
|
450
|
+
* a fetch rather than a pass. This is the documented exception to the textureLod rule in
|
|
451
|
+
* AGENTS.md 2026-08-07 — the level is *wanted* here — and it is still an explicit level rather
|
|
452
|
+
* than an implicit derivative, so the rule holds either way.
|
|
453
|
+
*
|
|
454
|
+
* When no probe has been baked this stays at zero and the gradient below is used instead. It is
|
|
455
|
+
* gated on a flag rather than on the texture being bound, because an unbaked cubemap contains
|
|
456
|
+
* whatever the driver left in it, and a car mirroring uninitialised memory is worse than a car
|
|
457
|
+
* mirroring an approximation.
|
|
458
|
+
*/
|
|
459
|
+
#if ENVIRONMENT_PROBE
|
|
460
|
+
uniform highp sampler2DArray uEnvironment;
|
|
461
|
+
uniform float uEnvironmentEnabled;
|
|
462
|
+
uniform float uEnvironmentMaxLod;
|
|
463
|
+
/**
|
|
464
|
+
* Texels across one probe's map at level 0, which the footprint arithmetic needs and
|
|
465
|
+
* \`uEnvironmentMaxLod\` no longer carries.
|
|
466
|
+
*
|
|
467
|
+
* They were one number while the environment was a cube: the chain ran to a single texel a face,
|
|
468
|
+
* so the top level *was* the log of the face size. The chain now stops one level below the cosine
|
|
469
|
+
* convolution, so the top level is 4 while the map is 256 across, and a footprint expressed as
|
|
470
|
+
* \`exp2(uEnvironmentMaxLod)\` would say sixteen. That reads as every metal in the scene being
|
|
471
|
+
* under-sampled and forced to a roughness it does not have.
|
|
472
|
+
*/
|
|
473
|
+
uniform float uEnvironmentEdge;
|
|
474
|
+
/**
|
|
475
|
+
* The level holding the cosine convolution, which is the scene's diffuse ambient.
|
|
476
|
+
*
|
|
477
|
+
* **One binding carries both integrals**, and this is the line between them. Levels up to
|
|
478
|
+
* \`uEnvironmentMaxLod\` are the reflection at the roughness each stands for; this one is the
|
|
479
|
+
* room's diffuse light, convolved against the cosine at bake time. Folding them into one array is
|
|
480
|
+
* what leaves WebGL2's last guaranteed texture unit free.
|
|
481
|
+
*
|
|
482
|
+
* **It replaces nine spherical-harmonic coefficients**, which were projected on the CPU, read back
|
|
483
|
+
* off the GPU and uploaded again — a synchronous \`readPixels\` on one backend and a \`mapAsync\`
|
|
484
|
+
* answering a frame or two later on the other, with a second gate uniform to cover the gap. A
|
|
485
|
+
* second-order fit also could not carry a sharp source; an eight-texel octahedral image carries
|
|
486
|
+
* strictly more than nine coefficients did, and it costs a fetch rather than a readback.
|
|
487
|
+
*/
|
|
488
|
+
uniform float uEnvironmentIrradianceLevel;
|
|
489
|
+
/**
|
|
490
|
+
* Where the probes stand, as a lattice: the first probe, the reciprocal of the step, and the
|
|
491
|
+
* counts.
|
|
492
|
+
*
|
|
493
|
+
* **Four uniforms whatever the probe count, and that is not an economy but a requirement.** This
|
|
494
|
+
* shader already declares 35 array uniforms totalling 385 uniform vectors against WebGL2's
|
|
495
|
+
* guaranteed \`MAX_FRAGMENT_UNIFORM_VECTORS\` of 224, so it is 1.7x over the guarantee before a
|
|
496
|
+
* probe is placed. Sixteen probes of position and extent would add about 48 vectors to a budget
|
|
497
|
+
* nobody can raise. A lattice needs none: the layer index is arithmetic.
|
|
498
|
+
*
|
|
499
|
+
* Counts of \`(1, 1, 1)\` is a single probe, which is what every scene that bakes one environment
|
|
500
|
+
* becomes, and it is not a special case anywhere below.
|
|
501
|
+
*/
|
|
502
|
+
uniform vec3 uProbeGridOrigin;
|
|
503
|
+
uniform vec3 uProbeGridInvSpacing;
|
|
504
|
+
uniform vec3 uProbeGridCounts;
|
|
505
|
+
/**
|
|
506
|
+
* Whether the grid supplies the scene's diffuse ambient, or only its reflections.
|
|
507
|
+
*
|
|
508
|
+
* \`ProbeBakeOptions.irradiance\`, at grid scope. A bake used to do two things inseparably: fill
|
|
509
|
+
* a cube that reflective surfaces sample, and replace every diffuse surface's ambient with the
|
|
510
|
+
* room's own light. A consumer who wanted a car to mirror the village also got the whole scene
|
|
511
|
+
* relit at whatever moment the bake landed, and filed it four times over two days as four
|
|
512
|
+
* different bugs.
|
|
513
|
+
*
|
|
514
|
+
* Zero here declines the second half and the hemispheric gradient below is what lights the scene,
|
|
515
|
+
* exactly as it did before any probe existed.
|
|
516
|
+
*/
|
|
517
|
+
uniform float uProbeGridAmbient;
|
|
518
|
+
#endif
|
|
519
|
+
/** A world-space box that lights up regardless of time of day (run finished). */
|
|
520
|
+
uniform vec3 uHighlightMin;
|
|
521
|
+
uniform vec3 uHighlightMax;
|
|
522
|
+
uniform float uHighlightGain;
|
|
523
|
+
|
|
524
|
+
/*
|
|
525
|
+
* The froxel table, and the numbers needed to find a fragment's place in it.
|
|
526
|
+
*
|
|
527
|
+
* **Every layout constant is interpolated from \`clusteredLights.ts\` rather than written here.**
|
|
528
|
+
* The binner, this shader and the WGSL kernel are three readers of one layout, and two of them
|
|
529
|
+
* agreeing because both contain the number 8 is the shape of defect the conformance script exists
|
|
530
|
+
* to catch. There is one definition and all three read it.
|
|
531
|
+
*
|
|
532
|
+
* **Declared unconditionally rather than behind a permutation, and that is a measured reversal.**
|
|
533
|
+
* \`ARCHITECTURE.md\` §1 makes a feature inside the lit pass a compile-on-demand permutation, and a
|
|
534
|
+
* fifth flag doubled the generated WGSL from sixteen variants to thirty-two — **914 KB to 1,906 KB
|
|
535
|
+
* raw and 400,728 to 597,638 bytes gzipped, a 49% rise on every consumer including those who never
|
|
536
|
+
* turn this on.** Gzip cannot dedupe near-identical copies across that span; its window is 32 KB
|
|
537
|
+
* and a permutation is larger than that. So this is a runtime branch on a uniform, and what it
|
|
538
|
+
* costs is stated below rather than hidden. \`ARCHITECTURE.md\` carries the finding.
|
|
539
|
+
*
|
|
540
|
+
* **\`texelFetch\` rather than \`texture\`, and it is not only a filtering choice.** An integer
|
|
541
|
+
* texture cannot be filtered at all, so the sampler this declaration would otherwise bring is dead
|
|
542
|
+
* weight against a per-stage ceiling; the \`wgsl:share\` marker gives it the shadow group's one,
|
|
543
|
+
* which it never uses. It also means the 2026-08-07 rule does not apply here: \`texelFetch\` takes
|
|
544
|
+
* no derivative, so reading it inside the light loop needs no explicit level and cannot be the
|
|
545
|
+
* flattened-branch cost that rule is about.
|
|
546
|
+
*/
|
|
547
|
+
#define CLUSTER_X ${CLUSTER_X}
|
|
548
|
+
#define CLUSTER_Y ${CLUSTER_Y}
|
|
549
|
+
#define CLUSTER_Z ${CLUSTER_Z}
|
|
550
|
+
#define CLUSTER_TEXELS ${CLUSTER_TEXELS}
|
|
551
|
+
#define MAX_LIGHTS_PER_CLUSTER ${MAX_LIGHTS_PER_CLUSTER}
|
|
552
|
+
#define LIGHT_TEXELS ${LIGHT_TEXELS}
|
|
553
|
+
#define LIGHT_REGION_TEXELS ${LIGHT_REGION_TEXELS}
|
|
554
|
+
#define CLUSTER_TABLE_WIDTH ${TABLE_WIDTH}
|
|
555
|
+
uniform highp usampler2D uClusterTable; // wgsl:share shadow
|
|
556
|
+
/**
|
|
557
|
+
* The view matrix, so a fragment can find its own froxel.
|
|
558
|
+
*
|
|
559
|
+
* **From view space rather than from \`gl_FragCoord\`, and that is deliberate.** A WebGL2
|
|
560
|
+
* framebuffer counts y upward and a WebGPU one counts it downward, so a tile row derived from the
|
|
561
|
+
* fragment's window coordinate would be mirrored on one backend — the same trap the 2026-08-17
|
|
562
|
+
* rule about \`dFdy\` is written for, arriving through a different door. View space has no such
|
|
563
|
+
* disagreement, and it is also the space the binner works in, so the shader and the binner answer
|
|
564
|
+
* the same question with the same arithmetic.
|
|
565
|
+
*/
|
|
566
|
+
uniform mat4 uView;
|
|
567
|
+
/** near, far, tan(fovY/2) and aspect: the four numbers the froxel grid is defined by. */
|
|
568
|
+
uniform vec4 uClusterFrustum;
|
|
569
|
+
/**
|
|
570
|
+
* 1 when the light loop reads the froxel table, 0 when it reads the uniform slots.
|
|
571
|
+
*
|
|
572
|
+
* A uniform, so the branch is uniform control flow and every fragment in a draw takes the same
|
|
573
|
+
* arm — which is what keeps it cheap and what keeps the 2026-08-07 rule satisfied. The table is
|
|
574
|
+
* only ever read with \`texelFetch\`, which takes no derivative, so nothing here needs an explicit
|
|
575
|
+
* level either way.
|
|
576
|
+
*
|
|
577
|
+
* **What this costs when it is 0**: one texture unit, one matrix and one vec4 in the block, and a
|
|
578
|
+
* compare per light. What it buys is that a consumer who never enables it does not download a
|
|
579
|
+
* second copy of the whole shader — see the note above the table's declaration.
|
|
580
|
+
*/
|
|
581
|
+
uniform int uClustered;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* One texel of the table, addressed by its flat index.
|
|
585
|
+
*
|
|
586
|
+
* The width divides both regions exactly, which is why this is a mask and a shift rather than a
|
|
587
|
+
* divide — see \`TABLE_WIDTH\` for the arithmetic that guarantees it.
|
|
588
|
+
*/
|
|
589
|
+
uvec4 clusterTexel(int texel) {
|
|
590
|
+
return texelFetch(
|
|
591
|
+
uClusterTable,
|
|
592
|
+
ivec2(texel % CLUSTER_TABLE_WIDTH, texel / CLUSTER_TABLE_WIDTH),
|
|
593
|
+
0);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
#define MAX_LIGHTS ${maxLights}
|
|
597
|
+
/*
|
|
598
|
+
* How many times the light loop may go round.
|
|
599
|
+
*
|
|
600
|
+
* The clustered arm iterates a froxel's own list and the fixed arm iterates the uniform slots, so
|
|
601
|
+
* the bound differs; GLSL needs a constant either way. Defined here rather than at the loop so
|
|
602
|
+
* both numbers sit beside the budgets they come from.
|
|
603
|
+
*/
|
|
604
|
+
/*
|
|
605
|
+
* **Both arms have the same bound, and that equality is deliberate.** There is one loop, so a
|
|
606
|
+
* larger clustered cap would raise the bound for the fixed path too, and a scene that never asks
|
|
607
|
+
* for froxels would carry a loop of 28 where it carries 16 today. \`MAX_LIGHTS_PER_CLUSTER\` is
|
|
608
|
+
* pinned equal to \`MAX_LIGHTS\` for that reason; a test in \`textureUnitBudget.test.ts\` asserts it.
|
|
609
|
+
*/
|
|
610
|
+
#define LIGHT_LOOP_MAX MAX_LIGHTS
|
|
611
|
+
uniform int uLightCount;
|
|
612
|
+
/** 0 keeps the radius-shaped falloff; 1 is physical inverse-square with a soft cutoff. */
|
|
613
|
+
uniform int uLightFalloff;
|
|
614
|
+
uniform vec3 uLightPos[MAX_LIGHTS];
|
|
615
|
+
uniform vec3 uLightColor[MAX_LIGHTS];
|
|
616
|
+
uniform float uLightRadius[MAX_LIGHTS];
|
|
617
|
+
/*
|
|
618
|
+
* Each light's emitter radius in metres. Zero is a mathematical point, which is what every
|
|
619
|
+
* source was until a highlight narrower than a fragment turned out to be the cause of speckle
|
|
620
|
+
* on glossy paint. See sphereLobe.
|
|
621
|
+
*/
|
|
622
|
+
uniform float uLightSourceRadius[MAX_LIGHTS];
|
|
623
|
+
/*
|
|
624
|
+
* How present each light is, 0 to 1: the ramp it crosses the edge of view range on,
|
|
625
|
+
* and the one it trades the last slot on. A world carries more lights than
|
|
626
|
+
* MAX_LIGHTS, so membership changes as the camera moves, and without this it changes
|
|
627
|
+
* by switching. See pointLightSelection.ts.
|
|
628
|
+
*/
|
|
629
|
+
uniform float uLightWeight[MAX_LIGHTS];
|
|
630
|
+
/**
|
|
631
|
+
* Where each spot points, normalised, in world space. Unused by a light with no cone.
|
|
632
|
+
*
|
|
633
|
+
* Declared for every light rather than as a separate spot array, because a spot is a point light
|
|
634
|
+
* with a direction and giving it arrays of its own would put a second loop in the largest shader
|
|
635
|
+
* here — see \`ARCHITECTURE.md\` section 1 on what a fifth permutation cost.
|
|
636
|
+
*/
|
|
637
|
+
uniform vec3 uLightDir[MAX_LIGHTS];
|
|
638
|
+
/**
|
|
639
|
+
* The cosine of each light's inner cone angle, then of its outer.
|
|
640
|
+
*
|
|
641
|
+
* A light with no cone carries -1 and -2, which makes \`smoothstep(outer, inner, dot)\` exactly 1
|
|
642
|
+
* for every direction on the sphere. See \`POINT_LIGHT_COS_OUTER\`: the pair is chosen so a point
|
|
643
|
+
* light collapses to the arithmetic it had rather than to something very close to it.
|
|
644
|
+
*/
|
|
645
|
+
uniform vec2 uLightCone[MAX_LIGHTS];
|
|
646
|
+
/**
|
|
647
|
+
* Which row of the photometric atlas each light uses, or a negative index for none.
|
|
648
|
+
*
|
|
649
|
+
* A float rather than an int because it travels through the froxel record as one, and because the
|
|
650
|
+
* shader turns it into a texture coordinate immediately anyway.
|
|
651
|
+
*/
|
|
652
|
+
uniform float uLightIesProfile[MAX_LIGHTS];
|
|
653
|
+
/**
|
|
654
|
+
* Where each light's photometric azimuth zero points, in world space.
|
|
655
|
+
*
|
|
656
|
+
* **Read only by an asymmetric profile**, which is a street light or a wall washer and is almost
|
|
657
|
+
* nothing else — every axially symmetric fixture ignores it, and a zero vector or one parallel to
|
|
658
|
+
* the aim leaves the profile on its first plane. Orthogonalised against the light's direction in
|
|
659
|
+
* the shader, so a caller hands the fixture's own forward and the aim decides the rest.
|
|
660
|
+
*
|
|
661
|
+
* **It cannot be derived from the direction.** There is no continuous field of unit vectors
|
|
662
|
+
* tangent to a sphere, so any reference built from the aim alone flips somewhere — and the obvious
|
|
663
|
+
* constructions put that flip exactly where these fixtures point, \`cross(worldUp, dir)\` being
|
|
664
|
+
* singular for a light aimed straight down.
|
|
665
|
+
*/
|
|
666
|
+
uniform vec3 uLightIesAxis[MAX_LIGHTS];
|
|
667
|
+
/**
|
|
668
|
+
* Which tile of the cookie atlas each light projects, or a negative index for none.
|
|
669
|
+
*
|
|
670
|
+
* A cookie is a mask the fixture throws — a window frame, a grille, foliage — and it is oriented
|
|
671
|
+
* by \`uLightIesAxis\`, the same reference a photometric profile's azimuth uses, because both are
|
|
672
|
+
* answering the same question about a fixture: which way is up.
|
|
673
|
+
*/
|
|
674
|
+
uniform float uLightCookie[MAX_LIGHTS];
|
|
675
|
+
/**
|
|
676
|
+
* Photometric profiles: one row per fixture, a fixture's intensity by vertical angle across it.
|
|
677
|
+
*
|
|
678
|
+
* **Every row spans the same 0 to 180 degree arc**, whatever the file measured, which is what lets
|
|
679
|
+
* a light carry only a row index — see \`iesProfile.ts\`. With no profile loaded this holds a
|
|
680
|
+
* single row of ones, the multiplicative identity, because a declared sampler needs a complete
|
|
681
|
+
* texture whether or not the branch reads it and a row of zeros would switch off every light.
|
|
682
|
+
*/
|
|
683
|
+
uniform sampler2D uIesAtlas;
|
|
684
|
+
/** Rows in the atlas, so a row index becomes a coordinate. At least 1. */
|
|
685
|
+
uniform float uIesAtlasRows;
|
|
686
|
+
/**
|
|
687
|
+
* Horizontal planes each profile occupies, so a row is \`profile * planes + plane\`.
|
|
688
|
+
*
|
|
689
|
+
* **1 for an atlas with nothing asymmetric in it**, which is nearly every atlas, and the whole
|
|
690
|
+
* plane path is branched away on that — see \`photometric\` in \`main.ts\`. One count for the atlas
|
|
691
|
+
* rather than one per profile, because a per-profile count would need a second number in a light's
|
|
692
|
+
* record to divide by, and a light's record is where space is expensive.
|
|
693
|
+
*/
|
|
694
|
+
uniform float uIesPlaneCount;
|
|
695
|
+
/**
|
|
696
|
+
* Cookies: one row of square tiles, one tile a fixture's mask.
|
|
697
|
+
*
|
|
698
|
+
* **0 when no consumer has loaded one, and the whole projection is branched away on it** — a
|
|
699
|
+
* \`uniform float\` is provably uniform control flow, so a scene with no cookie performs no
|
|
700
|
+
* arithmetic and no fetch. With none loaded this holds a single white texel, the multiplicative
|
|
701
|
+
* identity, because a declared sampler needs a complete texture whether or not the branch reads it
|
|
702
|
+
* and a black stand-in would switch off every light that reached it.
|
|
703
|
+
*/
|
|
704
|
+
uniform sampler2D uCookieAtlas;
|
|
705
|
+
uniform float uCookieTiles;
|
|
706
|
+
/**
|
|
707
|
+
* Half a texel of a tile, so a cookie's edge cannot reach its neighbour in the atlas.
|
|
708
|
+
*
|
|
709
|
+
* A row of tiles filtered bilinearly bleeds across the seam between two of them, and the seam is
|
|
710
|
+
* exactly where a cone's edge lands — so the neighbour's colour would appear as a rim on every
|
|
711
|
+
* cookie. Derived from \`COOKIE_TILE\` rather than written twice.
|
|
712
|
+
*/
|
|
713
|
+
#define COOKIE_INSET (0.5 / ${COOKIE_TILE}.0)
|
|
714
|
+
/**
|
|
715
|
+
* Rectangular area lights, and how many of them are live.
|
|
716
|
+
*
|
|
717
|
+
* **Four, and a branch on this count rather than a shader permutation.** \`ARCHITECTURE.md\` section
|
|
718
|
+
* 1 says a lit-pass feature earns a permutation only when carrying it compiled-in costs more than
|
|
719
|
+
* doubling the shader corpus, and this session measured both sides of that: thirty lines of shared
|
|
720
|
+
* code cost 6,215 gzipped bytes across the sixteen permutations, and fifty cost 10,517 — while the
|
|
721
|
+
* fifth flag clustered lighting nearly took cost 196,910. So the whole area-light term compiled in
|
|
722
|
+
* unconditionally is roughly a twentieth of what permuting it would cost, and the count being zero
|
|
723
|
+
* is what makes it free at runtime.
|
|
724
|
+
*
|
|
725
|
+
* Four because a rectangle is a *fixture* — a window, a softbox, a panel — and a scene with more
|
|
726
|
+
* than a handful is a scene that wants them baked. Raising it is a uniform-array size and an
|
|
727
|
+
* iteration of the loop, exactly as \`MAX_LIGHTS\` is.
|
|
728
|
+
*/
|
|
729
|
+
#define MAX_AREA_LIGHTS ${maxAreaLights}
|
|
730
|
+
uniform int uAreaLightCount;
|
|
731
|
+
/** Centre of each rectangle, in world space. */
|
|
732
|
+
uniform vec3 uAreaLightPos[MAX_AREA_LIGHTS];
|
|
733
|
+
/** Colour times intensity, as the point lights carry it. */
|
|
734
|
+
uniform vec3 uAreaLightColor[MAX_AREA_LIGHTS];
|
|
735
|
+
/** The rectangle's in-plane axes, unit length, and its half extents along each. */
|
|
736
|
+
uniform vec3 uAreaLightRight[MAX_AREA_LIGHTS];
|
|
737
|
+
uniform vec3 uAreaLightUp[MAX_AREA_LIGHTS];
|
|
738
|
+
uniform vec2 uAreaLightSize[MAX_AREA_LIGHTS];
|
|
739
|
+
/**
|
|
740
|
+
* Whether the rectangle emits from both faces, 1 or 0.
|
|
741
|
+
*
|
|
742
|
+
* A window is one-sided and a hanging panel is two-sided, and the difference is visible: a
|
|
743
|
+
* one-sided light behind a surface must contribute nothing rather than lighting it from behind,
|
|
744
|
+
* which is what an unsigned form factor would do.
|
|
745
|
+
*/
|
|
746
|
+
uniform float uAreaLightTwoSided[MAX_AREA_LIGHTS];
|
|
747
|
+
/** Pi, for turning a dot product into the angle a photometric row is indexed by. */
|
|
748
|
+
#define PI_IES 3.14159265359
|
|
749
|
+
/** A whole turn, for mapping an azimuth onto the plane grid. */
|
|
750
|
+
#define TAU_IES 6.28318530718
|
|
751
|
+
/** Index into the light arrays that each shadow cubemap belongs to, -1 if unused. */
|
|
752
|
+
/**
|
|
753
|
+
* Sampled shadow maps — one per shaded light, deliberately.
|
|
754
|
+
*
|
|
755
|
+
* Any number below MAX_LIGHTS means some lights illuminate without occluding,
|
|
756
|
+
* and *which* ones changes as the camera moves. That reads as shadows switching
|
|
757
|
+
* on and off as you walk up to a lamp, which is worse than either extreme: a
|
|
758
|
+
* missing shadow is merely flat, but one that appears and vanishes draws the
|
|
759
|
+
* eye straight to it. Matching the two budgets is what makes the effect
|
|
760
|
+
* impossible rather than rare.
|
|
761
|
+
*
|
|
762
|
+
* **One array texture, a layer per light, where there were twelve cubemaps.** That is
|
|
763
|
+
* where eleven of WebGL2's sixteen guaranteed texture units came back from, and it is
|
|
764
|
+
* also why the arrays below are indexed by the light rather than by a slot: GLSL ES
|
|
765
|
+
* cannot index a sampler array with a non-constant expression, so selecting a cubemap
|
|
766
|
+
* meant ten unrolled comparison arms. A layer is an ordinary integer, so it is a lookup.
|
|
767
|
+
*/
|
|
768
|
+
#if POINT_SHADOWS
|
|
769
|
+
/** Which array layer holds this light's shadow, or -1 for none. */
|
|
770
|
+
uniform int uPointShadowLayer[MAX_LIGHTS];
|
|
771
|
+
uniform float uPointShadowFar[MAX_LIGHTS];
|
|
772
|
+
uniform float uPointShadowNear[MAX_LIGHTS];
|
|
773
|
+
/** Emitter radius per light — drives how soft its shadows are. */
|
|
774
|
+
uniform float uPointShadowSize[MAX_LIGHTS];
|
|
775
|
+
// How present each bound map is, 0 to 1. See the ramp at the sampling site.
|
|
776
|
+
uniform float uPointShadowWeight[MAX_LIGHTS];
|
|
777
|
+
/*
|
|
778
|
+
* **highp, and it is load-bearing.** GLSL ES gives a fragment shader's samplers a default
|
|
779
|
+
* precision of lowp, whatever the file declares for its floats: that line is about float,
|
|
780
|
+
* not about a sampler. A lowp sampler is entitled to return eight bits.
|
|
781
|
+
*
|
|
782
|
+
* This holds DEPTH_COMPONENT24 — see pointShadowArray.ts — carrying a radius as a fraction
|
|
783
|
+
* of the light's far plane. Eight bits of that is a shadow quantised to eight steps of the
|
|
784
|
+
* light's range, which reads as concentric rings around every lamp. The conversion is only a
|
|
785
|
+
* multiply now rather than the perspective divide a cubemap needed, so the error is no longer
|
|
786
|
+
* *magnified*; it is still eight bits where twenty-four were stored.
|
|
787
|
+
*
|
|
788
|
+
* The 2D shadow maps a hundred lines up already carry the qualifier, and the composite pass
|
|
789
|
+
* was found reading depth at eight bits in 0.13.0. This is the same fault in the third place
|
|
790
|
+
* it exists.
|
|
791
|
+
*/
|
|
792
|
+
uniform highp sampler2DArray uPointShadows; // wgsl:share shadow
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Moving casters are separate from persistent world maps. Two live maps exist
|
|
796
|
+
* only so ownership can crossfade when another light becomes nearer.
|
|
797
|
+
*
|
|
798
|
+
* Layers of the same array, and addressed by the light rather than by the pair, because a
|
|
799
|
+
* light owns at most one of the two at a time.
|
|
800
|
+
*/
|
|
801
|
+
uniform int uLivePointShadowLayer[MAX_LIGHTS];
|
|
802
|
+
uniform float uLivePointShadowFar[MAX_LIGHTS];
|
|
803
|
+
uniform float uLivePointShadowNear[MAX_LIGHTS];
|
|
804
|
+
uniform float uLivePointShadowSize[MAX_LIGHTS];
|
|
805
|
+
uniform float uLivePointShadowWeight[MAX_LIGHTS];
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* A rectangular area light's occlusion, in the same array a point light's lives in.
|
|
809
|
+
*
|
|
810
|
+
* **The same array because there is no second texture unit to put one in.** WebGL2 guarantees
|
|
811
|
+
* sixteen and the lit pass binds sixteen — \`FlatShaderOptions.environmentProbe\` documents the
|
|
812
|
+
* same wall from the other side, a seventeenth declared sampler silently sharing unit 0 with a
|
|
813
|
+
* \`sampler2D\` shadow map. So an area shadow is a layer above the point pool rather than a
|
|
814
|
+
* texture of its own, which also means **it rides \`POINT_SHADOWS\`**: a consumer whose scene is
|
|
815
|
+
* lit by rectangles alone still needs that flag on, and \`RenderQuality.pointShadows\` is where it
|
|
816
|
+
* is turned on. The renderer says so by name rather than drawing an unoccluded rectangle.
|
|
817
|
+
*
|
|
818
|
+
* Indexed by area-light slot, which is the same index the arrays above it use, because
|
|
819
|
+
* \`selectAreaLights\` fills both from the caller's list in order. \`-1\` in a layer says this
|
|
820
|
+
* rectangle has no image — a slot that does not cast, or one whose first bake has not landed.
|
|
821
|
+
*/
|
|
822
|
+
uniform int uAreaShadowLayer[MAX_AREA_LIGHTS];
|
|
823
|
+
uniform float uAreaShadowFar[MAX_AREA_LIGHTS];
|
|
824
|
+
uniform float uAreaShadowNear[MAX_AREA_LIGHTS];
|
|
825
|
+
/** How present the image is, so a first bake arrives rather than appears. */
|
|
826
|
+
uniform float uAreaShadowWeight[MAX_AREA_LIGHTS];
|
|
827
|
+
/**
|
|
828
|
+
* The layer holding movers only, composed with the one above by multiplication.
|
|
829
|
+
*
|
|
830
|
+
* One per casting rectangle rather than a shared pair, which is where this differs from the point
|
|
831
|
+
* lights above: those borrow two live maps and crossfade ownership because fifty lamps compete for
|
|
832
|
+
* them, and at most \`MAX_AREA_LIGHTS\` rectangles exist, so each simply owns one. Nothing changes
|
|
833
|
+
* hands, so nothing has to fade across a handover.
|
|
834
|
+
*/
|
|
835
|
+
uniform int uLiveAreaShadowLayer[MAX_AREA_LIGHTS];
|
|
836
|
+
uniform float uLiveAreaShadowFar[MAX_AREA_LIGHTS];
|
|
837
|
+
uniform float uLiveAreaShadowNear[MAX_AREA_LIGHTS];
|
|
838
|
+
uniform float uLiveAreaShadowWeight[MAX_AREA_LIGHTS];
|
|
839
|
+
#endif
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Omnidirectional shadow test against a depth cubemap.
|
|
843
|
+
*
|
|
844
|
+
* The comparison happens in *linear* distance, not in stored depth. Perspective
|
|
845
|
+
* depth is wildly non-linear: near the far plane a bias of a few thousandths
|
|
846
|
+
* spans metres of world space, which silently makes everything unshadowed. So
|
|
847
|
+
* the sampled depth is converted back to a distance and compared in metres,
|
|
848
|
+
* where a bias means what it looks like it means.
|
|
849
|
+
*/
|
|
850
|
+
/**
|
|
851
|
+
* Sample offsets forming a rough sphere, for filtering a cubemap shadow.
|
|
852
|
+
* Perturbing the *direction* is how PCF works on a cube — there is no 2D UV
|
|
853
|
+
* neighbourhood to step across the way there is for the sun's cascade.
|
|
854
|
+
*/
|
|
855
|
+
#if POINT_SHADOWS
|
|
856
|
+
const vec3 PCF_OFFSETS[${MAX_SHADOW_FILTER_TAPS}] = vec3[${MAX_SHADOW_FILTER_TAPS}](
|
|
857
|
+
vec3( 1.0, 1.0, 1.0), vec3( 1.0, -1.0, -1.0), vec3(-1.0, 1.0, -1.0), vec3(-1.0, -1.0, 1.0),
|
|
858
|
+
vec3( 1.0, -1.0, 1.0), vec3(-1.0, 1.0, 1.0), vec3( 1.0, 1.0, -1.0), vec3(-1.0, -1.0, -1.0),
|
|
859
|
+
vec3( 1.0, 0.0, 0.0), vec3(-1.0, 0.0, 0.0), vec3( 0.0, 1.0, 0.0), vec3( 0.0, -1.0, 0.0)
|
|
860
|
+
);
|
|
861
|
+
#endif
|
|
862
|
+
|
|
863
|
+
/** A finite point-light shadow loses strength with the light that casts it. */`;
|
|
864
|
+
}
|