@aura3d/rendering 1.4.0 → 1.4.2
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/package.json +38 -4
- package/AGENTS.md +0 -46
- package/src/ArchitecturalLightingFixtures.ts +0 -241
- package/src/ArchitecturalMaterialCatalog.ts +0 -130
- package/src/ArchitecturalMeasurementFixtures.ts +0 -155
- package/src/BRDFLut.ts +0 -47
- package/src/CameraFraming.ts +0 -200
- package/src/CanonicalSceneFixtures.ts +0 -95
- package/src/CascadedShadowMaps.ts +0 -449
- package/src/ColorManagement.ts +0 -127
- package/src/CullingFixtures.ts +0 -280
- package/src/DecalGeometry.ts +0 -26
- package/src/DepthPass.ts +0 -110
- package/src/EnvironmentBackgroundPass.ts +0 -194
- package/src/EnvironmentBackgroundResources.ts +0 -309
- package/src/EnvironmentLighting.ts +0 -96
- package/src/EnvironmentMapResources.ts +0 -1026
- package/src/EnvironmentPipeline.ts +0 -69
- package/src/EnvironmentPlatform.ts +0 -1306
- package/src/EnvironmentPreset.ts +0 -155
- package/src/Exposure.ts +0 -66
- package/src/ExternalParityRenderPreset.ts +0 -725
- package/src/ForwardPass.ts +0 -1668
- package/src/FrameVisualMetrics.ts +0 -301
- package/src/Geometry.ts +0 -461
- package/src/GeometryPrimitives.ts +0 -2
- package/src/HDRRenderPipeline.ts +0 -94
- package/src/IBL.ts +0 -86
- package/src/IndexBuffer.ts +0 -57
- package/src/InstancedPBRMaterial.ts +0 -186
- package/src/InstancedUnlitMaterial.ts +0 -60
- package/src/Instancing.ts +0 -19
- package/src/LightCollector.ts +0 -82
- package/src/LightUniforms.ts +0 -47
- package/src/LightingDebug.ts +0 -80
- package/src/LightingDefaults.ts +0 -79
- package/src/LightingRig.ts +0 -301
- package/src/LineGeometry.ts +0 -2
- package/src/Material.ts +0 -209
- package/src/MaterialBinding.ts +0 -131
- package/src/MaterialInstance.ts +0 -59
- package/src/MaterialPresets.ts +0 -272
- package/src/MorphTarget.ts +0 -124
- package/src/MorphTargetPlan.ts +0 -178
- package/src/MorphUnlitMaterial.ts +0 -60
- package/src/NormalMappedPBRMaterial.ts +0 -188
- package/src/OceanFixtures.ts +0 -318
- package/src/PBRLightingDefaults.ts +0 -12
- package/src/PBRMaterial.ts +0 -442
- package/src/PMREM.ts +0 -53
- package/src/PbrReference.ts +0 -681
- package/src/PostProcessPass.ts +0 -2507
- package/src/ProceduralTextureFixtures.ts +0 -393
- package/src/ProductTurntableFixtures.ts +0 -815
- package/src/Raycaster.ts +0 -21
- package/src/ReflectionProbe.ts +0 -13
- package/src/ReflectionSurfaces.ts +0 -219
- package/src/RenderBackend.ts +0 -43
- package/src/RenderDebugViews.ts +0 -138
- package/src/RenderDevice.ts +0 -836
- package/src/RenderGraph.ts +0 -194
- package/src/RenderPass.ts +0 -27
- package/src/RenderPipeline.ts +0 -101
- package/src/RenderQueue.ts +0 -12
- package/src/RenderState.ts +0 -12
- package/src/Renderer.ts +0 -2631
- package/src/RendererDebugOverlay.ts +0 -80
- package/src/RendererFeatureGates.ts +0 -150
- package/src/RendererPostprocessPlan.ts +0 -279
- package/src/RendererTiming.ts +0 -251
- package/src/RendererVisualPipelineReport.ts +0 -836
- package/src/ResourceLifecycle.ts +0 -21
- package/src/Sampler.ts +0 -37
- package/src/SceneOptimization.ts +0 -518
- package/src/ShaderChunks.ts +0 -393
- package/src/ShaderLibrary.ts +0 -2766
- package/src/ShaderModule.ts +0 -36
- package/src/ShaderPreprocessor.ts +0 -260
- package/src/ShaderReflection.ts +0 -201
- package/src/ShadowMap.ts +0 -237
- package/src/ShadowPass.ts +0 -198
- package/src/ShadowProjection.ts +0 -115
- package/src/SkinnedLitMaterial.ts +0 -397
- package/src/SkinnedUnlitMaterial.ts +0 -63
- package/src/SkinningBounds.ts +0 -131
- package/src/SpaceEnvironmentFixtures.ts +0 -200
- package/src/SpriteGeometry.ts +0 -21
- package/src/StereoCameraRig.ts +0 -127
- package/src/StereoEffects.ts +0 -274
- package/src/TerrainFixtures.ts +0 -180
- package/src/Texture.ts +0 -307
- package/src/TextureBinding.ts +0 -91
- package/src/TexturedPBRMaterial.ts +0 -1112
- package/src/TexturedUnlitMaterial.ts +0 -67
- package/src/ToneMapping.ts +0 -105
- package/src/UniformBinder.ts +0 -16
- package/src/UniformLayout.ts +0 -129
- package/src/UnlitMaterial.ts +0 -75
- package/src/VegetationFixtures.ts +0 -314
- package/src/VertexBuffer.ts +0 -120
- package/src/VertexFormat.ts +0 -171
- package/src/VoxelWorldFixtures.ts +0 -280
- package/src/WeatherFixtures.ts +0 -223
- package/src/WebGL2Device.ts +0 -2280
- package/src/WebGL2StateCache.ts +0 -330
- package/src/WebGPUDevice.ts +0 -2877
- package/src/WebGPURenderToTextureProof.ts +0 -139
- package/src/advanced-runtime/AdvancedRenderer.ts +0 -73
- package/src/advanced-runtime/index.ts +0 -9
- package/src/animation/AnimationMaterialStyle.ts +0 -32
- package/src/animation/AnimationRenderPreset.ts +0 -45
- package/src/animation/AnimationToonMaterial.ts +0 -387
- package/src/animation/AnimationVisualQuality.ts +0 -71
- package/src/animation/applyAnimationRenderPreset.ts +0 -180
- package/src/animation/index.ts +0 -5
- package/src/cinematic/BloomPass.ts +0 -26
- package/src/cinematic/CinematicDepthComposition.ts +0 -30
- package/src/cinematic/CinematicEvidence.ts +0 -123
- package/src/cinematic/CinematicLightingRig.ts +0 -144
- package/src/cinematic/CinematicMaterialPresets.ts +0 -130
- package/src/cinematic/CinematicPostProcess.ts +0 -83
- package/src/cinematic/DepthHazePass.ts +0 -30
- package/src/cinematic/EmissivePracticalLightSystem.ts +0 -45
- package/src/cinematic/FilmGrainPass.ts +0 -24
- package/src/cinematic/FogVolumeSystem.ts +0 -30
- package/src/cinematic/GlowCardSystem.ts +0 -44
- package/src/cinematic/RainParticleSystem.ts +0 -151
- package/src/cinematic/VignettePass.ts +0 -25
- package/src/cinematic/WetReflectionApproximation.ts +0 -27
- package/src/cinematic/index.ts +0 -14
- package/src/effects/CollisionModule.ts +0 -64
- package/src/effects/ColorModule.ts +0 -60
- package/src/effects/ForceModule.ts +0 -25
- package/src/effects/GPUParticleBackend.ts +0 -569
- package/src/effects/Particle.ts +0 -108
- package/src/effects/ParticleDiagnostics.ts +0 -224
- package/src/effects/ParticleEffectPresets.ts +0 -147
- package/src/effects/ParticleEmitter.ts +0 -326
- package/src/effects/ParticleModule.ts +0 -26
- package/src/effects/ParticleRenderPass.ts +0 -117
- package/src/effects/ParticleRenderer.ts +0 -132
- package/src/effects/ParticleSystem.ts +0 -333
- package/src/effects/SizeModule.ts +0 -56
- package/src/effects/TrailModule.ts +0 -72
- package/src/effects/VelocityModule.ts +0 -75
- package/src/effects/index.ts +0 -15
- package/src/index.ts +0 -925
- package/src/materials/AlphaSorting.ts +0 -30
- package/src/materials/MaterialExtensions.ts +0 -42
- package/src/materials/PhysicalMaterial.ts +0 -133
- package/src/materials/TransmissionPass.ts +0 -51
- package/src/performance/BVH.ts +0 -18
- package/src/performance/Batcher.ts +0 -2
- package/src/performance/FrustumCuller.ts +0 -9
- package/src/performance/LOD.ts +0 -20
- package/src/performance/Octree.ts +0 -10
- package/src/performance/RenderItemSorting.ts +0 -170
- package/src/performance/RendererStats.ts +0 -43
- package/src/performance/ResourceBudget.ts +0 -44
- package/src/postprocess/BloomPass.ts +0 -28
- package/src/postprocess/CinematicDiagnostics.ts +0 -642
- package/src/postprocess/ColorGradingPass.ts +0 -24
- package/src/postprocess/DepthOfFieldPass.ts +0 -12
- package/src/postprocess/EffectComposer.ts +0 -349
- package/src/postprocess/SSAOPass.ts +0 -20
- package/src/postprocess/index.ts +0 -34
- package/src/production-runtime/AnimationControlsPipeline.ts +0 -77
- package/src/production-runtime/PBRHDRPipeline.ts +0 -381
- package/src/production-runtime/ProductionEffectsPipeline.ts +0 -85
- package/src/production-runtime/ProductionRendererTypes.ts +0 -136
- package/src/production-runtime/ProductionRuntimeRenderer.ts +0 -172
- package/src/production-runtime/ProductionWebGL2Renderer.ts +0 -313
- package/src/production-runtime/ProductionWebGPURenderer.ts +0 -396
- package/src/production-runtime/TransmissionBackdropCapture.ts +0 -130
- package/src/production-runtime/animation/MorphTargetRenderer.ts +0 -2
- package/src/production-runtime/animation/SkinningRenderer.ts +0 -2
- package/src/production-runtime/backends/RendererBackend.ts +0 -17
- package/src/production-runtime/backends/WebGL2RendererBackend.ts +0 -30
- package/src/production-runtime/backends/WebGPURendererBackend.ts +0 -24
- package/src/production-runtime/backends/webgl2/WebGL2Buffer.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2Capabilities.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2RenderTarget.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2Shader.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2StateCache.ts +0 -1
- package/src/production-runtime/backends/webgl2/WebGL2Texture.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUBuffer.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUCapabilities.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPURenderTarget.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUShader.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUTexture.ts +0 -2
- package/src/production-runtime/color/ColorManagement.ts +0 -3
- package/src/production-runtime/color/ToneMapping.ts +0 -7
- package/src/production-runtime/diagnostics/FrameCapture.ts +0 -2
- package/src/production-runtime/diagnostics/GPUCapabilities.ts +0 -2
- package/src/production-runtime/diagnostics/RendererStats.ts +0 -2
- package/src/production-runtime/environment/EnvironmentMap.ts +0 -1
- package/src/production-runtime/environment/HDRLoader.ts +0 -57
- package/src/production-runtime/environment/PMREMGenerator.ts +0 -713
- package/src/production-runtime/framegraph/FrameGraph.ts +0 -18
- package/src/production-runtime/framegraph/RenderPass.ts +0 -15
- package/src/production-runtime/geometry/ProjectedDecalGeometry.ts +0 -439
- package/src/production-runtime/index.ts +0 -127
- package/src/production-runtime/lights/LightManager.ts +0 -7
- package/src/production-runtime/lights/ShadowMapRenderer.ts +0 -5
- package/src/production-runtime/materials/GLTFMaterialAdapter.ts +0 -6
- package/src/production-runtime/materials/GLTFPBRMaterialAdapter.ts +0 -2
- package/src/production-runtime/materials/MaterialCompiler.ts +0 -7
- package/src/production-runtime/materials/MaterialTextureBindings.ts +0 -5
- package/src/production-runtime/materials/PBRMaterial.ts +0 -2
- package/src/production-runtime/materials/PBRShaderFeatures.ts +0 -2
- package/src/production-runtime/passes/ContactShadowPass.ts +0 -184
- package/src/production-runtime/passes/DepthPrepass.ts +0 -7
- package/src/production-runtime/passes/OpaquePass.ts +0 -7
- package/src/production-runtime/passes/ShadowPass.ts +0 -7
- package/src/production-runtime/passes/SkyboxPass.ts +0 -7
- package/src/production-runtime/passes/ToneMappingPass.ts +0 -7
- package/src/production-runtime/passes/TransparentPass.ts +0 -7
- package/src/production-runtime/postprocess/BloomPass.ts +0 -51
- package/src/production-runtime/postprocess/ColorGradingPass.ts +0 -49
- package/src/production-runtime/postprocess/DOFPass.ts +0 -47
- package/src/production-runtime/postprocess/FXAAPass.ts +0 -53
- package/src/production-runtime/postprocess/ProductionEffectComposer.ts +0 -78
- package/src/production-runtime/postprocess/ProductionPostProcessTypes.ts +0 -174
- package/src/production-runtime/postprocess/SSAOPass.ts +0 -45
- package/src/production-runtime/resources/GPUBuffer.ts +0 -2
- package/src/production-runtime/resources/GPUTexture.ts +0 -2
- package/src/production-runtime/resources/RenderTarget.ts +0 -3
- package/src/production-runtime/resources/ResourceCache.ts +0 -7
- package/src/production-runtime/scene/Camera.ts +0 -1
- package/src/production-runtime/scene/Lights.ts +0 -2
- package/src/production-runtime/scene/RenderableMesh.ts +0 -2
- package/src/production-runtime/scene/RenderablePrimitive.ts +0 -1
- package/src/production-runtime/scene/RenderableScene.ts +0 -4
- package/src/production-runtime/shaders/ShaderProgramLibrary.ts +0 -7
- package/src/production-runtime/shaders/chunks/brdf.glsl +0 -2
- package/src/production-runtime/shaders/chunks/ibl.glsl +0 -3
- package/src/production-runtime/shaders/chunks/pbr.frag.glsl +0 -47
- package/src/production-runtime/shaders/chunks/pbr.vert.glsl +0 -8
- package/src/production-runtime/shaders/chunks/shadows.glsl +0 -2
- package/src/production-runtime/shaders/wgsl/pbr.wgsl +0 -3
- package/src/production-runtime/shaders/wgsl/postprocess.wgsl +0 -2
- package/src/production-runtime/shaders/wgsl/skybox.wgsl +0 -2
- package/src/shaders/depth.frag.glsl +0 -5
- package/src/shaders/depth.vert.glsl +0 -8
- package/src/shaders/pbr-direct.frag.glsl +0 -687
- package/src/shaders/pbr-direct.vert.glsl +0 -18
- package/src/shaders/unlit.frag.glsl +0 -18
- package/src/shaders/unlit.vert.glsl +0 -13
- package/src/shadows/CascadedShadowPipeline.ts +0 -53
- package/src/shadows/ContactShadows.ts +0 -106
- package/src/shadows/ShadowDebugViews.ts +0 -46
- package/src/threejs-compatibility/InstancingSystem.ts +0 -17
- package/src/threejs-compatibility/LightingSystem.ts +0 -22
- package/src/threejs-compatibility/MaterialSystem.ts +0 -9
- package/src/threejs-compatibility/RenderTargetSystem.ts +0 -35
- package/src/threejs-compatibility/RendererDiagnostics.ts +0 -61
- package/src/threejs-compatibility/SceneRenderer.ts +0 -34
- package/src/threejs-compatibility/ShadowSystem.ts +0 -19
- package/src/threejs-compatibility/TextureSystem.ts +0 -19
- package/src/threejs-compatibility/ThreeCompatRenderer.ts +0 -90
- package/src/threejs-compatibility/TransparencySystem.ts +0 -19
- package/src/threejs-compatibility/index.ts +0 -29
- package/src/threejs-compatibility/performance/BVH.ts +0 -14
- package/src/threejs-compatibility/performance/FrustumCulling.ts +0 -10
- package/src/threejs-compatibility/performance/Instancing.ts +0 -4
- package/src/threejs-compatibility/performance/LODSystem.ts +0 -16
- package/src/threejs-compatibility/performance/OcclusionCulling.ts +0 -6
- package/src/threejs-compatibility/performance/RaycastAcceleration.ts +0 -12
- package/src/threejs-compatibility/performance/RendererProfiler.ts +0 -19
- package/src/threejs-compatibility/performance/TextureStreaming.ts +0 -4
- package/src/threejs-compatibility/performance/index.ts +0 -12
- package/src/threejs-compatibility/postprocess/BloomPass.ts +0 -16
- package/src/threejs-compatibility/postprocess/ColorGradingPass.ts +0 -16
- package/src/threejs-compatibility/postprocess/DepthOfFieldPass.ts +0 -21
- package/src/threejs-compatibility/postprocess/EffectComposer.ts +0 -14
- package/src/threejs-compatibility/postprocess/FXAAPass.ts +0 -15
- package/src/threejs-compatibility/postprocess/MotionBlurPass.ts +0 -20
- package/src/threejs-compatibility/postprocess/OutlinePass.ts +0 -21
- package/src/threejs-compatibility/postprocess/PostProcessTypes.ts +0 -169
- package/src/threejs-compatibility/postprocess/RenderPass.ts +0 -9
- package/src/threejs-compatibility/postprocess/SMAAPass.ts +0 -15
- package/src/threejs-compatibility/postprocess/SSAOPass.ts +0 -21
- package/src/threejs-compatibility/postprocess/ShaderPass.ts +0 -7
- package/src/threejs-compatibility/postprocess/TAAPass.ts +0 -15
- package/src/threejs-compatibility/postprocess/VignettePass.ts +0 -16
- package/src/threejs-compatibility/postprocess/index.ts +0 -15
- package/src/threejs-compatibility/shaders/NodeMaterial.ts +0 -21
- package/src/threejs-compatibility/shaders/RawShaderMaterial.ts +0 -6
- package/src/threejs-compatibility/shaders/ShaderDiagnostics.ts +0 -17
- package/src/threejs-compatibility/shaders/ShaderMaterial.ts +0 -18
- package/src/threejs-compatibility/shaders/ThreeCompatShaderChunks.ts +0 -6
- package/src/threejs-compatibility/shaders/Uniforms.ts +0 -18
- package/src/threejs-compatibility/shaders/index.ts +0 -9
- package/src/threejs-compatibility/vfx/GPUPointCloud.ts +0 -7
- package/src/threejs-compatibility/vfx/LineRenderer.ts +0 -13
- package/src/threejs-compatibility/vfx/ParticleSystem.ts +0 -23
- package/src/threejs-compatibility/vfx/SpriteSystem.ts +0 -14
- package/src/threejs-compatibility/vfx/TrailRenderer.ts +0 -8
- package/src/threejs-compatibility/vfx/VFXDiagnostics.ts +0 -23
- package/src/threejs-compatibility/vfx/index.ts +0 -9
- package/src/threejs-example-parity/index.ts +0 -205
- package/src/webgpu/WebGPUBuffer.ts +0 -1
- package/src/webgpu/WebGPUCompute.ts +0 -2
- package/src/webgpu/WebGPUPipelineCache.ts +0 -15
- package/src/webgpu/WebGPUPostProcess.ts +0 -2
- package/src/webgpu/WebGPUTexture.ts +0 -2
- package/tsconfig.json +0 -26
- package/vitest.config.ts +0 -20
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { evaluateFrameVisualQuality, type FrameVisualMetrics, type FrameVisualQualityThresholds } from "../FrameVisualMetrics.js";
|
|
2
|
-
|
|
3
|
-
export interface AnimationFrameVisualInput {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly metrics: FrameVisualMetrics;
|
|
6
|
-
readonly characterCount?: number | undefined;
|
|
7
|
-
readonly captionOccluded?: boolean | undefined;
|
|
8
|
-
readonly routeChromeVisible?: boolean | undefined;
|
|
9
|
-
readonly debugOverlayVisible?: boolean | undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface AnimationFrameVisualQuality {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly ok: boolean;
|
|
15
|
-
readonly failures: readonly string[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface AnimationVisualQualityReport {
|
|
19
|
-
readonly kind: "animation-visual-quality";
|
|
20
|
-
readonly ok: boolean;
|
|
21
|
-
readonly frames: readonly AnimationFrameVisualQuality[];
|
|
22
|
-
readonly visibleCharacterCount: number;
|
|
23
|
-
readonly blockers: readonly string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface AnimationVisualQualityOptions {
|
|
27
|
-
readonly thresholds?: FrameVisualQualityThresholds | undefined;
|
|
28
|
-
readonly minVisibleCharacters?: number | undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function createAnimationVisualQualityReport(
|
|
32
|
-
frames: readonly AnimationFrameVisualInput[],
|
|
33
|
-
options: AnimationVisualQualityOptions = {}
|
|
34
|
-
): AnimationVisualQualityReport {
|
|
35
|
-
const thresholds = options.thresholds ?? defaultAnimationVisualQualityThresholds;
|
|
36
|
-
const frameResults = frames.map((frame): AnimationFrameVisualQuality => {
|
|
37
|
-
const base = evaluateFrameVisualQuality(frame.metrics, thresholds);
|
|
38
|
-
const failures = [
|
|
39
|
-
...base.failures,
|
|
40
|
-
frame.captionOccluded ? "caption occludes important action" : undefined,
|
|
41
|
-
frame.routeChromeVisible ? "route chrome is visible" : undefined,
|
|
42
|
-
frame.debugOverlayVisible ? "debug overlay is visible" : undefined
|
|
43
|
-
].filter((failure): failure is string => Boolean(failure));
|
|
44
|
-
return { id: frame.id, ok: failures.length === 0, failures };
|
|
45
|
-
});
|
|
46
|
-
const visibleCharacterCount = Math.max(0, ...frames.map((frame) => frame.characterCount ?? 0));
|
|
47
|
-
const blockers = [
|
|
48
|
-
...frameResults.flatMap((frame) => frame.failures.map((failure) => `${frame.id}: ${failure}`)),
|
|
49
|
-
visibleCharacterCount < (options.minVisibleCharacters ?? 2)
|
|
50
|
-
? `visibleCharacterCount ${visibleCharacterCount} < ${options.minVisibleCharacters ?? 2}`
|
|
51
|
-
: undefined
|
|
52
|
-
].filter((blocker): blocker is string => Boolean(blocker));
|
|
53
|
-
return {
|
|
54
|
-
kind: "animation-visual-quality",
|
|
55
|
-
ok: blockers.length === 0,
|
|
56
|
-
frames: frameResults,
|
|
57
|
-
visibleCharacterCount,
|
|
58
|
-
blockers
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const defaultAnimationVisualQualityThresholds: FrameVisualQualityThresholds = {
|
|
63
|
-
minNonDarkRatio: 0.08,
|
|
64
|
-
minSalientRatio: 0.035,
|
|
65
|
-
minOccupiedAreaRatio: 0.08,
|
|
66
|
-
minOccupiedQuadrants: 2,
|
|
67
|
-
minColorBuckets: 6,
|
|
68
|
-
maxDominantBucketRatio: 0.92,
|
|
69
|
-
maxFlatPixelRatio: 0.98,
|
|
70
|
-
minLocalContrastRatio: 0.002
|
|
71
|
-
};
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { AnimationToonMaterial, type AnimationToonMaterialOptions } from "./AnimationToonMaterial.js";
|
|
2
|
-
import type { AnimationRenderPresetEvidence } from "./AnimationRenderPreset.js";
|
|
3
|
-
import type { AnimationMaterialStyle } from "./AnimationMaterialStyle.js";
|
|
4
|
-
import { colorGradePixels, outlinePixels, type ColorGradeResult, type OutlineResult } from "../PostProcessPass.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* applyAnimationRenderPreset — turns a (metadata) AnimationRenderPreset into the
|
|
8
|
-
* concrete, pixel-affecting treatment it describes:
|
|
9
|
-
*
|
|
10
|
-
* 1. MATERIAL: builds a real `AnimationToonMaterial` (banded N·L ramp + rim) from
|
|
11
|
-
* the preset's `materialStyle`. The band count comes from `materialStyle.rampSteps`.
|
|
12
|
-
* 2. OUTLINE: runs the existing Sobel `outlinePixels()` post-pass when the style
|
|
13
|
-
* requests outlines.
|
|
14
|
-
* 3. COLOR GRADE: pushes a stylized, slightly-saturated, gently-contrasted grade
|
|
15
|
-
* consistent with the preset (storybook look), honoring `reducedFlash`.
|
|
16
|
-
*
|
|
17
|
-
* WHAT ACTUALLY AFFECTS PIXELS (honest accounting):
|
|
18
|
-
* - `material` is a fully-wired engine material. Assigning it to scene meshes and
|
|
19
|
-
* rendering with a ShaderLibrary that has the animation program registered produces
|
|
20
|
-
* banded toon shading on real fragments. THIS FUNCTION DOES NOT REASSIGN SCENE
|
|
21
|
-
* MESH MATERIALS — there is no scene-graph type imported here — it RETURNS the
|
|
22
|
-
* material so the caller (which owns the scene) can assign it. That assignment
|
|
23
|
-
* step is the one piece that is the caller's responsibility, not this function's.
|
|
24
|
-
* - `outline` (when present) is a real OutlineResult whose `.pixels` ARE modified
|
|
25
|
-
* image bytes. If you pass a frame buffer, the returned bytes are drawn pixels.
|
|
26
|
-
* - `colorGrade` (when a frame is passed) is a real ColorGradeResult — modified
|
|
27
|
-
* pixels.
|
|
28
|
-
*
|
|
29
|
-
* WHAT IS NOT WIRED:
|
|
30
|
-
* - Lights / shadows from the preset are reflected in the returned `lighting`
|
|
31
|
-
* descriptor and fed into the toon material's single key-light uniforms, but the
|
|
32
|
-
* multi-light rig (`preset.lights`) is descriptive — the toon program consumes one
|
|
33
|
-
* directional key light, not the full named rig.
|
|
34
|
-
* - Bloom/fog from the preset are NOT applied here (they belong to the HDR pipeline);
|
|
35
|
-
* only outline + color grade run as post-passes in this function.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
export interface ApplyAnimationRenderPresetFrame {
|
|
39
|
-
/** RGBA8 pixel buffer (length === width * height * 4). */
|
|
40
|
-
readonly pixels: Uint8Array;
|
|
41
|
-
readonly width: number;
|
|
42
|
-
readonly height: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface AnimationRenderPresetLightingDescriptor {
|
|
46
|
-
readonly keyLightDirection: readonly [number, number, number];
|
|
47
|
-
readonly keyLightColor: readonly [number, number, number];
|
|
48
|
-
readonly softShadows: boolean;
|
|
49
|
-
readonly contactShadows: boolean;
|
|
50
|
-
/** The full named rig from the preset (descriptive — not all consumed by the toon program). */
|
|
51
|
-
readonly namedRig: readonly string[];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface ApplyAnimationRenderPresetOptions {
|
|
55
|
-
/** Optional explicit base color override for the toon material. */
|
|
56
|
-
readonly baseColor?: readonly [number, number, number, number] | undefined;
|
|
57
|
-
/** Optional toon material override knobs (light direction/colors/rim). */
|
|
58
|
-
readonly material?: Partial<AnimationToonMaterialOptions> | undefined;
|
|
59
|
-
/** Optional frame to run the outline + color-grade post-passes against. */
|
|
60
|
-
readonly frame?: ApplyAnimationRenderPresetFrame | undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface ApplyAnimationRenderPresetResult {
|
|
64
|
-
readonly kind: "animation-render-preset-application";
|
|
65
|
-
/** Real engine material — assign to scene meshes to get banded toon pixels. */
|
|
66
|
-
readonly material: AnimationToonMaterial;
|
|
67
|
-
readonly materialStyle: AnimationMaterialStyle;
|
|
68
|
-
/** Key-light descriptor derived from the preset, also baked into the material. */
|
|
69
|
-
readonly lighting: AnimationRenderPresetLightingDescriptor;
|
|
70
|
-
/** True when the Sobel outline pass is enabled for this preset. */
|
|
71
|
-
readonly outlineEnabled: boolean;
|
|
72
|
-
/** Present only when a frame was supplied AND outlines are enabled. Real modified pixels. */
|
|
73
|
-
readonly outline?: OutlineResult | undefined;
|
|
74
|
-
/** Present only when a frame was supplied. Real modified pixels. */
|
|
75
|
-
readonly colorGrade?: ColorGradeResult | undefined;
|
|
76
|
-
/** Honest per-stage record of what touched pixels. */
|
|
77
|
-
readonly appliedToPixels: {
|
|
78
|
-
readonly toonMaterial: "returned-for-caller-assignment";
|
|
79
|
-
readonly outline: boolean;
|
|
80
|
-
readonly colorGrade: boolean;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const DEFAULT_KEY_LIGHT_DIRECTION: readonly [number, number, number] = [0.3, 0.8, 0.5];
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Map a AnimationMaterialStyle.treatment to a shadow-floor that keeps the chosen
|
|
88
|
-
* look readable: flatter treatments use a higher floor (less contrast between bands).
|
|
89
|
-
*/
|
|
90
|
-
function shadowFloorForTreatment(style: AnimationMaterialStyle): number {
|
|
91
|
-
switch (style.treatment) {
|
|
92
|
-
case "flat-readable":
|
|
93
|
-
return 0.6;
|
|
94
|
-
case "soft-toon":
|
|
95
|
-
return 0.45;
|
|
96
|
-
case "cel":
|
|
97
|
-
return 0.3;
|
|
98
|
-
case "preserve-pbr":
|
|
99
|
-
default:
|
|
100
|
-
return 0.4;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function applyAnimationRenderPreset(
|
|
105
|
-
preset: AnimationRenderPresetEvidence,
|
|
106
|
-
options: ApplyAnimationRenderPresetOptions = {}
|
|
107
|
-
): ApplyAnimationRenderPresetResult {
|
|
108
|
-
const style = preset.materialStyle;
|
|
109
|
-
|
|
110
|
-
const keyLightDirection = options.material?.lightDirection ?? DEFAULT_KEY_LIGHT_DIRECTION;
|
|
111
|
-
const keyLightColor = options.material?.lightColor ?? [1, 0.97, 0.9];
|
|
112
|
-
|
|
113
|
-
// 1. MATERIAL — band count comes straight from the style's rampSteps (clamped to
|
|
114
|
-
// the toon material's supported [2, 16] range).
|
|
115
|
-
const bands = Math.max(2, Math.min(16, Math.round(style.rampSteps)));
|
|
116
|
-
const material = new AnimationToonMaterial({
|
|
117
|
-
name: `${preset.name}-toon`,
|
|
118
|
-
baseColor: options.baseColor ?? options.material?.baseColor ?? [0.92, 0.58, 0.16, 1],
|
|
119
|
-
bands,
|
|
120
|
-
shadowFloor: options.material?.shadowFloor ?? shadowFloorForTreatment(style),
|
|
121
|
-
lightDirection: keyLightDirection,
|
|
122
|
-
lightColor: keyLightColor as readonly [number, number, number],
|
|
123
|
-
rimColor: options.material?.rimColor ?? [0.6, 0.72, 1],
|
|
124
|
-
rimPower: options.material?.rimPower ?? 3,
|
|
125
|
-
// Cel treatment leans on a stronger rim for graphic edges.
|
|
126
|
-
rimIntensity: options.material?.rimIntensity ?? (style.treatment === "cel" ? 0.6 : 0.4)
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const lighting: AnimationRenderPresetLightingDescriptor = {
|
|
130
|
-
keyLightDirection,
|
|
131
|
-
keyLightColor: keyLightColor as readonly [number, number, number],
|
|
132
|
-
softShadows: preset.shadows.soft,
|
|
133
|
-
contactShadows: preset.shadows.contact,
|
|
134
|
-
namedRig: preset.lights
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const outlineEnabled = style.outline;
|
|
138
|
-
|
|
139
|
-
let outline: OutlineResult | undefined;
|
|
140
|
-
let colorGrade: ColorGradeResult | undefined;
|
|
141
|
-
|
|
142
|
-
if (options.frame) {
|
|
143
|
-
const { pixels, width, height } = options.frame;
|
|
144
|
-
// 2. OUTLINE — real Sobel edge pass over the supplied frame.
|
|
145
|
-
let working = pixels;
|
|
146
|
-
if (outlineEnabled) {
|
|
147
|
-
outline = outlinePixels(working, width, height, {
|
|
148
|
-
// Warm storybook ink that reads against the night palette.
|
|
149
|
-
color: [24, 18, 12, 255],
|
|
150
|
-
width: 1,
|
|
151
|
-
threshold: 0.22,
|
|
152
|
-
opacity: 0.85
|
|
153
|
-
});
|
|
154
|
-
working = outline.pixels;
|
|
155
|
-
}
|
|
156
|
-
// 3. COLOR GRADE — stylized grade; reducedFlash trims saturation/contrast.
|
|
157
|
-
const punch = preset.reducedFlash ? 1 : 1.05;
|
|
158
|
-
colorGrade = colorGradePixels(working, width, height, {
|
|
159
|
-
contrast: punch,
|
|
160
|
-
saturation: 1 + style.saturationBoost,
|
|
161
|
-
vibrance: preset.reducedFlash ? 0.05 : 0.12,
|
|
162
|
-
vignette: 0.18
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
kind: "animation-render-preset-application",
|
|
168
|
-
material,
|
|
169
|
-
materialStyle: style,
|
|
170
|
-
lighting,
|
|
171
|
-
outlineEnabled,
|
|
172
|
-
outline,
|
|
173
|
-
colorGrade,
|
|
174
|
-
appliedToPixels: {
|
|
175
|
-
toonMaterial: "returned-for-caller-assignment",
|
|
176
|
-
outline: outline !== undefined,
|
|
177
|
-
colorGrade: colorGrade !== undefined
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
package/src/animation/index.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRendererOwnedEvidenceFlag, type CinematicRendererEvidenceFlag } from "./CinematicEvidence";
|
|
2
|
-
|
|
3
|
-
export interface CinematicBloomPass {
|
|
4
|
-
readonly name: "bloom";
|
|
5
|
-
readonly threshold: number;
|
|
6
|
-
readonly intensity: number;
|
|
7
|
-
readonly radius: number;
|
|
8
|
-
readonly rendererOwnedEvidence: CinematicRendererEvidenceFlag;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createCinematicBloomPass(options: Partial<Omit<CinematicBloomPass, "name" | "rendererOwnedEvidence">> = {}): CinematicBloomPass {
|
|
12
|
-
return {
|
|
13
|
-
name: "bloom",
|
|
14
|
-
threshold: options.threshold ?? 0.72,
|
|
15
|
-
intensity: options.intensity ?? 0.28,
|
|
16
|
-
radius: options.radius ?? 1.35,
|
|
17
|
-
rendererOwnedEvidence: createRendererOwnedEvidenceFlag({
|
|
18
|
-
id: "postprocess:bloom",
|
|
19
|
-
feature: "postprocess",
|
|
20
|
-
label: "Bloom/glow pass",
|
|
21
|
-
source: "renderer-postprocess",
|
|
22
|
-
sceneContent: false,
|
|
23
|
-
diagnostics: ["Bloom is a renderer postprocess pass over emissive scene content."]
|
|
24
|
-
})
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createRendererOwnedEvidenceFlag, type CinematicRendererEvidenceFlag } from "./CinematicEvidence";
|
|
2
|
-
|
|
3
|
-
export interface CinematicDepthCompositionPlan {
|
|
4
|
-
readonly mode: "depth-aware" | "camera-sorted";
|
|
5
|
-
readonly depthTextureRequired: boolean;
|
|
6
|
-
readonly fallback: "camera-sorted-transparent-cards";
|
|
7
|
-
readonly rendererOwnedEvidence: CinematicRendererEvidenceFlag;
|
|
8
|
-
readonly diagnostics: readonly string[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createCinematicDepthCompositionPlan(options: { readonly depthTextureAvailable?: boolean } = {}): CinematicDepthCompositionPlan {
|
|
12
|
-
const depthTextureAvailable = options.depthTextureAvailable === true;
|
|
13
|
-
return {
|
|
14
|
-
mode: depthTextureAvailable ? "depth-aware" : "camera-sorted",
|
|
15
|
-
depthTextureRequired: depthTextureAvailable,
|
|
16
|
-
fallback: "camera-sorted-transparent-cards",
|
|
17
|
-
rendererOwnedEvidence: createRendererOwnedEvidenceFlag({
|
|
18
|
-
id: "vfx:depth-composition",
|
|
19
|
-
feature: "vfx",
|
|
20
|
-
label: "Depth-aware VFX composition",
|
|
21
|
-
source: "renderer-vfx",
|
|
22
|
-
diagnostics: [depthTextureAvailable ? "VFX can sample renderer-owned depth." : "VFX falls back to camera-sorted renderer cards/particles."]
|
|
23
|
-
}),
|
|
24
|
-
diagnostics: [
|
|
25
|
-
depthTextureAvailable
|
|
26
|
-
? "Depth texture is available for VFX composition."
|
|
27
|
-
: "Depth texture is not declared; composition remains renderer-owned but uses camera-sorted approximations."
|
|
28
|
-
]
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
export type CinematicEvidenceFeature =
|
|
2
|
-
| "material"
|
|
3
|
-
| "lighting"
|
|
4
|
-
| "vfx"
|
|
5
|
-
| "postprocess"
|
|
6
|
-
| "camera"
|
|
7
|
-
| "timeline"
|
|
8
|
-
| "blocking"
|
|
9
|
-
| "asset"
|
|
10
|
-
| "environment";
|
|
11
|
-
|
|
12
|
-
export type CinematicEvidenceSource =
|
|
13
|
-
| "renderer-scene"
|
|
14
|
-
| "renderer-material"
|
|
15
|
-
| "renderer-light"
|
|
16
|
-
| "renderer-vfx"
|
|
17
|
-
| "renderer-postprocess"
|
|
18
|
-
| "renderer-camera"
|
|
19
|
-
| "renderer-timeline"
|
|
20
|
-
| "dom-overlay"
|
|
21
|
-
| "css-overlay";
|
|
22
|
-
|
|
23
|
-
export interface CinematicRendererEvidenceFlag {
|
|
24
|
-
readonly id: string;
|
|
25
|
-
readonly feature: CinematicEvidenceFeature;
|
|
26
|
-
readonly label: string;
|
|
27
|
-
readonly source: CinematicEvidenceSource;
|
|
28
|
-
readonly rendererOwned: boolean;
|
|
29
|
-
readonly sceneContent: boolean;
|
|
30
|
-
readonly domOverlay: boolean;
|
|
31
|
-
readonly satisfiesPublicCinematicGate: boolean;
|
|
32
|
-
readonly diagnostics: readonly string[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface CinematicDomOverlayRejection {
|
|
36
|
-
readonly ok: false;
|
|
37
|
-
readonly code: "AURA_CINEMATIC_DOM_OVERLAY_EVIDENCE_REJECTED";
|
|
38
|
-
readonly missingRendererOwnedFeatures: readonly CinematicEvidenceFeature[];
|
|
39
|
-
readonly overlayOnlyFeatures: readonly CinematicEvidenceFeature[];
|
|
40
|
-
readonly diagnostics: readonly string[];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface CinematicRendererEvidenceAccepted {
|
|
44
|
-
readonly ok: true;
|
|
45
|
-
readonly rendererOwnedFeatures: readonly CinematicEvidenceFeature[];
|
|
46
|
-
readonly diagnostics: readonly string[];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type CinematicRendererEvidenceValidation = CinematicRendererEvidenceAccepted | CinematicDomOverlayRejection;
|
|
50
|
-
|
|
51
|
-
export function createRendererOwnedEvidenceFlag(input: {
|
|
52
|
-
readonly id: string;
|
|
53
|
-
readonly feature: CinematicEvidenceFeature;
|
|
54
|
-
readonly label: string;
|
|
55
|
-
readonly source?: Exclude<CinematicEvidenceSource, "dom-overlay" | "css-overlay">;
|
|
56
|
-
readonly sceneContent?: boolean;
|
|
57
|
-
readonly diagnostics?: readonly string[];
|
|
58
|
-
}): CinematicRendererEvidenceFlag {
|
|
59
|
-
return {
|
|
60
|
-
id: input.id,
|
|
61
|
-
feature: input.feature,
|
|
62
|
-
label: input.label,
|
|
63
|
-
source: input.source ?? "renderer-scene",
|
|
64
|
-
rendererOwned: true,
|
|
65
|
-
sceneContent: input.sceneContent ?? true,
|
|
66
|
-
domOverlay: false,
|
|
67
|
-
satisfiesPublicCinematicGate: true,
|
|
68
|
-
diagnostics: input.diagnostics ?? []
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function createDomOverlayEvidenceFlag(input: {
|
|
73
|
-
readonly id: string;
|
|
74
|
-
readonly feature: CinematicEvidenceFeature;
|
|
75
|
-
readonly label: string;
|
|
76
|
-
readonly source?: "dom-overlay" | "css-overlay";
|
|
77
|
-
readonly diagnostics?: readonly string[];
|
|
78
|
-
}): CinematicRendererEvidenceFlag {
|
|
79
|
-
return {
|
|
80
|
-
id: input.id,
|
|
81
|
-
feature: input.feature,
|
|
82
|
-
label: input.label,
|
|
83
|
-
source: input.source ?? "dom-overlay",
|
|
84
|
-
rendererOwned: false,
|
|
85
|
-
sceneContent: false,
|
|
86
|
-
domOverlay: true,
|
|
87
|
-
satisfiesPublicCinematicGate: false,
|
|
88
|
-
diagnostics: input.diagnostics ?? ["DOM/CSS overlays are diagnostic UI only and do not satisfy public cinematic scene evidence."]
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function validateRendererOwnedCinematicEvidence(
|
|
93
|
-
flags: readonly CinematicRendererEvidenceFlag[],
|
|
94
|
-
requiredFeatures: readonly CinematicEvidenceFeature[]
|
|
95
|
-
): CinematicRendererEvidenceValidation {
|
|
96
|
-
const rendererOwnedFeatures = unique(flags.filter((flag) => flag.rendererOwned && flag.satisfiesPublicCinematicGate).map((flag) => flag.feature));
|
|
97
|
-
const overlayOnlyFeatures = requiredFeatures.filter((feature) => {
|
|
98
|
-
const featureFlags = flags.filter((flag) => flag.feature === feature);
|
|
99
|
-
return featureFlags.length > 0 && featureFlags.every((flag) => flag.domOverlay || !flag.rendererOwned);
|
|
100
|
-
});
|
|
101
|
-
const missingRendererOwnedFeatures = requiredFeatures.filter((feature) => !rendererOwnedFeatures.includes(feature));
|
|
102
|
-
if (missingRendererOwnedFeatures.length > 0 || overlayOnlyFeatures.length > 0) {
|
|
103
|
-
return {
|
|
104
|
-
ok: false,
|
|
105
|
-
code: "AURA_CINEMATIC_DOM_OVERLAY_EVIDENCE_REJECTED",
|
|
106
|
-
missingRendererOwnedFeatures,
|
|
107
|
-
overlayOnlyFeatures,
|
|
108
|
-
diagnostics: [
|
|
109
|
-
"Required cinematic proof must come from renderer-owned scene, material, lighting, VFX, postprocess, camera, timeline, or blocking data.",
|
|
110
|
-
...overlayOnlyFeatures.map((feature) => `${feature} was represented only by DOM/CSS overlay evidence.`)
|
|
111
|
-
]
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
ok: true,
|
|
116
|
-
rendererOwnedFeatures,
|
|
117
|
-
diagnostics: ["All required cinematic evidence features are renderer-owned."]
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function unique<T>(values: readonly T[]): readonly T[] {
|
|
122
|
-
return [...new Set(values)];
|
|
123
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { EnvironmentLightingOptions } from "../ForwardPass";
|
|
2
|
-
import { createRendererOwnedEvidenceFlag, type CinematicRendererEvidenceFlag } from "./CinematicEvidence";
|
|
3
|
-
|
|
4
|
-
export type CinematicLightingRigId =
|
|
5
|
-
| "soft-key-fill-rim"
|
|
6
|
-
| "moody-alley"
|
|
7
|
-
| "studio-product"
|
|
8
|
-
| "warm-sunrise"
|
|
9
|
-
| "cool-moonlit";
|
|
10
|
-
|
|
11
|
-
export type CinematicLightRole = "key" | "fill" | "rim" | "practical" | "ambient";
|
|
12
|
-
export type CinematicLightType = "directional" | "point" | "spot" | "ambient";
|
|
13
|
-
|
|
14
|
-
export interface CinematicRuntimeLight {
|
|
15
|
-
readonly id: string;
|
|
16
|
-
readonly role: CinematicLightRole;
|
|
17
|
-
readonly type: CinematicLightType;
|
|
18
|
-
readonly color: readonly [number, number, number];
|
|
19
|
-
readonly intensity: number;
|
|
20
|
-
readonly position?: readonly [number, number, number];
|
|
21
|
-
readonly direction?: readonly [number, number, number];
|
|
22
|
-
readonly castsShadow: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface CinematicLightingRig {
|
|
26
|
-
readonly id: CinematicLightingRigId;
|
|
27
|
-
readonly label: string;
|
|
28
|
-
readonly exposure: number;
|
|
29
|
-
readonly toneMap: {
|
|
30
|
-
readonly operator: "filmic" | "aces" | "reinhard";
|
|
31
|
-
readonly whitePoint: number;
|
|
32
|
-
};
|
|
33
|
-
readonly environmentLighting: EnvironmentLightingOptions;
|
|
34
|
-
readonly lights: readonly CinematicRuntimeLight[];
|
|
35
|
-
readonly rendererOwnedEvidence: CinematicRendererEvidenceFlag;
|
|
36
|
-
readonly diagnostics: readonly string[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function createCinematicLightingRig(id: CinematicLightingRigId): CinematicLightingRig {
|
|
40
|
-
const rig = rigWithoutEvidence(id);
|
|
41
|
-
return {
|
|
42
|
-
...rig,
|
|
43
|
-
rendererOwnedEvidence: createRendererOwnedEvidenceFlag({
|
|
44
|
-
id: `lighting:${id}`,
|
|
45
|
-
feature: "lighting",
|
|
46
|
-
label: rig.label,
|
|
47
|
-
source: "renderer-light",
|
|
48
|
-
diagnostics: rig.diagnostics
|
|
49
|
-
})
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function listCinematicLightingRigs(): readonly CinematicLightingRig[] {
|
|
54
|
-
const ids: readonly CinematicLightingRigId[] = ["soft-key-fill-rim", "moody-alley", "studio-product", "warm-sunrise", "cool-moonlit"];
|
|
55
|
-
return ids.map(createCinematicLightingRig);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function selectCinematicLightingRig(tags: readonly string[]): CinematicLightingRigId {
|
|
59
|
-
const lower = tags.map((tag) => tag.toLowerCase());
|
|
60
|
-
if (lower.some((tag) => tag.includes("alley") || tag.includes("neon") || tag.includes("rain"))) return "moody-alley";
|
|
61
|
-
if (lower.some((tag) => tag.includes("studio") || tag.includes("product"))) return "studio-product";
|
|
62
|
-
if (lower.some((tag) => tag.includes("sunrise") || tag.includes("warm") || tag.includes("golden"))) return "warm-sunrise";
|
|
63
|
-
if (lower.some((tag) => tag.includes("moon") || tag.includes("night") || tag.includes("cool"))) return "cool-moonlit";
|
|
64
|
-
return "soft-key-fill-rim";
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function rigWithoutEvidence(id: CinematicLightingRigId): Omit<CinematicLightingRig, "rendererOwnedEvidence"> {
|
|
68
|
-
switch (id) {
|
|
69
|
-
case "moody-alley":
|
|
70
|
-
return makeRig(id, "Moody alley", 1.24, [0.035, 0.045, 0.07], 0.34, [
|
|
71
|
-
light("alley-key", "key", "spot", [0.42, 0.58, 1], 2.2, [-2.4, 3.6, 2.2], [0.45, -0.72, -0.52], true),
|
|
72
|
-
light("alley-rim", "rim", "point", [0.04, 0.86, 1], 3.4, [1.8, 1.2, -1.4], undefined, true),
|
|
73
|
-
light("alley-practical-neon", "practical", "point", [1, 0.08, 0.62], 2.8, [-1.6, 1.7, -2.1], undefined, false)
|
|
74
|
-
], ["Moody alley rig includes key, rim, and practical light metadata compiled for the renderer."]);
|
|
75
|
-
case "studio-product":
|
|
76
|
-
return makeRig(id, "Studio product", 1.08, [0.78, 0.8, 0.84], 0.54, [
|
|
77
|
-
light("studio-key", "key", "directional", [1, 0.95, 0.88], 1.8, undefined, [0.4, -0.7, -0.58], true),
|
|
78
|
-
light("studio-fill", "fill", "directional", [0.62, 0.72, 1], 0.7, undefined, [-0.5, -0.35, -0.8], false),
|
|
79
|
-
light("studio-rim", "rim", "directional", [1, 1, 1], 0.9, undefined, [0.12, -0.2, 0.97], false)
|
|
80
|
-
], ["Studio product rig uses renderer light records, not CSS panel highlights."]);
|
|
81
|
-
case "warm-sunrise":
|
|
82
|
-
return makeRig(id, "Warm sunrise", 1.16, [0.9, 0.58, 0.32], 0.48, [
|
|
83
|
-
light("sunrise-key", "key", "directional", [1, 0.58, 0.28], 2.05, undefined, [0.62, -0.52, -0.58], true),
|
|
84
|
-
light("sunrise-fill", "fill", "ambient", [0.28, 0.36, 0.55], 0.32, undefined, undefined, false),
|
|
85
|
-
light("sunrise-rim", "rim", "directional", [1, 0.86, 0.52], 0.78, undefined, [-0.12, -0.28, 0.95], false)
|
|
86
|
-
], ["Warm sunrise is an analytic renderer lighting preset."]);
|
|
87
|
-
case "cool-moonlit":
|
|
88
|
-
return makeRig(id, "Cool moonlit", 1.32, [0.2, 0.28, 0.48], 0.38, [
|
|
89
|
-
light("moon-key", "key", "directional", [0.48, 0.62, 1], 1.35, undefined, [0.24, -0.62, -0.74], true),
|
|
90
|
-
light("moon-fill", "fill", "ambient", [0.08, 0.12, 0.2], 0.24, undefined, undefined, false),
|
|
91
|
-
light("moon-rim", "rim", "directional", [0.62, 0.86, 1], 0.92, undefined, [-0.22, -0.14, 0.96], false)
|
|
92
|
-
], ["Cool moonlit rig remains renderer-owned lighting evidence."]);
|
|
93
|
-
case "soft-key-fill-rim":
|
|
94
|
-
return makeRig(id, "Soft key fill rim", 1.12, [0.52, 0.58, 0.66], 0.45, [
|
|
95
|
-
light("soft-key", "key", "directional", [1, 0.92, 0.82], 1.55, undefined, [0.42, -0.62, -0.66], true),
|
|
96
|
-
light("soft-fill", "fill", "directional", [0.46, 0.58, 0.82], 0.46, undefined, [-0.46, -0.28, -0.84], false),
|
|
97
|
-
light("soft-rim", "rim", "directional", [0.7, 0.88, 1], 0.72, undefined, [0.08, -0.28, 0.96], false)
|
|
98
|
-
], ["Soft three-point rig supplies key/fill/rim renderer lights."]);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function makeRig(
|
|
103
|
-
id: CinematicLightingRigId,
|
|
104
|
-
label: string,
|
|
105
|
-
exposure: number,
|
|
106
|
-
color: readonly [number, number, number],
|
|
107
|
-
intensity: number,
|
|
108
|
-
lights: readonly CinematicRuntimeLight[],
|
|
109
|
-
diagnostics: readonly string[]
|
|
110
|
-
): Omit<CinematicLightingRig, "rendererOwnedEvidence"> {
|
|
111
|
-
return {
|
|
112
|
-
id,
|
|
113
|
-
label,
|
|
114
|
-
exposure,
|
|
115
|
-
toneMap: { operator: "filmic", whitePoint: id === "cool-moonlit" ? 1.05 : 1.22 },
|
|
116
|
-
environmentLighting: {
|
|
117
|
-
color,
|
|
118
|
-
intensity,
|
|
119
|
-
proceduralMap: {
|
|
120
|
-
skyColor: [color[0] * 0.9, color[1] * 0.95, Math.min(1, color[2] * 1.15)],
|
|
121
|
-
horizonColor: [Math.min(1, color[0] * 1.2), Math.min(1, color[1] * 1.1), color[2]],
|
|
122
|
-
groundColor: [0.04, 0.045, 0.05],
|
|
123
|
-
specularColor: [1, 0.95, 0.86],
|
|
124
|
-
intensity,
|
|
125
|
-
specularIntensity: Math.min(1, intensity + 0.28)
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
lights,
|
|
129
|
-
diagnostics
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function light(
|
|
134
|
-
id: string,
|
|
135
|
-
role: CinematicLightRole,
|
|
136
|
-
type: CinematicLightType,
|
|
137
|
-
color: readonly [number, number, number],
|
|
138
|
-
intensity: number,
|
|
139
|
-
position: readonly [number, number, number] | undefined,
|
|
140
|
-
direction: readonly [number, number, number] | undefined,
|
|
141
|
-
castsShadow: boolean
|
|
142
|
-
): CinematicRuntimeLight {
|
|
143
|
-
return { id, role, type, color, intensity, position, direction, castsShadow };
|
|
144
|
-
}
|