@aura3d/engine 4.6.1 → 4.7.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/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.d.ts +12 -0
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.d.ts.map +1 -1
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.js +26 -1
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.js.map +1 -1
- package/dist/assets/vfx/LICENSE.md +1 -0
- package/dist/assets/vfx/aura-vfx-1k.png +0 -0
- package/dist/assets/vfx/aura-vfx-2k.png +0 -0
- package/dist/aura3d-cli/admission/cubeLut.d.ts +18 -0
- package/dist/aura3d-cli/admission/cubeLut.d.ts.map +1 -0
- package/dist/aura3d-cli/admission/cubeLut.js +53 -0
- package/dist/aura3d-cli/admission/cubeLut.js.map +1 -0
- package/dist/aura3d-cli/asset-core-types.d.ts +7 -4
- package/dist/aura3d-cli/asset-core-types.d.ts.map +1 -1
- package/dist/aura3d-cli/cli-help.d.ts.map +1 -1
- package/dist/aura3d-cli/cli-help.js +7 -4
- package/dist/aura3d-cli/cli-help.js.map +1 -1
- package/dist/aura3d-cli/cli-options.d.ts +1 -1
- package/dist/aura3d-cli/cli-options.d.ts.map +1 -1
- package/dist/aura3d-cli/cli-options.js +2 -2
- package/dist/aura3d-cli/cli-options.js.map +1 -1
- package/dist/aura3d-cli/cli.js +3 -2
- package/dist/aura3d-cli/cli.js.map +1 -1
- package/dist/aura3d-cli/commands/assets/certifyCategories.d.ts +26 -0
- package/dist/aura3d-cli/commands/assets/certifyCategories.d.ts.map +1 -0
- package/dist/aura3d-cli/commands/assets/certifyCategories.js +31 -0
- package/dist/aura3d-cli/commands/assets/certifyCategories.js.map +1 -0
- package/dist/aura3d-cli/commands/assets/optimize.d.ts +66 -0
- package/dist/aura3d-cli/commands/assets/optimize.d.ts.map +1 -1
- package/dist/aura3d-cli/commands/assets/optimize.js +270 -1
- package/dist/aura3d-cli/commands/assets/optimize.js.map +1 -1
- package/dist/aura3d-cli/commands/assets/optimizeVerb.d.ts.map +1 -1
- package/dist/aura3d-cli/commands/assets/optimizeVerb.js +26 -1
- package/dist/aura3d-cli/commands/assets/optimizeVerb.js.map +1 -1
- package/dist/aura3d-cli/commands/evidence/judge.d.ts +50 -1
- package/dist/aura3d-cli/commands/evidence/judge.d.ts.map +1 -1
- package/dist/aura3d-cli/commands/evidence/judge.js +154 -6
- package/dist/aura3d-cli/commands/evidence/judge.js.map +1 -1
- package/dist/aura3d-cli/commands/prd05/index.js +1 -1
- package/dist/aura3d-cli/commands/prd05/index.js.map +1 -1
- package/dist/aura3d-cli/index.d.ts.map +1 -1
- package/dist/aura3d-cli/index.js +25 -9
- package/dist/aura3d-cli/index.js.map +1 -1
- package/dist/aura3d-cli/look/judge.d.ts +53 -5
- package/dist/aura3d-cli/look/judge.d.ts.map +1 -1
- package/dist/aura3d-cli/look/judge.js +226 -50
- package/dist/aura3d-cli/look/judge.js.map +1 -1
- package/dist/create-aura3d/index.js +1 -1
- package/dist/engine/agent-api/RootRuntimeSupport.d.ts +7 -0
- package/dist/engine/agent-api/RootRuntimeSupport.d.ts.map +1 -1
- package/dist/engine/agent-api/RootRuntimeSupport.js +7 -0
- package/dist/engine/agent-api/RootRuntimeSupport.js.map +1 -1
- package/dist/engine/agent-api/app/actorAnimationHandle.d.ts +2 -0
- package/dist/engine/agent-api/app/actorAnimationHandle.d.ts.map +1 -1
- package/dist/engine/agent-api/app/actorAnimationHandle.js +149 -2
- package/dist/engine/agent-api/app/actorAnimationHandle.js.map +1 -1
- package/dist/engine/agent-api/app/createAuraApp.d.ts.map +1 -1
- package/dist/engine/agent-api/app/createAuraApp.js +13 -1
- package/dist/engine/agent-api/app/createAuraApp.js.map +1 -1
- package/dist/engine/agent-api/app/frameLoop.d.ts.map +1 -1
- package/dist/engine/agent-api/app/frameLoop.js +4 -2
- package/dist/engine/agent-api/app/frameLoop.js.map +1 -1
- package/dist/engine/agent-api/camera/layers/cinematicBars.d.ts +2 -0
- package/dist/engine/agent-api/camera/layers/cinematicBars.d.ts.map +1 -1
- package/dist/engine/agent-api/camera/layers/cinematicBars.js +4 -0
- package/dist/engine/agent-api/camera/layers/cinematicBars.js.map +1 -1
- package/dist/engine/agent-api/compiler/compileScene.d.ts +11 -1
- package/dist/engine/agent-api/compiler/compileScene.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/compileScene.js +27 -1
- package/dist/engine/agent-api/compiler/compileScene.js.map +1 -1
- package/dist/engine/agent-api/compiler/customMaterial.d.ts +16 -5
- package/dist/engine/agent-api/compiler/customMaterial.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/customMaterial.js +149 -20
- package/dist/engine/agent-api/compiler/customMaterial.js.map +1 -1
- package/dist/engine/agent-api/compiler/environment.d.ts +57 -1
- package/dist/engine/agent-api/compiler/environment.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/environment.js +170 -5
- package/dist/engine/agent-api/compiler/environment.js.map +1 -1
- package/dist/engine/agent-api/compiler/fog.js +1 -1
- package/dist/engine/agent-api/compiler/fog.js.map +1 -1
- package/dist/engine/agent-api/compiler/lights.d.ts +92 -0
- package/dist/engine/agent-api/compiler/lights.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/lights.js +358 -1
- package/dist/engine/agent-api/compiler/lights.js.map +1 -1
- package/dist/engine/agent-api/compiler/observations.d.ts +34 -0
- package/dist/engine/agent-api/compiler/observations.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/observations.js +77 -5
- package/dist/engine/agent-api/compiler/observations.js.map +1 -1
- package/dist/engine/agent-api/compiler/postprocess.d.ts +10 -0
- package/dist/engine/agent-api/compiler/postprocess.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/postprocess.js +28 -7
- package/dist/engine/agent-api/compiler/postprocess.js.map +1 -1
- package/dist/engine/agent-api/compiler/renderInput.d.ts +2 -0
- package/dist/engine/agent-api/compiler/renderInput.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/renderInput.js +15 -2
- package/dist/engine/agent-api/compiler/renderInput.js.map +1 -1
- package/dist/engine/agent-api/compiler/renderer.d.ts +6 -0
- package/dist/engine/agent-api/compiler/renderer.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/renderer.js +14 -3
- package/dist/engine/agent-api/compiler/renderer.js.map +1 -1
- package/dist/engine/agent-api/diagnostics.d.ts +16 -0
- package/dist/engine/agent-api/diagnostics.d.ts.map +1 -1
- package/dist/engine/agent-api/diagnostics.js +45 -2
- package/dist/engine/agent-api/diagnostics.js.map +1 -1
- package/dist/engine/agent-api/index.d.ts +2 -0
- package/dist/engine/agent-api/index.d.ts.map +1 -1
- package/dist/engine/agent-api/index.js +3 -0
- package/dist/engine/agent-api/index.js.map +1 -1
- package/dist/engine/agent-api/looks/lookPresets.d.ts +2 -0
- package/dist/engine/agent-api/looks/lookPresets.d.ts.map +1 -1
- package/dist/engine/agent-api/looks/lookPresets.js.map +1 -1
- package/dist/engine/agent-api/looks/looks.d.ts +12 -2
- package/dist/engine/agent-api/looks/looks.d.ts.map +1 -1
- package/dist/engine/agent-api/looks/looks.js +365 -65
- package/dist/engine/agent-api/looks/looks.js.map +1 -1
- package/dist/engine/agent-api/nodes/builder.d.ts +8 -0
- package/dist/engine/agent-api/nodes/builder.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/builder.js +15 -0
- package/dist/engine/agent-api/nodes/builder.js.map +1 -1
- package/dist/engine/agent-api/nodes/effects.composite.d.ts +13 -9
- package/dist/engine/agent-api/nodes/effects.composite.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/effects.d.ts +65 -14
- package/dist/engine/agent-api/nodes/effects.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/effects.js +49 -16
- package/dist/engine/agent-api/nodes/effects.js.map +1 -1
- package/dist/engine/agent-api/nodes/effects.post.d.ts +62 -5
- package/dist/engine/agent-api/nodes/effects.post.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/effects.post.js +30 -17
- package/dist/engine/agent-api/nodes/effects.post.js.map +1 -1
- package/dist/engine/agent-api/nodes/effects.toon.d.ts +65 -1
- package/dist/engine/agent-api/nodes/effects.toon.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/effects.toon.js +186 -23
- package/dist/engine/agent-api/nodes/effects.toon.js.map +1 -1
- package/dist/engine/agent-api/nodes/groups.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/groups.js +2 -2
- package/dist/engine/agent-api/nodes/groups.js.map +1 -1
- package/dist/engine/agent-api/nodes/instances.d.ts +130 -90
- package/dist/engine/agent-api/nodes/instances.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/instances.js +192 -48
- package/dist/engine/agent-api/nodes/instances.js.map +1 -1
- package/dist/engine/agent-api/nodes/material.d.ts +8 -1
- package/dist/engine/agent-api/nodes/material.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/material.js +82 -0
- package/dist/engine/agent-api/nodes/material.js.map +1 -1
- package/dist/engine/agent-api/nodes/outlineTargets.d.ts +16 -0
- package/dist/engine/agent-api/nodes/outlineTargets.d.ts.map +1 -0
- package/dist/engine/agent-api/nodes/outlineTargets.js +46 -0
- package/dist/engine/agent-api/nodes/outlineTargets.js.map +1 -0
- package/dist/engine/agent-api/nodes/scene.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/scene.js +2 -2
- package/dist/engine/agent-api/nodes/scene.js.map +1 -1
- package/dist/engine/agent-api/nodes/sky.d.ts +23 -6
- package/dist/engine/agent-api/nodes/sky.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/sky.js +2 -0
- package/dist/engine/agent-api/nodes/sky.js.map +1 -1
- package/dist/engine/agent-api/nodes/types/runtime.d.ts +28 -1
- package/dist/engine/agent-api/nodes/types/runtime.d.ts.map +1 -1
- package/dist/engine/agent-api/nodes/types.d.ts +71 -3
- package/dist/engine/agent-api/nodes/types.d.ts.map +1 -1
- package/dist/engine/agent-api/performanceEvidence.js +7 -2
- package/dist/engine/agent-api/performanceEvidence.js.map +1 -1
- package/dist/engine/agent-api/postBridge.d.ts +75 -3
- package/dist/engine/agent-api/postBridge.d.ts.map +1 -1
- package/dist/engine/agent-api/postBridge.js +436 -33
- package/dist/engine/agent-api/postBridge.js.map +1 -1
- package/dist/engine/agent-api/postPresets.d.ts +8 -4
- package/dist/engine/agent-api/postPresets.d.ts.map +1 -1
- package/dist/engine/agent-api/postPresets.js +12 -11
- package/dist/engine/agent-api/postPresets.js.map +1 -1
- package/dist/engine/agent-api/publishedUnion.d.ts +7 -4
- package/dist/engine/agent-api/publishedUnion.d.ts.map +1 -1
- package/dist/engine/agent-api/publishedUnion.js +1 -1
- package/dist/engine/agent-api/publishedUnion.js.map +1 -1
- package/dist/engine/agent-api/rendererDiagnostics.js +4 -6
- package/dist/engine/agent-api/rendererDiagnostics.js.map +1 -1
- package/dist/engine/agent-api/vfx/atmosphere-api.d.ts +2 -4
- package/dist/engine/agent-api/vfx/atmosphere-api.d.ts.map +1 -1
- package/dist/engine/agent-api/vfx/atmosphere-api.js +2 -1
- package/dist/engine/agent-api/vfx/atmosphere-api.js.map +1 -1
- package/dist/engine/agent-api/vfx/effects-api.d.ts +3 -0
- package/dist/engine/agent-api/vfx/effects-api.d.ts.map +1 -1
- package/dist/engine/agent-api/vfx/effects-api.js +337 -74
- package/dist/engine/agent-api/vfx/effects-api.js.map +1 -1
- package/dist/engine/agent-api/world/flags.d.ts +33 -3
- package/dist/engine/agent-api/world/flags.d.ts.map +1 -1
- package/dist/engine/agent-api/world/flags.js +44 -12
- package/dist/engine/agent-api/world/flags.js.map +1 -1
- package/dist/engine/agent-api/world/index.d.ts +10 -1
- package/dist/engine/agent-api/world/index.d.ts.map +1 -1
- package/dist/engine/agent-api/world/index.js +11 -2
- package/dist/engine/agent-api/world/index.js.map +1 -1
- package/dist/engine/agent-api/world/scatter.d.ts +50 -3
- package/dist/engine/agent-api/world/scatter.d.ts.map +1 -1
- package/dist/engine/agent-api/world/scatter.js +93 -7
- package/dist/engine/agent-api/world/scatter.js.map +1 -1
- package/dist/engine/agent-api/world/terrain.d.ts +8 -0
- package/dist/engine/agent-api/world/terrain.d.ts.map +1 -1
- package/dist/engine/agent-api/world/terrain.js +6 -1
- package/dist/engine/agent-api/world/terrain.js.map +1 -1
- package/dist/engine/contracts/animation.d.ts +30 -12
- package/dist/engine/contracts/animation.d.ts.map +1 -1
- package/dist/engine/contracts/animation.js +2 -0
- package/dist/engine/contracts/animation.js.map +1 -1
- package/dist/engine/contracts/art.d.ts +1 -1
- package/dist/engine/contracts/art.d.ts.map +1 -1
- package/dist/engine/contracts/atmosphere.d.ts +43 -9
- package/dist/engine/contracts/atmosphere.d.ts.map +1 -1
- package/dist/engine/contracts/atmosphere.js.map +1 -1
- package/dist/engine/contracts/camera.d.ts +8 -2
- package/dist/engine/contracts/camera.d.ts.map +1 -1
- package/dist/engine/contracts/camera.js +14 -3
- package/dist/engine/contracts/camera.js.map +1 -1
- package/dist/engine/contracts/effects.d.ts +83 -37
- package/dist/engine/contracts/effects.d.ts.map +1 -1
- package/dist/engine/contracts/effects.js +2 -1
- package/dist/engine/contracts/effects.js.map +1 -1
- package/dist/engine/contracts/flags.d.ts.map +1 -1
- package/dist/engine/contracts/flags.js +29 -4
- package/dist/engine/contracts/flags.js.map +1 -1
- package/dist/engine/contracts/lighting.d.ts +33 -1
- package/dist/engine/contracts/lighting.d.ts.map +1 -1
- package/dist/engine/contracts/lighting.js +13 -1
- package/dist/engine/contracts/lighting.js.map +1 -1
- package/dist/engine/contracts/looks.d.ts +57 -1
- package/dist/engine/contracts/looks.d.ts.map +1 -1
- package/dist/engine/contracts/looks.js.map +1 -1
- package/dist/engine/contracts/materials.d.ts +25 -0
- package/dist/engine/contracts/materials.d.ts.map +1 -1
- package/dist/engine/contracts/materials.js +4 -1
- package/dist/engine/contracts/materials.js.map +1 -1
- package/dist/engine/contracts/post.d.ts +14 -0
- package/dist/engine/contracts/post.d.ts.map +1 -1
- package/dist/engine/contracts/post.js +2 -0
- package/dist/engine/contracts/post.js.map +1 -1
- package/dist/engine/instances-model/CrowdKit.d.ts +231 -0
- package/dist/engine/instances-model/CrowdKit.d.ts.map +1 -0
- package/dist/engine/instances-model/CrowdKit.js +496 -0
- package/dist/engine/instances-model/CrowdKit.js.map +1 -0
- package/dist/engine/lanes/prd02.d.ts +36 -2
- package/dist/engine/lanes/prd02.d.ts.map +1 -1
- package/dist/engine/lanes/prd02.js +120 -7
- package/dist/engine/lanes/prd02.js.map +1 -1
- package/dist/engine/lanes/prd03.d.ts.map +1 -1
- package/dist/engine/lanes/prd03.js +9 -1
- package/dist/engine/lanes/prd03.js.map +1 -1
- package/dist/engine/lanes/prd07.d.ts.map +1 -1
- package/dist/engine/lanes/prd07.js +12 -7
- package/dist/engine/lanes/prd07.js.map +1 -1
- package/dist/engine/production-runtime/GlbResourceCache.d.ts +140 -0
- package/dist/engine/production-runtime/GlbResourceCache.d.ts.map +1 -0
- package/dist/engine/production-runtime/GlbResourceCache.js +237 -0
- package/dist/engine/production-runtime/GlbResourceCache.js.map +1 -0
- package/dist/engine/production-runtime/ModelMaterialOverrides.d.ts +53 -2
- package/dist/engine/production-runtime/ModelMaterialOverrides.d.ts.map +1 -1
- package/dist/engine/production-runtime/ModelMaterialOverrides.js +142 -1
- package/dist/engine/production-runtime/ModelMaterialOverrides.js.map +1 -1
- package/dist/engine/production-runtime/TypedGLBActor.d.ts +55 -0
- package/dist/engine/production-runtime/TypedGLBActor.d.ts.map +1 -1
- package/dist/engine/production-runtime/TypedGLBActor.js +205 -3
- package/dist/engine/production-runtime/TypedGLBActor.js.map +1 -1
- package/dist/engine/production-runtime/actor/ModelTextureShare.d.ts.map +1 -1
- package/dist/engine/production-runtime/actor/ModelTextureShare.js +5 -2
- package/dist/engine/production-runtime/actor/ModelTextureShare.js.map +1 -1
- package/dist/engine/production-runtime/actor/TypedGLBActorMaterials.d.ts.map +1 -1
- package/dist/engine/production-runtime/actor/TypedGLBActorMaterials.js +10 -1
- package/dist/engine/production-runtime/actor/TypedGLBActorMaterials.js.map +1 -1
- package/dist/engine/production-runtime/effects/EffectNodeLowering.d.ts +55 -0
- package/dist/engine/production-runtime/effects/EffectNodeLowering.d.ts.map +1 -1
- package/dist/engine/production-runtime/effects/EffectNodeLowering.js +71 -7
- package/dist/engine/production-runtime/effects/EffectNodeLowering.js.map +1 -1
- package/dist/engine/production-runtime/effects/FlipbookAtlas.d.ts +85 -0
- package/dist/engine/production-runtime/effects/FlipbookAtlas.d.ts.map +1 -1
- package/dist/engine/production-runtime/effects/FlipbookAtlas.js +164 -0
- package/dist/engine/production-runtime/effects/FlipbookAtlas.js.map +1 -1
- package/dist/engine/production-runtime/effects/LiveAtmosphere.d.ts +37 -6
- package/dist/engine/production-runtime/effects/LiveAtmosphere.d.ts.map +1 -1
- package/dist/engine/production-runtime/effects/LiveAtmosphere.js +93 -10
- package/dist/engine/production-runtime/effects/LiveAtmosphere.js.map +1 -1
- package/dist/engine/production-runtime/effects/ProductionEffectSystem.d.ts +71 -1
- package/dist/engine/production-runtime/effects/ProductionEffectSystem.d.ts.map +1 -1
- package/dist/engine/production-runtime/effects/ProductionEffectSystem.js +356 -6
- package/dist/engine/production-runtime/effects/ProductionEffectSystem.js.map +1 -1
- package/dist/engine/production-runtime/world/WaterRuntime.d.ts +9 -0
- package/dist/engine/production-runtime/world/WaterRuntime.d.ts.map +1 -1
- package/dist/engine/production-runtime/world/WaterRuntime.js +27 -11
- package/dist/engine/production-runtime/world/WaterRuntime.js.map +1 -1
- package/dist/engine/production-runtime/world/WorldFramePasses.d.ts +11 -1
- package/dist/engine/production-runtime/world/WorldFramePasses.d.ts.map +1 -1
- package/dist/engine/production-runtime/world/WorldFramePasses.js +37 -1
- package/dist/engine/production-runtime/world/WorldFramePasses.js.map +1 -1
- package/dist/engine/public/index.d.ts +22 -0
- package/dist/engine/public/index.d.ts.map +1 -1
- package/dist/engine/public/index.js +14 -0
- package/dist/engine/public/index.js.map +1 -1
- package/dist/game/art/define.d.ts +1 -1
- package/dist/game/art/define.d.ts.map +1 -1
- package/dist/game/art/define.js +1 -1
- package/dist/game/art/define.js.map +1 -1
- package/dist/game/fonts/register.d.ts +16 -1
- package/dist/game/fonts/register.d.ts.map +1 -1
- package/dist/game/fonts/register.js +18 -7
- package/dist/game/fonts/register.js.map +1 -1
- package/dist/game/hud/themes.d.ts +33 -8
- package/dist/game/hud/themes.d.ts.map +1 -1
- package/dist/game/hud/themes.js +125 -22
- package/dist/game/hud/themes.js.map +1 -1
- package/dist/game/index.d.ts +4 -2
- package/dist/game/index.d.ts.map +1 -1
- package/dist/game/index.js +2 -1
- package/dist/game/index.js.map +1 -1
- package/dist/game/juice/audioReactive.d.ts +42 -0
- package/dist/game/juice/audioReactive.d.ts.map +1 -0
- package/dist/game/juice/audioReactive.js +68 -0
- package/dist/game/juice/audioReactive.js.map +1 -0
- package/dist/game/styles/themes/arcade-neon.css +2 -1
- package/dist/game/styles/themes/fighting.css +2 -1
- package/dist/game/styles/themes/ink-scroll.css +15 -0
- package/dist/game/styles/themes/motorsport.css +2 -1
- package/dist/game/styles/themes/plain.css +2 -1
- package/dist/game/styles/themes/sci-fi-telemetry.css +2 -1
- package/dist/game/styles/themes/sky-expedition.css +15 -0
- package/dist/game/styles/themes/sports-broadcast.css +2 -1
- package/dist/game/styles/themes/storybook.css +15 -0
- package/dist/game/styles/themes/tabletop.css +2 -1
- package/dist/game/styles.css +3 -1
- package/dist/rendering/ClusteredForwardLighting.d.ts.map +1 -1
- package/dist/rendering/ClusteredForwardLighting.js +3 -1
- package/dist/rendering/ClusteredForwardLighting.js.map +1 -1
- package/dist/rendering/DepthPass.d.ts +25 -0
- package/dist/rendering/DepthPass.d.ts.map +1 -1
- package/dist/rendering/DepthPass.js +149 -1
- package/dist/rendering/DepthPass.js.map +1 -1
- package/dist/rendering/ForwardPass.d.ts +84 -0
- package/dist/rendering/ForwardPass.d.ts.map +1 -1
- package/dist/rendering/ForwardPass.js +236 -12
- package/dist/rendering/ForwardPass.js.map +1 -1
- package/dist/rendering/LightUniforms.d.ts +12 -0
- package/dist/rendering/LightUniforms.d.ts.map +1 -1
- package/dist/rendering/LightUniforms.js +9 -1
- package/dist/rendering/LightUniforms.js.map +1 -1
- package/dist/rendering/atmosphere/CloudLayer.d.ts +15 -0
- package/dist/rendering/atmosphere/CloudLayer.d.ts.map +1 -1
- package/dist/rendering/atmosphere/CloudLayer.js +27 -5
- package/dist/rendering/atmosphere/CloudLayer.js.map +1 -1
- package/dist/rendering/atmosphere/GradientSky.d.ts +3 -3
- package/dist/rendering/atmosphere/GradientSky.d.ts.map +1 -1
- package/dist/rendering/atmosphere/GradientSky.js +20 -9
- package/dist/rendering/atmosphere/GradientSky.js.map +1 -1
- package/dist/rendering/atmosphere/HeightFog.d.ts.map +1 -1
- package/dist/rendering/atmosphere/HeightFog.js +9 -0
- package/dist/rendering/atmosphere/HeightFog.js.map +1 -1
- package/dist/rendering/atmosphere/SkyBackgroundPass.d.ts +11 -0
- package/dist/rendering/atmosphere/SkyBackgroundPass.d.ts.map +1 -1
- package/dist/rendering/atmosphere/SkyBackgroundPass.js +40 -7
- package/dist/rendering/atmosphere/SkyBackgroundPass.js.map +1 -1
- package/dist/rendering/atmosphere/StarField.d.ts +21 -0
- package/dist/rendering/atmosphere/StarField.d.ts.map +1 -1
- package/dist/rendering/atmosphere/StarField.js +24 -1
- package/dist/rendering/atmosphere/StarField.js.map +1 -1
- package/dist/rendering/atmosphere/sky.glsl.d.ts.map +1 -1
- package/dist/rendering/atmosphere/sky.glsl.js +8 -0
- package/dist/rendering/atmosphere/sky.glsl.js.map +1 -1
- package/dist/rendering/contracts/flags.state.d.ts.map +1 -1
- package/dist/rendering/contracts/flags.state.js +19 -0
- package/dist/rendering/contracts/flags.state.js.map +1 -1
- package/dist/rendering/forward/Lighting.d.ts +7 -1
- package/dist/rendering/forward/Lighting.d.ts.map +1 -1
- package/dist/rendering/forward/Lighting.js +24 -1
- package/dist/rendering/forward/Lighting.js.map +1 -1
- package/dist/rendering/forward/Velocity.d.ts +8 -0
- package/dist/rendering/forward/Velocity.d.ts.map +1 -1
- package/dist/rendering/forward/Velocity.js +10 -0
- package/dist/rendering/forward/Velocity.js.map +1 -1
- package/dist/rendering/lanes/prd03.d.ts +1 -1
- package/dist/rendering/lanes/prd03.d.ts.map +1 -1
- package/dist/rendering/lanes/prd03.js +6 -1
- package/dist/rendering/lanes/prd03.js.map +1 -1
- package/dist/rendering/lanes/prd07.d.ts.map +1 -1
- package/dist/rendering/lanes/prd07.js +5 -2
- package/dist/rendering/lanes/prd07.js.map +1 -1
- package/dist/rendering/post/DisplayLutCache.d.ts +10 -2
- package/dist/rendering/post/DisplayLutCache.d.ts.map +1 -1
- package/dist/rendering/post/DisplayLutCache.js +15 -3
- package/dist/rendering/post/DisplayLutCache.js.map +1 -1
- package/dist/rendering/post/PostGraph.d.ts +23 -0
- package/dist/rendering/post/PostGraph.d.ts.map +1 -1
- package/dist/rendering/post/PostGraph.js.map +1 -1
- package/dist/rendering/post/PostQualityTiers.d.ts +36 -0
- package/dist/rendering/post/PostQualityTiers.d.ts.map +1 -1
- package/dist/rendering/post/PostQualityTiers.js +75 -0
- package/dist/rendering/post/PostQualityTiers.js.map +1 -1
- package/dist/rendering/post/chunks/velocity.glsl.d.ts +7 -0
- package/dist/rendering/post/chunks/velocity.glsl.d.ts.map +1 -1
- package/dist/rendering/post/chunks/velocity.glsl.js +12 -1
- package/dist/rendering/post/chunks/velocity.glsl.js.map +1 -1
- package/dist/rendering/post/shaders/displayGrade.glsl.d.ts +15 -1
- package/dist/rendering/post/shaders/displayGrade.glsl.d.ts.map +1 -1
- package/dist/rendering/post/shaders/displayGrade.glsl.js +26 -2
- package/dist/rendering/post/shaders/displayGrade.glsl.js.map +1 -1
- package/dist/rendering/post/shaders/dof.glsl.d.ts +11 -1
- package/dist/rendering/post/shaders/dof.glsl.d.ts.map +1 -1
- package/dist/rendering/post/shaders/dof.glsl.js +22 -0
- package/dist/rendering/post/shaders/dof.glsl.js.map +1 -1
- package/dist/rendering/post/shaders/finalize.glsl.d.ts +1 -1
- package/dist/rendering/post/shaders/finalize.glsl.d.ts.map +1 -1
- package/dist/rendering/post/shaders/finalize.glsl.js +3 -2
- package/dist/rendering/post/shaders/finalize.glsl.js.map +1 -1
- package/dist/rendering/post/shaders/godrays.glsl.d.ts +24 -1
- package/dist/rendering/post/shaders/godrays.glsl.d.ts.map +1 -1
- package/dist/rendering/post/shaders/godrays.glsl.js +45 -5
- package/dist/rendering/post/shaders/godrays.glsl.js.map +1 -1
- package/dist/rendering/post/shaders/hdrGrade.glsl.d.ts +66 -0
- package/dist/rendering/post/shaders/hdrGrade.glsl.d.ts.map +1 -0
- package/dist/rendering/post/shaders/hdrGrade.glsl.js +159 -0
- package/dist/rendering/post/shaders/hdrGrade.glsl.js.map +1 -0
- package/dist/rendering/post/shaders/ssr.glsl.d.ts +39 -0
- package/dist/rendering/post/shaders/ssr.glsl.d.ts.map +1 -0
- package/dist/rendering/post/shaders/ssr.glsl.js +163 -0
- package/dist/rendering/post/shaders/ssr.glsl.js.map +1 -0
- package/dist/rendering/post/v2Stages.d.ts +53 -0
- package/dist/rendering/post/v2Stages.d.ts.map +1 -1
- package/dist/rendering/post/v2Stages.js +314 -23
- package/dist/rendering/post/v2Stages.js.map +1 -1
- package/dist/rendering/postprocess/NativeBloomPyramid.d.ts +19 -0
- package/dist/rendering/postprocess/NativeBloomPyramid.d.ts.map +1 -1
- package/dist/rendering/postprocess/NativeBloomPyramid.js +37 -0
- package/dist/rendering/postprocess/NativeBloomPyramid.js.map +1 -1
- package/dist/rendering/program/ProgramGenerator.d.ts.map +1 -1
- package/dist/rendering/program/ProgramGenerator.js +12 -1
- package/dist/rendering/program/ProgramGenerator.js.map +1 -1
- package/dist/rendering/program/chunks/shadow_forward.glsl.d.ts +12 -0
- package/dist/rendering/program/chunks/shadow_forward.glsl.d.ts.map +1 -1
- package/dist/rendering/program/chunks/shadow_forward.glsl.js +57 -0
- package/dist/rendering/program/chunks/shadow_forward.glsl.js.map +1 -1
- package/dist/rendering/renderer/Background.d.ts.map +1 -1
- package/dist/rendering/renderer/Background.js +26 -2
- package/dist/rendering/renderer/Background.js.map +1 -1
- package/dist/rendering/renderer/FrameGraph.d.ts +8 -0
- package/dist/rendering/renderer/FrameGraph.d.ts.map +1 -1
- package/dist/rendering/renderer/FrameGraph.js +46 -7
- package/dist/rendering/renderer/FrameGraph.js.map +1 -1
- package/dist/rendering/renderer/OutlineTargets.d.ts +99 -0
- package/dist/rendering/renderer/OutlineTargets.d.ts.map +1 -0
- package/dist/rendering/renderer/OutlineTargets.js +286 -0
- package/dist/rendering/renderer/OutlineTargets.js.map +1 -0
- package/dist/rendering/renderer/PostprocessExecution.d.ts +5 -0
- package/dist/rendering/renderer/PostprocessExecution.d.ts.map +1 -1
- package/dist/rendering/renderer/PostprocessExecution.js +70 -4
- package/dist/rendering/renderer/PostprocessExecution.js.map +1 -1
- package/dist/rendering/renderer/postSkipped.d.ts +6 -0
- package/dist/rendering/renderer/postSkipped.d.ts.map +1 -1
- package/dist/rendering/renderer/postSkipped.js +8 -0
- package/dist/rendering/renderer/postSkipped.js.map +1 -1
- package/dist/rendering/shaders/chunks/author/ibl.glsl.d.ts +20 -0
- package/dist/rendering/shaders/chunks/author/ibl.glsl.d.ts.map +1 -0
- package/dist/rendering/shaders/chunks/author/ibl.glsl.js +84 -0
- package/dist/rendering/shaders/chunks/author/ibl.glsl.js.map +1 -0
- package/dist/rendering/shaders/chunks/author/index.d.ts +3 -1
- package/dist/rendering/shaders/chunks/author/index.d.ts.map +1 -1
- package/dist/rendering/shaders/chunks/author/index.js +38 -3
- package/dist/rendering/shaders/chunks/author/index.js.map +1 -1
- package/dist/rendering/shaders/chunks/author/lights.glsl.d.ts +16 -0
- package/dist/rendering/shaders/chunks/author/lights.glsl.d.ts.map +1 -0
- package/dist/rendering/shaders/chunks/author/lights.glsl.js +112 -0
- package/dist/rendering/shaders/chunks/author/lights.glsl.js.map +1 -0
- package/dist/rendering/shaders/chunks/author/shadow.glsl.d.ts +16 -2
- package/dist/rendering/shaders/chunks/author/shadow.glsl.d.ts.map +1 -1
- package/dist/rendering/shaders/chunks/author/shadow.glsl.js +46 -2
- package/dist/rendering/shaders/chunks/author/shadow.glsl.js.map +1 -1
- package/dist/rendering/shaders/chunks/instance_color_target.glsl.d.ts +34 -0
- package/dist/rendering/shaders/chunks/instance_color_target.glsl.d.ts.map +1 -0
- package/dist/rendering/shaders/chunks/instance_color_target.glsl.js +101 -0
- package/dist/rendering/shaders/chunks/instance_color_target.glsl.js.map +1 -0
- package/dist/rendering/shaders/chunks/rim.glsl.d.ts +37 -0
- package/dist/rendering/shaders/chunks/rim.glsl.d.ts.map +1 -0
- package/dist/rendering/shaders/chunks/rim.glsl.js +50 -0
- package/dist/rendering/shaders/chunks/rim.glsl.js.map +1 -0
- package/dist/rendering/shadows/Prd02ShadowBridge.d.ts +26 -3
- package/dist/rendering/shadows/Prd02ShadowBridge.d.ts.map +1 -1
- package/dist/rendering/shadows/Prd02ShadowBridge.js +134 -8
- package/dist/rendering/shadows/Prd02ShadowBridge.js.map +1 -1
- package/dist/rendering/shadows/Prd02ShadowsContributor.d.ts.map +1 -1
- package/dist/rendering/shadows/Prd02ShadowsContributor.js +4 -16
- package/dist/rendering/shadows/Prd02ShadowsContributor.js.map +1 -1
- package/dist/rendering/vfx/VfxAtlas.d.ts +10 -0
- package/dist/rendering/vfx/VfxAtlas.d.ts.map +1 -1
- package/dist/rendering/vfx/VfxAtlas.js +18 -3
- package/dist/rendering/vfx/VfxAtlas.js.map +1 -1
- package/dist/rendering/webgl2/LegacyPost.d.ts +9 -1
- package/dist/rendering/webgl2/LegacyPost.d.ts.map +1 -1
- package/dist/rendering/webgl2/LegacyPost.js +23 -7
- package/dist/rendering/webgl2/LegacyPost.js.map +1 -1
- package/dist/rendering/webgl2/MultiDraw.d.ts.map +1 -1
- package/dist/rendering/webgl2/MultiDraw.js +51 -1
- package/dist/rendering/webgl2/MultiDraw.js.map +1 -1
- package/dist/rendering/world/vegetation/WindField.d.ts.map +1 -1
- package/dist/rendering/world/vegetation/WindField.js +4 -1
- package/dist/rendering/world/vegetation/WindField.js.map +1 -1
- package/dist/rendering/world/water/ReflectionViewPass.d.ts.map +1 -1
- package/dist/rendering/world/water/ReflectionViewPass.js +12 -2
- package/dist/rendering/world/water/ReflectionViewPass.js.map +1 -1
- package/dist/rendering/world/water/SceneCopyFallback.d.ts.map +1 -1
- package/dist/rendering/world/water/SceneCopyFallback.js +9 -2
- package/dist/rendering/world/water/SceneCopyFallback.js.map +1 -1
- package/dist/rendering/world/water/WaterMaterial.d.ts.map +1 -1
- package/dist/rendering/world/water/WaterMaterial.js +8 -2
- package/dist/rendering/world/water/WaterMaterial.js.map +1 -1
- package/package.json +25 -25
- package/templates/cinematic-scene/package.json +2 -2
- package/templates/mini-game/package.json +2 -2
- package/templates/product-viewer/package.json +2 -2
- package/templates/production-asset-inspector/package.json +1 -1
- package/templates/production-material-studio/package.json +1 -1
- package/templates/production-product-configurator/package.json +1 -1
- package/templates/production-product-viewer/package.json +1 -1
|
@@ -11,6 +11,29 @@
|
|
|
11
11
|
*
|
|
12
12
|
* The half-res output is added into HDR by the S10 composite. On the v2 path
|
|
13
13
|
* this supersedes `VolumetricFog.ts:105-144` (lane 07, deletion = Q-07-1).
|
|
14
|
+
*
|
|
15
|
+
* GU47 E-C (EC-8): `u_density` is the shaft density (GPU Gems 3 §13): the
|
|
16
|
+
* march covers `density` of the way to the light, so lower values give
|
|
17
|
+
* shorter, tighter shafts. It comes from volumetricFog `godRayDensity`, never
|
|
18
|
+
* from the fog density; 1 (and an unset 0) is the full march used before.
|
|
19
|
+
*
|
|
20
|
+
* GU47 phase 2 (haze wash: drift-and-deliver-port, aura-hoops-3d, last-train,
|
|
21
|
+
* heatsink-port, ninja-runner): the march was an unnormalised sum,
|
|
22
|
+
* Σ weight·decay^i·src with weight = intensity, about 14·intensity² times the
|
|
23
|
+
* emitter radiance at 32 samples, and every sky pixel emitted at full
|
|
24
|
+
* radiance wherever it was. A sunset sky behind a street therefore added
|
|
25
|
+
* several HDR units to every pixel whose ray crossed it: a flat beige/white
|
|
26
|
+
* wash, not shafts. Now:
|
|
27
|
+
* - emitters are weighted by their distance to the light (aspect-corrected
|
|
28
|
+
* `1 - smoothstep(0, AURA_GODRAY_EMIT_RADIUS, r)`), so shafts radiate from
|
|
29
|
+
* the light's neighbourhood instead of from the whole sky;
|
|
30
|
+
* - the march is the decay-weighted MEAN of the emitters (normalised by
|
|
31
|
+
* Σ decay^i), so `intensity` is the shaft gain (at most the emitter
|
|
32
|
+
* radiance times intensity) and `u_weight` no longer multiplies it;
|
|
33
|
+
* - `u_medium` (the volumetricFog `density`, per metre) scales the shaft by
|
|
34
|
+
* the medium the view ray crosses, `1 - exp(-medium · depth)`: shafts
|
|
35
|
+
* thin out in front of near geometry and build with distance. <= 0 keeps
|
|
36
|
+
* the unscaled shaft.
|
|
14
37
|
*/
|
|
15
|
-
export declare const GODRAYS_GLSL = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_hdr; // half-res HDR input\nuniform highp sampler2D u_depthHalf; // half-res linear depth (.r)\nuniform float u_far;\nuniform vec2 u_lightUv; // projected light position, uv space\nuniform float u_lightClipW; // clip-space w of the projected light\nuniform vec3 u_color; // light shaft tint\nuniform float u_intensity;\nuniform float u_decay;\nuniform float u_weight;\nuniform float u_diskOuter; // r1: disk feather outer radius (uv)\nuniform float u_diskInner; // r0: disk core radius (uv)\nout vec4 o_color;\n\n#ifndef AURA_GODRAY_SAMPLES\n#define AURA_GODRAY_SAMPLES 32\n#endif\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / vec2(textureSize(u_hdr, 0));\n vec2 dir = u_lightUv - uv;\n float dist = length(dir);\n vec2 stepUv = dist > 0.0 ? dir / float(AURA_GODRAY_SAMPLES) : vec2(0.0);\n\n // Off-screen / behind-camera fade: step(0, w) zeroes lights behind the eye,\n // the linear ramp fades across 25% uv past the frame edge.\n float offScreen = clamp(1.0 - (max(abs(u_lightUv.x - 0.5), abs(u_lightUv.y - 0.5)) - 0.5) * 4.0, 0.0, 1.0)\n * step(0.0, u_lightClipW);\n\n float marchWeight =
|
|
38
|
+
export declare const GODRAYS_GLSL = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_hdr; // half-res HDR input\nuniform highp sampler2D u_depthHalf; // half-res linear depth (.r)\nuniform float u_far;\nuniform vec2 u_lightUv; // projected light position, uv space\nuniform float u_lightClipW; // clip-space w of the projected light\nuniform vec3 u_color; // light shaft tint\nuniform float u_intensity;\nuniform float u_decay;\nuniform float u_weight;\nuniform float u_diskOuter; // r1: disk feather outer radius (uv)\nuniform float u_diskInner; // r0: disk core radius (uv)\nuniform float u_density; // GU47: march fraction toward the light, (0, 1]; <= 0 reads as 1\nuniform float u_medium; // GU47 phase 2: shaft medium per metre (volumetricFog density); <= 0: no depth scaling\nout vec4 o_color;\n\n#ifndef AURA_GODRAY_SAMPLES\n#define AURA_GODRAY_SAMPLES 32\n#endif\n// GU47 phase 2: emitter falloff radius around the light, in frame heights.\n#ifndef AURA_GODRAY_EMIT_RADIUS\n#define AURA_GODRAY_EMIT_RADIUS 0.6\n#endif\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / vec2(textureSize(u_hdr, 0));\n vec2 dir = u_lightUv - uv;\n float dist = length(dir);\n float density = u_density > 0.0 ? u_density : 1.0;\n vec2 stepUv = dist > 0.0 ? dir * density / float(AURA_GODRAY_SAMPLES) : vec2(0.0);\n\n // Off-screen / behind-camera fade: step(0, w) zeroes lights behind the eye,\n // the linear ramp fades across 25% uv past the frame edge.\n float offScreen = clamp(1.0 - (max(abs(u_lightUv.x - 0.5), abs(u_lightUv.y - 0.5)) - 0.5) * 4.0, 0.0, 1.0)\n * step(0.0, u_lightClipW);\n\n vec2 aspect = vec2(float(textureSize(u_hdr, 0).x) / float(max(textureSize(u_hdr, 0).y, 1)), 1.0);\n float marchWeight = 1.0;\n float weightSum = 0.0;\n vec3 accum = vec3(0.0);\n vec2 sampleUv = uv;\n for (int i = 0; i < AURA_GODRAY_SAMPLES; ++i) {\n sampleUv += stepUv;\n vec4 hdr = textureLod(u_hdr, sampleUv, 0.0);\n float linZ = textureLod(u_depthHalf, sampleUv, 0.0).r;\n bool sky = linZ >= u_far * 0.999;\n float luma = dot(hdr.rgb, vec3(0.2126, 0.7152, 0.0722));\n // Emitters: sky pixels (the \"gap\" through occluders) or HDR highlights,\n // weighted by their closeness to the light (GU47 phase 2).\n float nearLight = 1.0 - smoothstep(0.0, float(AURA_GODRAY_EMIT_RADIUS), length((sampleUv - u_lightUv) * aspect));\n vec3 src = (sky || luma > 4.0) ? hdr.rgb * nearLight : vec3(0.0);\n // The sun disk emits only where the sky is unoccluded. #1185 multiplied\n // the whole source by the disk mask: with a dim sky that leaves nothing\n // to emit, and the S4-isolated A/B measured S4 on == S4 off (GPU run\n // 38163537496). The original additive disk emitted through occluders.\n if (sky) src += vec3(smoothstep(u_diskOuter, u_diskInner, length(sampleUv - u_lightUv)));\n accum += marchWeight * src;\n weightSum += marchWeight;\n marchWeight *= u_decay;\n }\n vec3 shaft = accum / max(weightSum, 1e-4);\n // Distance-scaled medium: the shaft is the light the view ray picks up on\n // its way through the volume, so near geometry gets little of it.\n float viewZ = min(textureLod(u_depthHalf, uv, 0.0).r, u_far);\n float medium = u_medium > 0.0 ? 1.0 - exp(-u_medium * viewZ) : 1.0;\n\n o_color = vec4(shaft * u_color * u_intensity * offScreen * medium, 1.0);\n}\n";
|
|
16
39
|
//# sourceMappingURL=godrays.glsl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"godrays.glsl.d.ts","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/godrays.glsl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"godrays.glsl.d.ts","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/godrays.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,eAAO,MAAM,YAAY,61GAoExB,CAAC"}
|
|
@@ -11,6 +11,29 @@
|
|
|
11
11
|
*
|
|
12
12
|
* The half-res output is added into HDR by the S10 composite. On the v2 path
|
|
13
13
|
* this supersedes `VolumetricFog.ts:105-144` (lane 07, deletion = Q-07-1).
|
|
14
|
+
*
|
|
15
|
+
* GU47 E-C (EC-8): `u_density` is the shaft density (GPU Gems 3 §13): the
|
|
16
|
+
* march covers `density` of the way to the light, so lower values give
|
|
17
|
+
* shorter, tighter shafts. It comes from volumetricFog `godRayDensity`, never
|
|
18
|
+
* from the fog density; 1 (and an unset 0) is the full march used before.
|
|
19
|
+
*
|
|
20
|
+
* GU47 phase 2 (haze wash: drift-and-deliver-port, aura-hoops-3d, last-train,
|
|
21
|
+
* heatsink-port, ninja-runner): the march was an unnormalised sum,
|
|
22
|
+
* Σ weight·decay^i·src with weight = intensity, about 14·intensity² times the
|
|
23
|
+
* emitter radiance at 32 samples, and every sky pixel emitted at full
|
|
24
|
+
* radiance wherever it was. A sunset sky behind a street therefore added
|
|
25
|
+
* several HDR units to every pixel whose ray crossed it: a flat beige/white
|
|
26
|
+
* wash, not shafts. Now:
|
|
27
|
+
* - emitters are weighted by their distance to the light (aspect-corrected
|
|
28
|
+
* `1 - smoothstep(0, AURA_GODRAY_EMIT_RADIUS, r)`), so shafts radiate from
|
|
29
|
+
* the light's neighbourhood instead of from the whole sky;
|
|
30
|
+
* - the march is the decay-weighted MEAN of the emitters (normalised by
|
|
31
|
+
* Σ decay^i), so `intensity` is the shaft gain (at most the emitter
|
|
32
|
+
* radiance times intensity) and `u_weight` no longer multiplies it;
|
|
33
|
+
* - `u_medium` (the volumetricFog `density`, per metre) scales the shaft by
|
|
34
|
+
* the medium the view ray crosses, `1 - exp(-medium · depth)`: shafts
|
|
35
|
+
* thin out in front of near geometry and build with distance. <= 0 keeps
|
|
36
|
+
* the unscaled shaft.
|
|
14
37
|
*/
|
|
15
38
|
const HEADER = `#version 300 es
|
|
16
39
|
precision highp float;
|
|
@@ -27,24 +50,33 @@ uniform float u_decay;
|
|
|
27
50
|
uniform float u_weight;
|
|
28
51
|
uniform float u_diskOuter; // r1: disk feather outer radius (uv)
|
|
29
52
|
uniform float u_diskInner; // r0: disk core radius (uv)
|
|
53
|
+
uniform float u_density; // GU47: march fraction toward the light, (0, 1]; <= 0 reads as 1
|
|
54
|
+
uniform float u_medium; // GU47 phase 2: shaft medium per metre (volumetricFog density); <= 0: no depth scaling
|
|
30
55
|
out vec4 o_color;
|
|
31
56
|
|
|
32
57
|
#ifndef AURA_GODRAY_SAMPLES
|
|
33
58
|
#define AURA_GODRAY_SAMPLES 32
|
|
34
59
|
#endif
|
|
60
|
+
// GU47 phase 2: emitter falloff radius around the light, in frame heights.
|
|
61
|
+
#ifndef AURA_GODRAY_EMIT_RADIUS
|
|
62
|
+
#define AURA_GODRAY_EMIT_RADIUS 0.6
|
|
63
|
+
#endif
|
|
35
64
|
|
|
36
65
|
void main() {
|
|
37
66
|
vec2 uv = gl_FragCoord.xy / vec2(textureSize(u_hdr, 0));
|
|
38
67
|
vec2 dir = u_lightUv - uv;
|
|
39
68
|
float dist = length(dir);
|
|
40
|
-
|
|
69
|
+
float density = u_density > 0.0 ? u_density : 1.0;
|
|
70
|
+
vec2 stepUv = dist > 0.0 ? dir * density / float(AURA_GODRAY_SAMPLES) : vec2(0.0);
|
|
41
71
|
|
|
42
72
|
// Off-screen / behind-camera fade: step(0, w) zeroes lights behind the eye,
|
|
43
73
|
// the linear ramp fades across 25% uv past the frame edge.
|
|
44
74
|
float offScreen = clamp(1.0 - (max(abs(u_lightUv.x - 0.5), abs(u_lightUv.y - 0.5)) - 0.5) * 4.0, 0.0, 1.0)
|
|
45
75
|
* step(0.0, u_lightClipW);
|
|
46
76
|
|
|
47
|
-
|
|
77
|
+
vec2 aspect = vec2(float(textureSize(u_hdr, 0).x) / float(max(textureSize(u_hdr, 0).y, 1)), 1.0);
|
|
78
|
+
float marchWeight = 1.0;
|
|
79
|
+
float weightSum = 0.0;
|
|
48
80
|
vec3 accum = vec3(0.0);
|
|
49
81
|
vec2 sampleUv = uv;
|
|
50
82
|
for (int i = 0; i < AURA_GODRAY_SAMPLES; ++i) {
|
|
@@ -53,18 +85,26 @@ void main() {
|
|
|
53
85
|
float linZ = textureLod(u_depthHalf, sampleUv, 0.0).r;
|
|
54
86
|
bool sky = linZ >= u_far * 0.999;
|
|
55
87
|
float luma = dot(hdr.rgb, vec3(0.2126, 0.7152, 0.0722));
|
|
56
|
-
// Emitters: sky pixels (the "gap" through occluders) or HDR highlights
|
|
57
|
-
|
|
88
|
+
// Emitters: sky pixels (the "gap" through occluders) or HDR highlights,
|
|
89
|
+
// weighted by their closeness to the light (GU47 phase 2).
|
|
90
|
+
float nearLight = 1.0 - smoothstep(0.0, float(AURA_GODRAY_EMIT_RADIUS), length((sampleUv - u_lightUv) * aspect));
|
|
91
|
+
vec3 src = (sky || luma > 4.0) ? hdr.rgb * nearLight : vec3(0.0);
|
|
58
92
|
// The sun disk emits only where the sky is unoccluded. #1185 multiplied
|
|
59
93
|
// the whole source by the disk mask: with a dim sky that leaves nothing
|
|
60
94
|
// to emit, and the S4-isolated A/B measured S4 on == S4 off (GPU run
|
|
61
95
|
// 38163537496). The original additive disk emitted through occluders.
|
|
62
96
|
if (sky) src += vec3(smoothstep(u_diskOuter, u_diskInner, length(sampleUv - u_lightUv)));
|
|
63
97
|
accum += marchWeight * src;
|
|
98
|
+
weightSum += marchWeight;
|
|
64
99
|
marchWeight *= u_decay;
|
|
65
100
|
}
|
|
101
|
+
vec3 shaft = accum / max(weightSum, 1e-4);
|
|
102
|
+
// Distance-scaled medium: the shaft is the light the view ray picks up on
|
|
103
|
+
// its way through the volume, so near geometry gets little of it.
|
|
104
|
+
float viewZ = min(textureLod(u_depthHalf, uv, 0.0).r, u_far);
|
|
105
|
+
float medium = u_medium > 0.0 ? 1.0 - exp(-u_medium * viewZ) : 1.0;
|
|
66
106
|
|
|
67
|
-
o_color = vec4(
|
|
107
|
+
o_color = vec4(shaft * u_color * u_intensity * offScreen * medium, 1.0);
|
|
68
108
|
}
|
|
69
109
|
`;
|
|
70
110
|
//# sourceMappingURL=godrays.glsl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"godrays.glsl.js","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/godrays.glsl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"godrays.glsl.js","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/godrays.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,MAAM,GAAG;;CAEd,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE/C,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GU47 E-C (WP-3) — the linear-HDR grade writer (PRD-03 §6.7 S10 linear grade).
|
|
3
|
+
*
|
|
4
|
+
* `composite.glsl.ts` declared `u_whiteBalance`, `u_lift`, `u_gamma`, `u_gain`,
|
|
5
|
+
* `u_shadows`, `u_midtones` and `u_highlights`, but no program ran it and no
|
|
6
|
+
* code set the uniforms, so `effects.colorGrade({ temperature, tint, lift,
|
|
7
|
+
* gamma, gain, shadows, midtones, highlights })` never reached a pixel. This
|
|
8
|
+
* module is the one fullscreen draw that applies them on the v2 chain:
|
|
9
|
+
*
|
|
10
|
+
* c = texture(u_hdr) [· exp2(ev) when S8 auto-exposure is active — the grade
|
|
11
|
+
* folds into the S8 multiply draw, so AE + grade is still one draw]
|
|
12
|
+
* c *= u_whiteBalance (CAT02/LMS balance folded to RGB on CPU)
|
|
13
|
+
* c = pow(max(c · gain + lift, 0), 1 / gamma) (ASC-CDL style)
|
|
14
|
+
* c *= shadows·(1−s)² + midtones·2s(1−s) + highlights·s²,
|
|
15
|
+
* s = saturate(log2(luma / 0.18) / 8 + 0.5)
|
|
16
|
+
*
|
|
17
|
+
* The same math as `COMPOSITE_GLSL`'s grade block. Alpha passes through (the
|
|
18
|
+
* §6.3 indirect-fraction / post material tag lives there). An identity grade
|
|
19
|
+
* resolves to `null` so the stage driver skips the draw and scenes that do not
|
|
20
|
+
* author a grade stay byte-identical.
|
|
21
|
+
*/
|
|
22
|
+
export declare const HDR_GRADE_GLSL = "#version 300 es\nprecision highp float;\nuniform sampler2D u_hdr;\nuniform sampler2D u_ev; // 1\u00D71 EV target (S8); bound to a blank texel when u_hasEv == 0\nuniform int u_hasEv;\nuniform int u_hasGrade;\nuniform vec3 u_whiteBalance; // CAT02-cone LMS balance, resolved per temperature/tint on CPU\nuniform vec3 u_lift;\nuniform vec3 u_gamma;\nuniform vec3 u_gain;\nuniform vec3 u_shadows;\nuniform vec3 u_midtones;\nuniform vec3 u_highlights;\nin vec2 v_uv;\nout vec4 outColor;\n\nfloat gradeLuma(vec3 c) { return dot(c, vec3(0.2126, 0.7152, 0.0722)); }\n\nvoid main() {\n vec4 src = texture(u_hdr, v_uv);\n vec3 c = src.rgb;\n if (u_hasEv != 0) {\n c *= exp2(texelFetch(u_ev, ivec2(0), 0).r);\n }\n if (u_hasGrade != 0) {\n c *= u_whiteBalance;\n vec3 safeGamma = max(u_gamma, vec3(1e-3));\n c = pow(max(c * u_gain + u_lift, vec3(0.0)), vec3(1.0) / safeGamma);\n float s = clamp(log2(max(gradeLuma(c), 1e-6) / 0.18) / 8.0 + 0.5, 0.0, 1.0);\n c *= u_shadows * (1.0 - s) * (1.0 - s)\n + u_midtones * 2.0 * s * (1.0 - s)\n + u_highlights * s * s;\n }\n outColor = vec4(c, src.a);\n}\n";
|
|
23
|
+
export type Rgb3 = readonly [number, number, number];
|
|
24
|
+
/** Uniform values for `HDR_GRADE_GLSL` (all linear, per channel). */
|
|
25
|
+
export interface HdrGradeUniforms {
|
|
26
|
+
readonly whiteBalance: Rgb3;
|
|
27
|
+
readonly lift: Rgb3;
|
|
28
|
+
readonly gamma: Rgb3;
|
|
29
|
+
readonly gain: Rgb3;
|
|
30
|
+
readonly shadows: Rgb3;
|
|
31
|
+
readonly midtones: Rgb3;
|
|
32
|
+
readonly highlights: Rgb3;
|
|
33
|
+
}
|
|
34
|
+
/** The grade fields the v2 bridge emits (`ColorGradeOptionsV2`, `postBridge.ts`). */
|
|
35
|
+
export interface HdrGradeInput {
|
|
36
|
+
readonly temperature?: number;
|
|
37
|
+
readonly tint?: number;
|
|
38
|
+
readonly lift?: unknown;
|
|
39
|
+
readonly gamma?: unknown;
|
|
40
|
+
readonly gain?: unknown;
|
|
41
|
+
readonly shadows?: unknown;
|
|
42
|
+
readonly midtones?: unknown;
|
|
43
|
+
readonly highlights?: unknown;
|
|
44
|
+
/** GU47 E-C runtime control: `app.post.setEffectEnabled("colorGrade", false)` keeps the bag with `enabled: false`. */
|
|
45
|
+
readonly enabled?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* White-balance gain for `temperature`/`tint` in [-1, 1] (0 = neutral;
|
|
49
|
+
* +temperature warms, +tint pushes magenta). The reference white moves along
|
|
50
|
+
* the CIE daylight locus (x shift, y = standard illuminant curve + tint), the
|
|
51
|
+
* von Kries balance is taken in CAT02 LMS, and the result is folded into one
|
|
52
|
+
* RGB multiplier (exact for greys) normalised to unit Rec.709 luminance so a
|
|
53
|
+
* temperature change shifts hue, not exposure. The scale matches the common
|
|
54
|
+
* ±100 UI convention divided by 100 (temperature 0.2 ≈ "+20").
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveWhiteBalance(temperature: number, tint: number): Rgb3;
|
|
57
|
+
/** `{r,g,b}`, `[r,g,b]` or a scalar (applied to all channels); anything else → fallback. */
|
|
58
|
+
export declare function gradeRgb(value: unknown, fallback: Rgb3): Rgb3;
|
|
59
|
+
/**
|
|
60
|
+
* Uniforms for a grade bag, or `null` when the grade is the identity (or
|
|
61
|
+
* disabled) — the stage driver then skips the draw entirely.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveHdrGradeUniforms(grade: HdrGradeInput | null | undefined): HdrGradeUniforms | null;
|
|
64
|
+
/** CPU mirror of the `u_hasGrade` block (unit tests and receipts' expected values). */
|
|
65
|
+
export declare function applyHdrGrade(rgb: Rgb3, u: HdrGradeUniforms): Rgb3;
|
|
66
|
+
//# sourceMappingURL=hdrGrade.glsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hdrGrade.glsl.d.ts","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/hdrGrade.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,cAAc,unCAmC1B,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3B;AAED,qFAAqF;AACrF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,sHAAsH;IACtH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAqCD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAe3E;AAED,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,IAAI,CAS7D;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAcxG;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAMlE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GU47 E-C (WP-3) — the linear-HDR grade writer (PRD-03 §6.7 S10 linear grade).
|
|
3
|
+
*
|
|
4
|
+
* `composite.glsl.ts` declared `u_whiteBalance`, `u_lift`, `u_gamma`, `u_gain`,
|
|
5
|
+
* `u_shadows`, `u_midtones` and `u_highlights`, but no program ran it and no
|
|
6
|
+
* code set the uniforms, so `effects.colorGrade({ temperature, tint, lift,
|
|
7
|
+
* gamma, gain, shadows, midtones, highlights })` never reached a pixel. This
|
|
8
|
+
* module is the one fullscreen draw that applies them on the v2 chain:
|
|
9
|
+
*
|
|
10
|
+
* c = texture(u_hdr) [· exp2(ev) when S8 auto-exposure is active — the grade
|
|
11
|
+
* folds into the S8 multiply draw, so AE + grade is still one draw]
|
|
12
|
+
* c *= u_whiteBalance (CAT02/LMS balance folded to RGB on CPU)
|
|
13
|
+
* c = pow(max(c · gain + lift, 0), 1 / gamma) (ASC-CDL style)
|
|
14
|
+
* c *= shadows·(1−s)² + midtones·2s(1−s) + highlights·s²,
|
|
15
|
+
* s = saturate(log2(luma / 0.18) / 8 + 0.5)
|
|
16
|
+
*
|
|
17
|
+
* The same math as `COMPOSITE_GLSL`'s grade block. Alpha passes through (the
|
|
18
|
+
* §6.3 indirect-fraction / post material tag lives there). An identity grade
|
|
19
|
+
* resolves to `null` so the stage driver skips the draw and scenes that do not
|
|
20
|
+
* author a grade stay byte-identical.
|
|
21
|
+
*/
|
|
22
|
+
export const HDR_GRADE_GLSL = /* glsl */ `#version 300 es
|
|
23
|
+
precision highp float;
|
|
24
|
+
uniform sampler2D u_hdr;
|
|
25
|
+
uniform sampler2D u_ev; // 1×1 EV target (S8); bound to a blank texel when u_hasEv == 0
|
|
26
|
+
uniform int u_hasEv;
|
|
27
|
+
uniform int u_hasGrade;
|
|
28
|
+
uniform vec3 u_whiteBalance; // CAT02-cone LMS balance, resolved per temperature/tint on CPU
|
|
29
|
+
uniform vec3 u_lift;
|
|
30
|
+
uniform vec3 u_gamma;
|
|
31
|
+
uniform vec3 u_gain;
|
|
32
|
+
uniform vec3 u_shadows;
|
|
33
|
+
uniform vec3 u_midtones;
|
|
34
|
+
uniform vec3 u_highlights;
|
|
35
|
+
in vec2 v_uv;
|
|
36
|
+
out vec4 outColor;
|
|
37
|
+
|
|
38
|
+
float gradeLuma(vec3 c) { return dot(c, vec3(0.2126, 0.7152, 0.0722)); }
|
|
39
|
+
|
|
40
|
+
void main() {
|
|
41
|
+
vec4 src = texture(u_hdr, v_uv);
|
|
42
|
+
vec3 c = src.rgb;
|
|
43
|
+
if (u_hasEv != 0) {
|
|
44
|
+
c *= exp2(texelFetch(u_ev, ivec2(0), 0).r);
|
|
45
|
+
}
|
|
46
|
+
if (u_hasGrade != 0) {
|
|
47
|
+
c *= u_whiteBalance;
|
|
48
|
+
vec3 safeGamma = max(u_gamma, vec3(1e-3));
|
|
49
|
+
c = pow(max(c * u_gain + u_lift, vec3(0.0)), vec3(1.0) / safeGamma);
|
|
50
|
+
float s = clamp(log2(max(gradeLuma(c), 1e-6) / 0.18) / 8.0 + 0.5, 0.0, 1.0);
|
|
51
|
+
c *= u_shadows * (1.0 - s) * (1.0 - s)
|
|
52
|
+
+ u_midtones * 2.0 * s * (1.0 - s)
|
|
53
|
+
+ u_highlights * s * s;
|
|
54
|
+
}
|
|
55
|
+
outColor = vec4(c, src.a);
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
// Linear sRGB (Rec.709 primaries) <-> CAT02 LMS, row-major (lms = M · rgb).
|
|
59
|
+
const LINEAR_TO_LMS = [
|
|
60
|
+
3.90405e-1, 5.49941e-1, 8.92632e-3,
|
|
61
|
+
7.08416e-2, 9.63172e-1, 1.35775e-3,
|
|
62
|
+
2.31082e-2, 1.28021e-1, 9.36245e-1
|
|
63
|
+
];
|
|
64
|
+
const LMS_TO_LINEAR = [
|
|
65
|
+
2.85847, -1.62879, -2.4891e-2,
|
|
66
|
+
-2.10182e-1, 1.1582, 3.24281e-4,
|
|
67
|
+
-4.1812e-2, -1.18169e-1, 1.06867
|
|
68
|
+
];
|
|
69
|
+
/** D65 white in LMS. */
|
|
70
|
+
const D65_LMS = [0.949237, 1.03542, 1.08728];
|
|
71
|
+
function mul3(m, v) {
|
|
72
|
+
return [
|
|
73
|
+
m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
|
|
74
|
+
m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
|
|
75
|
+
m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
function cieXyToLms(x, y) {
|
|
79
|
+
const Y = 1;
|
|
80
|
+
const X = (Y * x) / y;
|
|
81
|
+
const Z = (Y * (1 - x - y)) / y;
|
|
82
|
+
return [
|
|
83
|
+
0.7328 * X + 0.4296 * Y - 0.1624 * Z,
|
|
84
|
+
-0.7036 * X + 1.6975 * Y + 0.0061 * Z,
|
|
85
|
+
0.003 * X + 0.0136 * Y + 0.9834 * Z
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
89
|
+
/**
|
|
90
|
+
* White-balance gain for `temperature`/`tint` in [-1, 1] (0 = neutral;
|
|
91
|
+
* +temperature warms, +tint pushes magenta). The reference white moves along
|
|
92
|
+
* the CIE daylight locus (x shift, y = standard illuminant curve + tint), the
|
|
93
|
+
* von Kries balance is taken in CAT02 LMS, and the result is folded into one
|
|
94
|
+
* RGB multiplier (exact for greys) normalised to unit Rec.709 luminance so a
|
|
95
|
+
* temperature change shifts hue, not exposure. The scale matches the common
|
|
96
|
+
* ±100 UI convention divided by 100 (temperature 0.2 ≈ "+20").
|
|
97
|
+
*/
|
|
98
|
+
export function resolveWhiteBalance(temperature, tint) {
|
|
99
|
+
const t = clamp(Number.isFinite(temperature) ? temperature : 0, -1, 1);
|
|
100
|
+
const g = clamp(Number.isFinite(tint) ? tint : 0, -1, 1);
|
|
101
|
+
if (t === 0 && g === 0)
|
|
102
|
+
return [1, 1, 1];
|
|
103
|
+
const t1 = (t * 100) / 65;
|
|
104
|
+
const t2 = (g * 100) / 65;
|
|
105
|
+
const x = 0.31271 - t1 * (t1 < 0 ? 0.1 : 0.05);
|
|
106
|
+
const y = 2.87 * x - 3 * x * x - 0.27509507 + t2 * 0.05;
|
|
107
|
+
const w2 = cieXyToLms(x, y);
|
|
108
|
+
const balance = [D65_LMS[0] / w2[0], D65_LMS[1] / w2[1], D65_LMS[2] / w2[2]];
|
|
109
|
+
const whiteLms = mul3(LINEAR_TO_LMS, [1, 1, 1]);
|
|
110
|
+
const rgb = mul3(LMS_TO_LINEAR, [whiteLms[0] * balance[0], whiteLms[1] * balance[1], whiteLms[2] * balance[2]]);
|
|
111
|
+
const luma = 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2];
|
|
112
|
+
const norm = luma > 1e-6 ? 1 / luma : 1;
|
|
113
|
+
return [Math.max(0, rgb[0] * norm), Math.max(0, rgb[1] * norm), Math.max(0, rgb[2] * norm)];
|
|
114
|
+
}
|
|
115
|
+
/** `{r,g,b}`, `[r,g,b]` or a scalar (applied to all channels); anything else → fallback. */
|
|
116
|
+
export function gradeRgb(value, fallback) {
|
|
117
|
+
const finite = (v, f) => (typeof v === "number" && Number.isFinite(v) ? v : f);
|
|
118
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
119
|
+
return [value, value, value];
|
|
120
|
+
if (Array.isArray(value) && value.length >= 3)
|
|
121
|
+
return [finite(value[0], fallback[0]), finite(value[1], fallback[1]), finite(value[2], fallback[2])];
|
|
122
|
+
if (value && typeof value === "object" && "r" in value) {
|
|
123
|
+
const c = value;
|
|
124
|
+
return [finite(c.r, fallback[0]), finite(c.g, fallback[1]), finite(c.b, fallback[2])];
|
|
125
|
+
}
|
|
126
|
+
return fallback;
|
|
127
|
+
}
|
|
128
|
+
const ONE = [1, 1, 1];
|
|
129
|
+
const ZERO = [0, 0, 0];
|
|
130
|
+
const same = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
131
|
+
/**
|
|
132
|
+
* Uniforms for a grade bag, or `null` when the grade is the identity (or
|
|
133
|
+
* disabled) — the stage driver then skips the draw entirely.
|
|
134
|
+
*/
|
|
135
|
+
export function resolveHdrGradeUniforms(grade) {
|
|
136
|
+
if (!grade || typeof grade !== "object" || grade.enabled === false)
|
|
137
|
+
return null;
|
|
138
|
+
const uniforms = {
|
|
139
|
+
whiteBalance: resolveWhiteBalance(grade.temperature ?? 0, grade.tint ?? 0),
|
|
140
|
+
lift: gradeRgb(grade.lift, ZERO),
|
|
141
|
+
gamma: gradeRgb(grade.gamma, ONE).map((v) => Math.max(1e-3, v)),
|
|
142
|
+
gain: gradeRgb(grade.gain, ONE).map((v) => Math.max(0, v)),
|
|
143
|
+
shadows: gradeRgb(grade.shadows, ONE).map((v) => Math.max(0, v)),
|
|
144
|
+
midtones: gradeRgb(grade.midtones, ONE).map((v) => Math.max(0, v)),
|
|
145
|
+
highlights: gradeRgb(grade.highlights, ONE).map((v) => Math.max(0, v))
|
|
146
|
+
};
|
|
147
|
+
const identity = same(uniforms.whiteBalance, ONE) && same(uniforms.lift, ZERO) && same(uniforms.gamma, ONE)
|
|
148
|
+
&& same(uniforms.gain, ONE) && same(uniforms.shadows, ONE) && same(uniforms.midtones, ONE) && same(uniforms.highlights, ONE);
|
|
149
|
+
return identity ? null : uniforms;
|
|
150
|
+
}
|
|
151
|
+
/** CPU mirror of the `u_hasGrade` block (unit tests and receipts' expected values). */
|
|
152
|
+
export function applyHdrGrade(rgb, u) {
|
|
153
|
+
let c = [rgb[0] * u.whiteBalance[0], rgb[1] * u.whiteBalance[1], rgb[2] * u.whiteBalance[2]];
|
|
154
|
+
c = c.map((v, i) => Math.pow(Math.max(v * u.gain[i] + u.lift[i], 0), 1 / Math.max(u.gamma[i], 1e-3)));
|
|
155
|
+
const luma = 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2];
|
|
156
|
+
const s = clamp(Math.log2(Math.max(luma, 1e-6) / 0.18) / 8 + 0.5, 0, 1);
|
|
157
|
+
return c.map((v, i) => v * (u.shadows[i] * (1 - s) * (1 - s) + u.midtones[i] * 2 * s * (1 - s) + u.highlights[i] * s * s));
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=hdrGrade.glsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hdrGrade.glsl.js","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/hdrGrade.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CA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|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GU47 E-C (EC-6) — S3 screen-space reflections for the v2 post chain
|
|
3
|
+
* (WebGL2, GLSL ES 3.00). Off unless the scene authors
|
|
4
|
+
* `effects.screenSpaceReflections()` (and the tier allows S3: High+).
|
|
5
|
+
*
|
|
6
|
+
* SSR_TRACE_GLSL (half-res RGBA16F, rgb = reflected radiance, a = confidence):
|
|
7
|
+
* - view position from the S1 linear depth (`.r` = positive view distance)
|
|
8
|
+
* and the projection's focal terms; the normal from the cross product of
|
|
9
|
+
* the neighbouring view positions (the forward pass has no G-buffer);
|
|
10
|
+
* - a linear view-space march along reflect(V, N) of `AURA_SSR_STEPS`
|
|
11
|
+
* steps over `u_maxDistance` metres; where the ray crosses behind the
|
|
12
|
+
* depth buffer, 4 binary refinement steps, and a hit is a refined point
|
|
13
|
+
* behind it by less than `u_thickness` (GU47 phase 2: the unrefined test
|
|
14
|
+
* missed surfaces thinner than one 0.75 m step);
|
|
15
|
+
* - the hit colour comes from the previous frame (TAA history, reprojected
|
|
16
|
+
* through `u_viewToPrevClip` = prevViewProj · inv(view)) when
|
|
17
|
+
* `u_reproject = 1`, else from this frame's HDR colour;
|
|
18
|
+
* - confidence = hit · Schlick fresnel (F0 0.04) · screen-edge fade ·
|
|
19
|
+
* march-distance fade (refined hit distance) · camera-facing fade · roughness gate
|
|
20
|
+
* (`1 − smoothstep(0.35, 0.5, roughness)`, i.e. nothing above the 0.5
|
|
21
|
+
* cutoff). Where confidence falls to 0 the composite leaves the forward
|
|
22
|
+
* result, which already carries the nearest reflection probe's IBL — the
|
|
23
|
+
* reflection fades to the probe instead of to black.
|
|
24
|
+
*
|
|
25
|
+
* SSR_COMPOSITE_GLSL (full-res): `hdr + reflection · confidence · intensity`.
|
|
26
|
+
*
|
|
27
|
+
* Limit (GU47 phase 2, receipt effects-ssr): the forward pass writes no
|
|
28
|
+
* metalness, F0 or roughness, so the fresnel uses dielectric F0 0.04 and the
|
|
29
|
+
* node's `roughness` frame-wide. A metallic floor (real F0 ~0.3+) reflects
|
|
30
|
+
* several times weaker than its material; the bridge reports
|
|
31
|
+
* `POST_SSR_MATERIAL_INPUTS_UNAVAILABLE` whenever S3 is authored.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SSR_TRACE_GLSL = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_color; // reflection source: history (u_reproject = 1) or this frame's HDR\nuniform highp sampler2D u_linearDepth; // full-res S1 linear depth (.r, metres)\nuniform mat4 u_projection; // this frame's projection\nuniform mat4 u_viewToPrevClip; // prevViewProj \u00B7 inv(view); used when u_reproject = 1\nuniform int u_reproject;\nuniform int u_ortho;\nuniform float u_far;\nuniform float u_maxDistance; // metres along the reflected ray\nuniform float u_thickness; // metres behind the depth buffer that still count as a hit\nuniform float u_roughness; // surface roughness hint; cutoff 0.5\nout vec4 o_color;\n\n#ifndef AURA_SSR_STEPS\n#define AURA_SSR_STEPS 24\n#endif\n\nfloat linearDepthAt(vec2 uv) {\n ivec2 size = textureSize(u_linearDepth, 0);\n ivec2 p = clamp(ivec2(uv * vec2(size)), ivec2(0), size - 1);\n return texelFetch(u_linearDepth, p, 0).r;\n}\n\nvec3 viewPosition(vec2 uv, float z) {\n vec2 ndc = uv * 2.0 - 1.0;\n if (u_ortho == 1) {\n return vec3((ndc.x - u_projection[3][0]) / u_projection[0][0], (ndc.y - u_projection[3][1]) / u_projection[1][1], -z);\n }\n return vec3(ndc.x * z / u_projection[0][0], ndc.y * z / u_projection[1][1], -z);\n}\n\nvec2 projectToUv(vec3 viewPos) {\n vec4 clip = u_projection * vec4(viewPos, 1.0);\n return clip.w != 0.0 ? clip.xy / clip.w * 0.5 + 0.5 : vec2(-1.0);\n}\n\nvoid main() {\n vec2 halfSize = vec2(textureSize(u_linearDepth, 0)) * 0.5;\n vec2 uv = gl_FragCoord.xy / halfSize;\n float z = linearDepthAt(uv);\n if (z <= 0.0 || z >= u_far * 0.999) { o_color = vec4(0.0); return; }\n vec2 texel = 1.0 / vec2(textureSize(u_linearDepth, 0));\n vec3 p = viewPosition(uv, z);\n vec3 px = viewPosition(uv + vec2(texel.x, 0.0), linearDepthAt(uv + vec2(texel.x, 0.0)));\n vec3 py = viewPosition(uv + vec2(0.0, texel.y), linearDepthAt(uv + vec2(0.0, texel.y)));\n vec3 n = normalize(cross(px - p, py - p));\n vec3 v = u_ortho == 1 ? vec3(0.0, 0.0, -1.0) : normalize(p);\n if (dot(n, v) > 0.0) n = -n;\n vec3 r = normalize(reflect(v, n));\n\n float roughnessGate = 1.0 - smoothstep(0.35, 0.5, u_roughness);\n // Rays heading back toward the camera leave the screen or hit back faces.\n float facing = 1.0 - smoothstep(0.0, 0.6, r.z);\n if (roughnessGate <= 0.0 || facing <= 0.0) { o_color = vec4(0.0); return; }\n\n float stepLength = u_maxDistance / float(AURA_SSR_STEPS);\n vec3 prev = p;\n vec3 hitPos = p;\n vec2 hitUv = vec2(-1.0);\n float travelled = 0.0;\n bool prevBehind = false;\n for (int i = 1; i <= AURA_SSR_STEPS; ++i) {\n vec3 q = p + r * (stepLength * float(i));\n vec2 quv = projectToUv(q);\n if (quv.x < 0.0 || quv.x > 1.0 || quv.y < 0.0 || quv.y > 1.0) break;\n float sceneZ = linearDepthAt(quv);\n float rayZ = -q.z;\n bool behind = rayZ > sceneZ;\n // A crossing (in front at the last sample, behind now) is refined first and\n // the thickness test applies to the refined point: a step longer than\n // u_thickness (24 steps over 18 m = 0.75 m) otherwise lands inside or past\n // anything thinner than the step and the hit is lost.\n if (behind && !prevBehind) {\n vec3 a = prev;\n vec3 b = q;\n for (int j = 0; j < 4; ++j) {\n vec3 m = 0.5 * (a + b);\n vec2 muv = projectToUv(m);\n if (-m.z > linearDepthAt(muv)) b = m; else a = m;\n }\n vec2 buv = projectToUv(b);\n if (-b.z - linearDepthAt(buv) < u_thickness) {\n hitPos = b;\n hitUv = buv;\n // Refined distance, not the step index: the index quantised the fade into one band per step\n // (drift-and-deliver-port's 60 m / 24-step wet road showed regular stripes; GU47 phase 2).\n travelled = clamp(length(b - p) / u_maxDistance, 0.0, 1.0);\n break;\n }\n }\n prevBehind = behind;\n prev = q;\n }\n if (hitUv.x < 0.0) { o_color = vec4(0.0); return; }\n\n vec2 sourceUv = hitUv;\n if (u_reproject == 1) {\n vec4 prevClip = u_viewToPrevClip * vec4(hitPos, 1.0);\n sourceUv = prevClip.w > 0.0 ? prevClip.xy / prevClip.w * 0.5 + 0.5 : hitUv;\n }\n vec2 edge = abs(sourceUv * 2.0 - 1.0);\n float edgeFade = 1.0 - smoothstep(0.85, 1.0, max(edge.x, edge.y));\n float distanceFade = 1.0 - travelled * travelled;\n float cosTheta = clamp(dot(-v, n), 0.0, 1.0);\n float fresnel = 0.04 + 0.96 * pow(1.0 - cosTheta, 5.0);\n float confidence = clamp(edgeFade * distanceFade * facing * roughnessGate * fresnel, 0.0, 1.0);\n vec3 radiance = textureLod(u_color, clamp(sourceUv, vec2(0.0), vec2(1.0)), 0.0).rgb;\n o_color = vec4(radiance, confidence);\n}\n";
|
|
34
|
+
export declare const SSR_COMPOSITE_GLSL = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_color; // full-res HDR\nuniform sampler2D u_reflection; // half-res trace (.a = confidence)\nuniform float u_intensity;\nout vec4 o_color;\n\nvoid main() {\n ivec2 pixel = ivec2(gl_FragCoord.xy);\n vec4 src = texelFetch(u_color, pixel, 0);\n vec4 refl = texture(u_reflection, (vec2(pixel) + 0.5) / vec2(textureSize(u_color, 0)));\n o_color = vec4(src.rgb + refl.rgb * refl.a * u_intensity, src.a);\n}\n";
|
|
35
|
+
/** S3 defaults: roughness cutoff 0.5 (gate fades from 0.35), 24 march steps, 0.25 m thickness. */
|
|
36
|
+
export declare const SSR_ROUGHNESS_CUTOFF = 0.5;
|
|
37
|
+
export declare const SSR_DEFAULT_STEPS = 24;
|
|
38
|
+
export declare const SSR_DEFAULT_THICKNESS = 0.25;
|
|
39
|
+
//# sourceMappingURL=ssr.glsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr.glsl.d.ts","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/ssr.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAMH,eAAO,MAAM,cAAc,ykJA6G1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,+dAY9B,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,qBAAqB,OAAO,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GU47 E-C (EC-6) — S3 screen-space reflections for the v2 post chain
|
|
3
|
+
* (WebGL2, GLSL ES 3.00). Off unless the scene authors
|
|
4
|
+
* `effects.screenSpaceReflections()` (and the tier allows S3: High+).
|
|
5
|
+
*
|
|
6
|
+
* SSR_TRACE_GLSL (half-res RGBA16F, rgb = reflected radiance, a = confidence):
|
|
7
|
+
* - view position from the S1 linear depth (`.r` = positive view distance)
|
|
8
|
+
* and the projection's focal terms; the normal from the cross product of
|
|
9
|
+
* the neighbouring view positions (the forward pass has no G-buffer);
|
|
10
|
+
* - a linear view-space march along reflect(V, N) of `AURA_SSR_STEPS`
|
|
11
|
+
* steps over `u_maxDistance` metres; where the ray crosses behind the
|
|
12
|
+
* depth buffer, 4 binary refinement steps, and a hit is a refined point
|
|
13
|
+
* behind it by less than `u_thickness` (GU47 phase 2: the unrefined test
|
|
14
|
+
* missed surfaces thinner than one 0.75 m step);
|
|
15
|
+
* - the hit colour comes from the previous frame (TAA history, reprojected
|
|
16
|
+
* through `u_viewToPrevClip` = prevViewProj · inv(view)) when
|
|
17
|
+
* `u_reproject = 1`, else from this frame's HDR colour;
|
|
18
|
+
* - confidence = hit · Schlick fresnel (F0 0.04) · screen-edge fade ·
|
|
19
|
+
* march-distance fade (refined hit distance) · camera-facing fade · roughness gate
|
|
20
|
+
* (`1 − smoothstep(0.35, 0.5, roughness)`, i.e. nothing above the 0.5
|
|
21
|
+
* cutoff). Where confidence falls to 0 the composite leaves the forward
|
|
22
|
+
* result, which already carries the nearest reflection probe's IBL — the
|
|
23
|
+
* reflection fades to the probe instead of to black.
|
|
24
|
+
*
|
|
25
|
+
* SSR_COMPOSITE_GLSL (full-res): `hdr + reflection · confidence · intensity`.
|
|
26
|
+
*
|
|
27
|
+
* Limit (GU47 phase 2, receipt effects-ssr): the forward pass writes no
|
|
28
|
+
* metalness, F0 or roughness, so the fresnel uses dielectric F0 0.04 and the
|
|
29
|
+
* node's `roughness` frame-wide. A metallic floor (real F0 ~0.3+) reflects
|
|
30
|
+
* several times weaker than its material; the bridge reports
|
|
31
|
+
* `POST_SSR_MATERIAL_INPUTS_UNAVAILABLE` whenever S3 is authored.
|
|
32
|
+
*/
|
|
33
|
+
const HEADER = `#version 300 es
|
|
34
|
+
precision highp float;
|
|
35
|
+
`;
|
|
36
|
+
export const SSR_TRACE_GLSL = /* glsl */ `${HEADER}
|
|
37
|
+
uniform sampler2D u_color; // reflection source: history (u_reproject = 1) or this frame's HDR
|
|
38
|
+
uniform highp sampler2D u_linearDepth; // full-res S1 linear depth (.r, metres)
|
|
39
|
+
uniform mat4 u_projection; // this frame's projection
|
|
40
|
+
uniform mat4 u_viewToPrevClip; // prevViewProj · inv(view); used when u_reproject = 1
|
|
41
|
+
uniform int u_reproject;
|
|
42
|
+
uniform int u_ortho;
|
|
43
|
+
uniform float u_far;
|
|
44
|
+
uniform float u_maxDistance; // metres along the reflected ray
|
|
45
|
+
uniform float u_thickness; // metres behind the depth buffer that still count as a hit
|
|
46
|
+
uniform float u_roughness; // surface roughness hint; cutoff 0.5
|
|
47
|
+
out vec4 o_color;
|
|
48
|
+
|
|
49
|
+
#ifndef AURA_SSR_STEPS
|
|
50
|
+
#define AURA_SSR_STEPS 24
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
float linearDepthAt(vec2 uv) {
|
|
54
|
+
ivec2 size = textureSize(u_linearDepth, 0);
|
|
55
|
+
ivec2 p = clamp(ivec2(uv * vec2(size)), ivec2(0), size - 1);
|
|
56
|
+
return texelFetch(u_linearDepth, p, 0).r;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
vec3 viewPosition(vec2 uv, float z) {
|
|
60
|
+
vec2 ndc = uv * 2.0 - 1.0;
|
|
61
|
+
if (u_ortho == 1) {
|
|
62
|
+
return vec3((ndc.x - u_projection[3][0]) / u_projection[0][0], (ndc.y - u_projection[3][1]) / u_projection[1][1], -z);
|
|
63
|
+
}
|
|
64
|
+
return vec3(ndc.x * z / u_projection[0][0], ndc.y * z / u_projection[1][1], -z);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
vec2 projectToUv(vec3 viewPos) {
|
|
68
|
+
vec4 clip = u_projection * vec4(viewPos, 1.0);
|
|
69
|
+
return clip.w != 0.0 ? clip.xy / clip.w * 0.5 + 0.5 : vec2(-1.0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void main() {
|
|
73
|
+
vec2 halfSize = vec2(textureSize(u_linearDepth, 0)) * 0.5;
|
|
74
|
+
vec2 uv = gl_FragCoord.xy / halfSize;
|
|
75
|
+
float z = linearDepthAt(uv);
|
|
76
|
+
if (z <= 0.0 || z >= u_far * 0.999) { o_color = vec4(0.0); return; }
|
|
77
|
+
vec2 texel = 1.0 / vec2(textureSize(u_linearDepth, 0));
|
|
78
|
+
vec3 p = viewPosition(uv, z);
|
|
79
|
+
vec3 px = viewPosition(uv + vec2(texel.x, 0.0), linearDepthAt(uv + vec2(texel.x, 0.0)));
|
|
80
|
+
vec3 py = viewPosition(uv + vec2(0.0, texel.y), linearDepthAt(uv + vec2(0.0, texel.y)));
|
|
81
|
+
vec3 n = normalize(cross(px - p, py - p));
|
|
82
|
+
vec3 v = u_ortho == 1 ? vec3(0.0, 0.0, -1.0) : normalize(p);
|
|
83
|
+
if (dot(n, v) > 0.0) n = -n;
|
|
84
|
+
vec3 r = normalize(reflect(v, n));
|
|
85
|
+
|
|
86
|
+
float roughnessGate = 1.0 - smoothstep(0.35, 0.5, u_roughness);
|
|
87
|
+
// Rays heading back toward the camera leave the screen or hit back faces.
|
|
88
|
+
float facing = 1.0 - smoothstep(0.0, 0.6, r.z);
|
|
89
|
+
if (roughnessGate <= 0.0 || facing <= 0.0) { o_color = vec4(0.0); return; }
|
|
90
|
+
|
|
91
|
+
float stepLength = u_maxDistance / float(AURA_SSR_STEPS);
|
|
92
|
+
vec3 prev = p;
|
|
93
|
+
vec3 hitPos = p;
|
|
94
|
+
vec2 hitUv = vec2(-1.0);
|
|
95
|
+
float travelled = 0.0;
|
|
96
|
+
bool prevBehind = false;
|
|
97
|
+
for (int i = 1; i <= AURA_SSR_STEPS; ++i) {
|
|
98
|
+
vec3 q = p + r * (stepLength * float(i));
|
|
99
|
+
vec2 quv = projectToUv(q);
|
|
100
|
+
if (quv.x < 0.0 || quv.x > 1.0 || quv.y < 0.0 || quv.y > 1.0) break;
|
|
101
|
+
float sceneZ = linearDepthAt(quv);
|
|
102
|
+
float rayZ = -q.z;
|
|
103
|
+
bool behind = rayZ > sceneZ;
|
|
104
|
+
// A crossing (in front at the last sample, behind now) is refined first and
|
|
105
|
+
// the thickness test applies to the refined point: a step longer than
|
|
106
|
+
// u_thickness (24 steps over 18 m = 0.75 m) otherwise lands inside or past
|
|
107
|
+
// anything thinner than the step and the hit is lost.
|
|
108
|
+
if (behind && !prevBehind) {
|
|
109
|
+
vec3 a = prev;
|
|
110
|
+
vec3 b = q;
|
|
111
|
+
for (int j = 0; j < 4; ++j) {
|
|
112
|
+
vec3 m = 0.5 * (a + b);
|
|
113
|
+
vec2 muv = projectToUv(m);
|
|
114
|
+
if (-m.z > linearDepthAt(muv)) b = m; else a = m;
|
|
115
|
+
}
|
|
116
|
+
vec2 buv = projectToUv(b);
|
|
117
|
+
if (-b.z - linearDepthAt(buv) < u_thickness) {
|
|
118
|
+
hitPos = b;
|
|
119
|
+
hitUv = buv;
|
|
120
|
+
// Refined distance, not the step index: the index quantised the fade into one band per step
|
|
121
|
+
// (drift-and-deliver-port's 60 m / 24-step wet road showed regular stripes; GU47 phase 2).
|
|
122
|
+
travelled = clamp(length(b - p) / u_maxDistance, 0.0, 1.0);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
prevBehind = behind;
|
|
127
|
+
prev = q;
|
|
128
|
+
}
|
|
129
|
+
if (hitUv.x < 0.0) { o_color = vec4(0.0); return; }
|
|
130
|
+
|
|
131
|
+
vec2 sourceUv = hitUv;
|
|
132
|
+
if (u_reproject == 1) {
|
|
133
|
+
vec4 prevClip = u_viewToPrevClip * vec4(hitPos, 1.0);
|
|
134
|
+
sourceUv = prevClip.w > 0.0 ? prevClip.xy / prevClip.w * 0.5 + 0.5 : hitUv;
|
|
135
|
+
}
|
|
136
|
+
vec2 edge = abs(sourceUv * 2.0 - 1.0);
|
|
137
|
+
float edgeFade = 1.0 - smoothstep(0.85, 1.0, max(edge.x, edge.y));
|
|
138
|
+
float distanceFade = 1.0 - travelled * travelled;
|
|
139
|
+
float cosTheta = clamp(dot(-v, n), 0.0, 1.0);
|
|
140
|
+
float fresnel = 0.04 + 0.96 * pow(1.0 - cosTheta, 5.0);
|
|
141
|
+
float confidence = clamp(edgeFade * distanceFade * facing * roughnessGate * fresnel, 0.0, 1.0);
|
|
142
|
+
vec3 radiance = textureLod(u_color, clamp(sourceUv, vec2(0.0), vec2(1.0)), 0.0).rgb;
|
|
143
|
+
o_color = vec4(radiance, confidence);
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
export const SSR_COMPOSITE_GLSL = /* glsl */ `${HEADER}
|
|
147
|
+
uniform sampler2D u_color; // full-res HDR
|
|
148
|
+
uniform sampler2D u_reflection; // half-res trace (.a = confidence)
|
|
149
|
+
uniform float u_intensity;
|
|
150
|
+
out vec4 o_color;
|
|
151
|
+
|
|
152
|
+
void main() {
|
|
153
|
+
ivec2 pixel = ivec2(gl_FragCoord.xy);
|
|
154
|
+
vec4 src = texelFetch(u_color, pixel, 0);
|
|
155
|
+
vec4 refl = texture(u_reflection, (vec2(pixel) + 0.5) / vec2(textureSize(u_color, 0)));
|
|
156
|
+
o_color = vec4(src.rgb + refl.rgb * refl.a * u_intensity, src.a);
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
/** S3 defaults: roughness cutoff 0.5 (gate fades from 0.35), 24 march steps, 0.25 m thickness. */
|
|
160
|
+
export const SSR_ROUGHNESS_CUTOFF = 0.5;
|
|
161
|
+
export const SSR_DEFAULT_STEPS = 24;
|
|
162
|
+
export const SSR_DEFAULT_THICKNESS = 0.25;
|
|
163
|
+
//# sourceMappingURL=ssr.glsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr.glsl.js","sourceRoot":"","sources":["../../../../../../packages/rendering/src/post/shaders/ssr.glsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,MAAM,GAAG;;CAEd,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6GjD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC,GAAG,MAAM;;;;;;;;;;;;CAYrD,CAAC;AAEF,kGAAkG;AAClG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC"}
|