@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,1306 +0,0 @@
|
|
|
1
|
-
import { Geometry, type Bounds3 } from "./Geometry";
|
|
2
|
-
import { type EnvironmentLightingOptions, type RenderItem } from "./ForwardPass";
|
|
3
|
-
import { PBRMaterial, type PBRProceduralEnvironmentMapOptions } from "./PBRMaterial";
|
|
4
|
-
import { UnlitMaterial } from "./UnlitMaterial";
|
|
5
|
-
import { createExternalParityContactShadowPlan, type ExternalParityContactShadowPlan } from "./shadows/ContactShadows";
|
|
6
|
-
|
|
7
|
-
export type EnvironmentCapabilityId =
|
|
8
|
-
| "cubemap-renderer"
|
|
9
|
-
| "equirectangular-projection"
|
|
10
|
-
| "pmrem-generator"
|
|
11
|
-
| "atmospheric-scattering"
|
|
12
|
-
| "analytical-studio-box"
|
|
13
|
-
| "linear-fog"
|
|
14
|
-
| "exponential-fog"
|
|
15
|
-
| "rgbe-hdr-parser"
|
|
16
|
-
| "exr-parser"
|
|
17
|
-
| "cube-camera-reflections"
|
|
18
|
-
| "dynamic-ocean-plane"
|
|
19
|
-
| "procedural-sky-dome"
|
|
20
|
-
| "volumetric-weather-enclosure"
|
|
21
|
-
| "infinite-ground-grid"
|
|
22
|
-
| "indoor-studio-stage"
|
|
23
|
-
| "outdoor-nature-backdrop"
|
|
24
|
-
| "urban-city-shell"
|
|
25
|
-
| "industrial-warehouse-void"
|
|
26
|
-
| "deep-space-box"
|
|
27
|
-
| "clean-void-backdrop";
|
|
28
|
-
|
|
29
|
-
export type EnvironmentCapabilityStatus = "implemented" | "partial" | "helper" | "missing";
|
|
30
|
-
|
|
31
|
-
export interface EnvironmentCapability {
|
|
32
|
-
readonly id: EnvironmentCapabilityId;
|
|
33
|
-
readonly label: string;
|
|
34
|
-
readonly status: EnvironmentCapabilityStatus;
|
|
35
|
-
readonly reusable: boolean;
|
|
36
|
-
readonly evidence: readonly string[];
|
|
37
|
-
readonly gap: string;
|
|
38
|
-
readonly requiredForAcceptedClaim: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface EnvironmentCapabilityReport {
|
|
42
|
-
readonly requestedCount: number;
|
|
43
|
-
readonly implementedCount: number;
|
|
44
|
-
readonly partialCount: number;
|
|
45
|
-
readonly helperCount: number;
|
|
46
|
-
readonly missingCount: number;
|
|
47
|
-
readonly productionReadyCount: number;
|
|
48
|
-
readonly nonProductionReadyCount: number;
|
|
49
|
-
readonly productionReady: readonly EnvironmentCapabilityId[];
|
|
50
|
-
readonly backlog: readonly EnvironmentCapability[];
|
|
51
|
-
readonly capabilities: readonly EnvironmentCapability[];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type EnvironmentStagePresetId =
|
|
55
|
-
| "clean-void"
|
|
56
|
-
| "indoor-studio"
|
|
57
|
-
| "outdoor-nature"
|
|
58
|
-
| "urban-city"
|
|
59
|
-
| "industrial-warehouse"
|
|
60
|
-
| "deep-space";
|
|
61
|
-
export type EnvironmentStudioTone = "standard" | "premium-dark" | "product-premium";
|
|
62
|
-
export type EnvironmentContactGroundingMode = "auto" | "off" | "contact-shadow";
|
|
63
|
-
|
|
64
|
-
export type EnvironmentPresetType = EnvironmentStagePresetId | "studio" | "outdoor" | "city" | "warehouse" | "ocean" | "space";
|
|
65
|
-
export type EnvironmentPresetLighting = "softbox" | "sunset" | "overcast" | "night" | "neon" | "warehouse" | "space";
|
|
66
|
-
export type EnvironmentPresetBackground = "cubemap" | "equirect" | "sky" | "procedural" | "none";
|
|
67
|
-
export type EnvironmentPresetGround = "grid" | "shadow-catcher" | "reflective-floor" | "terrain" | "none";
|
|
68
|
-
export type EnvironmentFeatureRequest =
|
|
69
|
-
| "cubemap-background"
|
|
70
|
-
| "equirect-background"
|
|
71
|
-
| "reflective-floor"
|
|
72
|
-
| "terrain-heightfield"
|
|
73
|
-
| "rectangular-area-light"
|
|
74
|
-
| "cube-camera-reflection"
|
|
75
|
-
| "planar-reflection"
|
|
76
|
-
| "transmission-refraction"
|
|
77
|
-
| "linear-fog"
|
|
78
|
-
| "exponential-fog"
|
|
79
|
-
| "volumetric-fog"
|
|
80
|
-
| "fft-webgpu-water"
|
|
81
|
-
| "water-caustics"
|
|
82
|
-
| "underwater-volume";
|
|
83
|
-
|
|
84
|
-
export type EnvironmentFogMode = "linear" | "exponential" | "exponential-squared";
|
|
85
|
-
export type EnvironmentFogPresetId = "distant-haze" | "morning-mist" | "marine-layer" | "night-smog" | "warehouse-dust";
|
|
86
|
-
export type EnvironmentFogInput = EnvironmentFogPresetId | EnvironmentFogOptions | false;
|
|
87
|
-
|
|
88
|
-
export interface EnvironmentFogOptions {
|
|
89
|
-
readonly preset?: EnvironmentFogPresetId;
|
|
90
|
-
readonly mode?: EnvironmentFogMode;
|
|
91
|
-
readonly color?: Rgb;
|
|
92
|
-
readonly near?: number;
|
|
93
|
-
readonly far?: number;
|
|
94
|
-
readonly density?: number;
|
|
95
|
-
readonly heightFalloff?: number;
|
|
96
|
-
readonly heightReference?: number;
|
|
97
|
-
readonly maxOpacity?: number;
|
|
98
|
-
readonly sampleDistances?: readonly number[];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface EnvironmentFogUniforms {
|
|
102
|
-
readonly u_environmentFogEnabled: 1;
|
|
103
|
-
readonly u_environmentFogMode: 1 | 2 | 3;
|
|
104
|
-
readonly u_environmentFogColor: Rgb;
|
|
105
|
-
readonly u_environmentFogNear: number;
|
|
106
|
-
readonly u_environmentFogFar: number;
|
|
107
|
-
readonly u_environmentFogDensity: number;
|
|
108
|
-
readonly u_environmentFogHeightFalloff: number;
|
|
109
|
-
readonly u_environmentFogHeightReference: number;
|
|
110
|
-
readonly u_environmentFogMaxOpacity: number;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface EnvironmentFogTelemetry {
|
|
114
|
-
readonly mode: EnvironmentFogMode;
|
|
115
|
-
readonly preset: EnvironmentFogPresetId;
|
|
116
|
-
readonly capabilityIds: readonly EnvironmentCapabilityId[];
|
|
117
|
-
readonly sampleDistances: readonly number[];
|
|
118
|
-
readonly sampleFactors: readonly number[];
|
|
119
|
-
readonly monotonicDistanceResponse: boolean;
|
|
120
|
-
readonly uniformKeys: readonly string[];
|
|
121
|
-
readonly claimBoundary: string;
|
|
122
|
-
readonly limitations: readonly string[];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface EnvironmentFogProfile {
|
|
126
|
-
readonly preset: EnvironmentFogPresetId;
|
|
127
|
-
readonly mode: EnvironmentFogMode;
|
|
128
|
-
readonly color: Rgb;
|
|
129
|
-
readonly near: number;
|
|
130
|
-
readonly far: number;
|
|
131
|
-
readonly density: number;
|
|
132
|
-
readonly heightFalloff: number;
|
|
133
|
-
readonly heightReference: number;
|
|
134
|
-
readonly maxOpacity: number;
|
|
135
|
-
readonly capabilityIds: readonly EnvironmentCapabilityId[];
|
|
136
|
-
readonly uniforms: EnvironmentFogUniforms;
|
|
137
|
-
readonly telemetry: EnvironmentFogTelemetry;
|
|
138
|
-
readonly limitations: readonly string[];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface EnvironmentStageOptions {
|
|
142
|
-
readonly preset?: EnvironmentStagePresetId;
|
|
143
|
-
readonly size?: number;
|
|
144
|
-
readonly floorY?: number;
|
|
145
|
-
readonly gridDivisions?: number;
|
|
146
|
-
readonly timeSeconds?: number;
|
|
147
|
-
readonly studioTone?: EnvironmentStudioTone;
|
|
148
|
-
readonly includeSkyDome?: boolean;
|
|
149
|
-
readonly includeStageShell?: boolean;
|
|
150
|
-
readonly includeGroundGrid?: boolean;
|
|
151
|
-
readonly includeStageAccents?: boolean;
|
|
152
|
-
readonly contactGrounding?: EnvironmentContactGroundingMode | EnvironmentContactGroundingOptions;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface EnvironmentContactGroundingOptions {
|
|
156
|
-
readonly mode?: EnvironmentContactGroundingMode;
|
|
157
|
-
readonly casterRadius?: number;
|
|
158
|
-
readonly receiverDistance?: number;
|
|
159
|
-
readonly softness?: number;
|
|
160
|
-
readonly opacity?: number;
|
|
161
|
-
readonly layerCount?: number;
|
|
162
|
-
readonly anisotropy?: number;
|
|
163
|
-
readonly yOffset?: number;
|
|
164
|
-
readonly label?: string;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface EnvironmentContactGrounding {
|
|
168
|
-
readonly mode: "contact-shadow";
|
|
169
|
-
readonly plan: ExternalParityContactShadowPlan;
|
|
170
|
-
readonly items: readonly RenderItem[];
|
|
171
|
-
readonly receiverLabel: string;
|
|
172
|
-
readonly limitations: readonly string[];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface EnvironmentStage {
|
|
176
|
-
readonly preset: EnvironmentStagePresetId;
|
|
177
|
-
readonly items: readonly RenderItem[];
|
|
178
|
-
readonly bounds: Bounds3;
|
|
179
|
-
readonly lighting: EnvironmentLightingOptions;
|
|
180
|
-
readonly systems: readonly string[];
|
|
181
|
-
readonly capabilityIds: readonly EnvironmentCapabilityId[];
|
|
182
|
-
readonly limitations: readonly string[];
|
|
183
|
-
readonly contactGrounding?: EnvironmentContactGrounding;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export interface EnvironmentPresetOptions extends Omit<EnvironmentStageOptions, "preset" | "includeSkyDome" | "includeGroundGrid"> {
|
|
187
|
-
readonly type?: EnvironmentPresetType;
|
|
188
|
-
readonly lighting?: EnvironmentPresetLighting;
|
|
189
|
-
readonly background?: EnvironmentPresetBackground;
|
|
190
|
-
readonly ground?: EnvironmentPresetGround;
|
|
191
|
-
readonly fog?: EnvironmentFogInput;
|
|
192
|
-
readonly requestedFeatures?: readonly EnvironmentFeatureRequest[];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface EnvironmentUnsupportedRequestDisclosure {
|
|
196
|
-
readonly request: EnvironmentFeatureRequest;
|
|
197
|
-
readonly supported: false;
|
|
198
|
-
readonly capabilityIds: readonly EnvironmentCapabilityId[];
|
|
199
|
-
readonly fallback: string;
|
|
200
|
-
readonly disclosure: string;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface EnvironmentUnsupportedRequestDisclosureOptions {
|
|
204
|
-
readonly type?: EnvironmentPresetType;
|
|
205
|
-
readonly lighting?: EnvironmentPresetLighting;
|
|
206
|
-
readonly background?: EnvironmentPresetBackground;
|
|
207
|
-
readonly ground?: EnvironmentPresetGround;
|
|
208
|
-
readonly fog?: EnvironmentFogInput | EnvironmentFogProfile;
|
|
209
|
-
readonly requestedFeatures?: readonly EnvironmentFeatureRequest[];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export interface EnvironmentPreset extends EnvironmentStage {
|
|
213
|
-
readonly type: EnvironmentPresetType;
|
|
214
|
-
readonly lightingPreset: EnvironmentPresetLighting;
|
|
215
|
-
readonly background: EnvironmentPresetBackground;
|
|
216
|
-
readonly ground: EnvironmentPresetGround;
|
|
217
|
-
readonly fog?: EnvironmentFogProfile;
|
|
218
|
-
readonly unsupportedRequests: readonly string[];
|
|
219
|
-
readonly unsupportedRequestDetails: readonly EnvironmentUnsupportedRequestDisclosure[];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
type Rgb = readonly [number, number, number];
|
|
223
|
-
type Rgba = readonly [number, number, number, number];
|
|
224
|
-
type Vec3 = readonly [number, number, number];
|
|
225
|
-
|
|
226
|
-
const ENVIRONMENT_CAPABILITIES: readonly EnvironmentCapability[] = [
|
|
227
|
-
capability("cubemap-renderer", "Cubemap Renderer", "partial", true, [
|
|
228
|
-
"Texture supports six cube faces.",
|
|
229
|
-
"WebGL2Device binds cubemap faces.",
|
|
230
|
-
"Production environment lighting resources create PMREM cube textures.",
|
|
231
|
-
"Renderer schedules EnvironmentBackgroundPass for camera-correct cubemap backgrounds."
|
|
232
|
-
], "Renderer cubemap background path exists, but no accepted gallery route/screenshot proves six-face visual sampling yet.", "Add visible six-face skybox/background rendering and screenshot gates."),
|
|
233
|
-
capability("equirectangular-projection", "Equirectangular Projection Engine", "partial", true, [
|
|
234
|
-
"PBR shader includes equirectangular UV sampling.",
|
|
235
|
-
"PMREM generator projects equirectangular HDR into cube faces.",
|
|
236
|
-
"Renderer schedules EnvironmentBackgroundPass for camera-correct equirect panorama backgrounds."
|
|
237
|
-
], "Renderer equirect background path exists, but no accepted gallery route/screenshot proves panorama background rendering yet.", "Add equirect panorama background rendering and route proof."),
|
|
238
|
-
capability("pmrem-generator", "PMREM Generator", "partial", true, [
|
|
239
|
-
"generateCubemapPMREMResources creates GGX-prefiltered cubemap mip levels.",
|
|
240
|
-
"createCubemapPMREMShaderContract documents sampler-cube material bindings."
|
|
241
|
-
], "Current PMREM audit is explicitly bounded and not Three.js parity.", "Prove material roughness response against stable HDR route screenshots."),
|
|
242
|
-
capability("atmospheric-scattering", "Atmospheric Scattering Shader", "missing", false, [], "No reusable Rayleigh/Mie sky shader is exposed.", "Implement physical sky shader or keep scattering out of accepted claims."),
|
|
243
|
-
capability("analytical-studio-box", "Analytical Studio Box", "helper", true, [
|
|
244
|
-
"createEnvironmentStage(\"indoor-studio\") returns reusable softbox panels and cove geometry."
|
|
245
|
-
], "Studio helper is procedural geometry, not an infinite analytical lighting renderer.", "Connect reusable stage helper to accepted product/material routes and visual tests."),
|
|
246
|
-
capability("linear-fog", "Linear Fog System", "partial", true, [
|
|
247
|
-
"createEnvironmentFogProfile emits uniform-ready linear fog settings.",
|
|
248
|
-
"sampleEnvironmentFogFactor provides deterministic CPU reference attenuation for validation.",
|
|
249
|
-
"Renderer and ForwardPass bind linear fog uniforms into active PBR-family shader paths."
|
|
250
|
-
], "Renderer shader path exists, but no accepted gallery route/screenshot proves object/background blending yet.", "Add visual gates before claiming Three.js Fog parity."),
|
|
251
|
-
capability("exponential-fog", "Exponential Fog System", "partial", true, [
|
|
252
|
-
"createEnvironmentFogProfile emits uniform-ready exponential and exponential-squared fog settings.",
|
|
253
|
-
"Fog telemetry records distance sample factors and uniform keys for route evidence.",
|
|
254
|
-
"Renderer and ForwardPass bind exponential fog uniforms into active PBR-family shader paths."
|
|
255
|
-
], "Renderer shader path exists, but no accepted gallery route/screenshot proves FogExp2-style blending yet.", "Add visual gates before claiming FogExp2 parity."),
|
|
256
|
-
capability("rgbe-hdr-parser", "RGBE HDR Parser", "partial", true, [
|
|
257
|
-
"parseProductionRadianceHDR decodes Radiance/RGBE RLE buffers.",
|
|
258
|
-
"decodeRgbeEnvironmentMap converts RGBE pixels to linear HDR data."
|
|
259
|
-
], "Public HDRLoaderThreeCompat remains diagnostic-only.", "Expose an end-to-end public HDR file-to-environment loader path."),
|
|
260
|
-
capability("exr-parser", "EXR Parser", "missing", false, [], "EXRLoaderThreeCompat is diagnostic-only and does not decode OpenEXR pixels.", "Implement real EXR decode or document EXR as unsupported."),
|
|
261
|
-
capability("cube-camera-reflections", "Cube Camera Reflections", "missing", false, [], "ReflectionProbe is a descriptor helper; live six-direction capture is not implemented.", "Implement cube camera/probe capture and reflective material binding."),
|
|
262
|
-
capability("dynamic-ocean-plane", "Dynamic Ocean Plane", "helper", true, [
|
|
263
|
-
"OceanFixtures and waterSystems provide Gerstner/procedural water telemetry.",
|
|
264
|
-
"Gallery routes can build dynamic water meshes from reusable samples."
|
|
265
|
-
], "No FFT/WebGPU ocean, planar reflection/refraction, caustics, or underwater volume renderer is accepted.", "Promote water helper to renderer subsystem or keep claims scoped to CPU/Gerstner water."),
|
|
266
|
-
capability("procedural-sky-dome", "Procedural Sky Dome", "helper", true, [
|
|
267
|
-
"createEnvironmentStage can emit an infinite-ish sky dome item and procedural environment lighting."
|
|
268
|
-
], "The helper is color-gradient geometry, not physical sun/atmosphere scattering.", "Add sun/moon/day-night controls and shader-backed sky model before parity claims."),
|
|
269
|
-
capability("volumetric-weather-enclosure", "Volumetric Weather Enclosure", "helper", true, [
|
|
270
|
-
"Weather and gallery fog helpers expose deterministic mist/dust/particle telemetry."
|
|
271
|
-
], "No volumetric cloud, participating-media, or native god-ray pass is implemented.", "Implement volumetric/layered weather or keep route claims bounded."),
|
|
272
|
-
capability("infinite-ground-grid", "Infinite Ground Grid", "helper", true, [
|
|
273
|
-
"createInfiniteGroundGrid returns reusable line geometry and material."
|
|
274
|
-
], "Grid is finite helper geometry, not a renderer-level infinite grid with shadow catch.", "Add fade/shadow/catch-plane controls and route evidence."),
|
|
275
|
-
capability("indoor-studio-stage", "Indoor Studio Stage", "helper", true, [
|
|
276
|
-
"createEnvironmentStage(\"indoor-studio\") creates reusable cove, floor, wall, and softbox items."
|
|
277
|
-
], "Stage does not yet provide physically accurate area-light shading.", "Use as shared product/material route stage and document area-light limits."),
|
|
278
|
-
capability("outdoor-nature-backdrop", "Outdoor Nature Backdrop", "helper", true, [
|
|
279
|
-
"createEnvironmentStage(\"outdoor-nature\") creates reusable sky, ground, horizon, and ambient palette."
|
|
280
|
-
], "No terrain streaming, vegetation lighting, or physical atmosphere is accepted.", "Add route proof and keep outdoor claims bounded to backdrop/lighting."),
|
|
281
|
-
capability("urban-city-shell", "Urban City Shell", "helper", true, [
|
|
282
|
-
"createEnvironmentStage(\"urban-city\") creates reusable neon shell panels and lighting colors."
|
|
283
|
-
], "This is a reusable shell, not a city renderer or instancing proof.", "Use with Smart City/data routes while keeping scale claims separate."),
|
|
284
|
-
capability("industrial-warehouse-void", "Industrial Warehouse Void", "helper", true, [
|
|
285
|
-
"createEnvironmentStage(\"industrial-warehouse\") creates reusable overhead bulbs, concrete floor, window strips, and rails."
|
|
286
|
-
], "No GI, physical area lights, or warehouse asset library is accepted.", "Use as shared robotics/physics/digital-twin environment shell."),
|
|
287
|
-
capability("deep-space-box", "Deep Space Box", "helper", true, [
|
|
288
|
-
"createEnvironmentStage(\"deep-space\") creates reusable starfield shell points and sky dome."
|
|
289
|
-
], "Not volumetric nebula or HDR skybox lighting parity.", "Add cubemap/HDR background integration before accepted deep-space claims."),
|
|
290
|
-
capability("clean-void-backdrop", "Clean Void Backdrop", "helper", true, [
|
|
291
|
-
"createEnvironmentStage(\"clean-void\") creates reusable infinity-wall-style floor and backdrop."
|
|
292
|
-
], "Clean void still needs shared shadow/reflection controls for product-grade use.", "Use as fallback stage with explicit limitations.")
|
|
293
|
-
];
|
|
294
|
-
|
|
295
|
-
export function listEnvironmentCapabilities(): readonly EnvironmentCapability[] {
|
|
296
|
-
return ENVIRONMENT_CAPABILITIES.map((item) => ({ ...item, evidence: [...item.evidence] }));
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export function createEnvironmentCapabilityReport(): EnvironmentCapabilityReport {
|
|
300
|
-
const capabilities = listEnvironmentCapabilities();
|
|
301
|
-
const productionReady = capabilities.filter((item) => item.status === "implemented").map((item) => item.id);
|
|
302
|
-
const backlog = capabilities.filter((item) => item.status !== "implemented");
|
|
303
|
-
return {
|
|
304
|
-
requestedCount: capabilities.length,
|
|
305
|
-
implementedCount: capabilities.filter((item) => item.status === "implemented").length,
|
|
306
|
-
partialCount: capabilities.filter((item) => item.status === "partial").length,
|
|
307
|
-
helperCount: capabilities.filter((item) => item.status === "helper").length,
|
|
308
|
-
missingCount: capabilities.filter((item) => item.status === "missing").length,
|
|
309
|
-
productionReadyCount: productionReady.length,
|
|
310
|
-
nonProductionReadyCount: backlog.length,
|
|
311
|
-
productionReady,
|
|
312
|
-
backlog,
|
|
313
|
-
capabilities
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
export function createInfiniteGroundGrid(options: {
|
|
318
|
-
readonly size?: number;
|
|
319
|
-
readonly divisions?: number;
|
|
320
|
-
readonly y?: number;
|
|
321
|
-
readonly color?: Rgba;
|
|
322
|
-
readonly label?: string;
|
|
323
|
-
} = {}): RenderItem {
|
|
324
|
-
const size = positive(options.size ?? 24, "grid size");
|
|
325
|
-
const divisions = integerInRange(options.divisions ?? 24, 2, 512, "grid divisions");
|
|
326
|
-
const y = finite(options.y ?? 0, "grid y");
|
|
327
|
-
const half = size / 2;
|
|
328
|
-
const positions: Vec3[] = [];
|
|
329
|
-
for (let i = 0; i <= divisions; i += 1) {
|
|
330
|
-
const offset = -half + (i / divisions) * size;
|
|
331
|
-
positions.push([-half, y, offset], [half, y, offset], [offset, y, -half], [offset, y, half]);
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
geometry: Geometry.lineSegments(positions),
|
|
335
|
-
material: new UnlitMaterial({
|
|
336
|
-
name: options.label ?? "environment infinite ground grid",
|
|
337
|
-
color: options.color ?? [0.28, 0.42, 0.48, 0.42],
|
|
338
|
-
renderState: { blend: true, depthWrite: false }
|
|
339
|
-
}),
|
|
340
|
-
includeInAutoFrame: false,
|
|
341
|
-
label: options.label ?? "environment infinite ground grid"
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
export function createProceduralSkyDome(options: {
|
|
346
|
-
readonly preset?: EnvironmentStagePresetId;
|
|
347
|
-
readonly radius?: number;
|
|
348
|
-
readonly color?: Rgba;
|
|
349
|
-
readonly y?: number;
|
|
350
|
-
readonly label?: string;
|
|
351
|
-
} = {}): RenderItem {
|
|
352
|
-
const preset = options.preset ?? "clean-void";
|
|
353
|
-
const palette = stagePalette(preset);
|
|
354
|
-
return {
|
|
355
|
-
geometry: Geometry.uvSphere(positive(options.radius ?? 42, "sky dome radius"), 48, 24),
|
|
356
|
-
material: new UnlitMaterial({
|
|
357
|
-
name: options.label ?? `${preset} procedural sky dome`,
|
|
358
|
-
color: options.color ?? [...palette.sky, 1],
|
|
359
|
-
renderState: { depthWrite: false, cullMode: "front" }
|
|
360
|
-
}),
|
|
361
|
-
modelMatrix: translation([0, finite(options.y ?? 0, "sky dome y"), 0]),
|
|
362
|
-
includeInAutoFrame: false,
|
|
363
|
-
label: options.label ?? `${preset} procedural sky dome`
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
export function createEnvironmentStage(options: EnvironmentStageOptions = {}): EnvironmentStage {
|
|
368
|
-
const preset = options.preset ?? "clean-void";
|
|
369
|
-
const size = positive(options.size ?? 12, "stage size");
|
|
370
|
-
const floorY = finite(options.floorY ?? 0, "stage floorY");
|
|
371
|
-
const studioTone = options.studioTone ?? "standard";
|
|
372
|
-
const palette = stagePalette(preset, studioTone);
|
|
373
|
-
const items: RenderItem[] = [];
|
|
374
|
-
const includeStageShell = options.includeStageShell !== false;
|
|
375
|
-
const includeGroundGrid = options.includeGroundGrid !== false;
|
|
376
|
-
const includeStageAccents = options.includeStageAccents !== false;
|
|
377
|
-
const contactGrounding = createStageContactGrounding(preset, size, floorY, studioTone, options.contactGrounding);
|
|
378
|
-
|
|
379
|
-
if (options.includeSkyDome !== false) {
|
|
380
|
-
items.push(createProceduralSkyDome({ preset, radius: size * 3.5, color: [...palette.sky, 1], y: floorY }));
|
|
381
|
-
}
|
|
382
|
-
if (includeStageShell) {
|
|
383
|
-
items.push(...createStageShell(preset, size, palette, floorY, studioTone));
|
|
384
|
-
}
|
|
385
|
-
if (includeGroundGrid) {
|
|
386
|
-
items.push(createInfiniteGroundGrid({
|
|
387
|
-
size: size * 1.8,
|
|
388
|
-
divisions: options.gridDivisions ?? 18,
|
|
389
|
-
y: floorY - 0.004,
|
|
390
|
-
color: [...palette.grid, 0.46],
|
|
391
|
-
label: `${preset} ground grid`
|
|
392
|
-
}));
|
|
393
|
-
}
|
|
394
|
-
if (contactGrounding) {
|
|
395
|
-
items.push(...contactGrounding.items);
|
|
396
|
-
}
|
|
397
|
-
if (includeStageAccents) {
|
|
398
|
-
items.push(...createStageAccents(preset, size, palette, finite(options.timeSeconds ?? 0, "timeSeconds"), floorY, studioTone));
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return {
|
|
402
|
-
preset,
|
|
403
|
-
items,
|
|
404
|
-
bounds: {
|
|
405
|
-
min: [-size, floorY - 0.08, -size],
|
|
406
|
-
max: [size, floorY + size * 0.74, size]
|
|
407
|
-
},
|
|
408
|
-
lighting: createStageLighting(preset, palette),
|
|
409
|
-
systems: [
|
|
410
|
-
includeStageShell ? "environment stage shell" : "environment stage shell disabled",
|
|
411
|
-
"procedural sky/backdrop",
|
|
412
|
-
includeGroundGrid ? "ground grid/catch plane" : "ground grid disabled",
|
|
413
|
-
...(contactGrounding ? ["contact grounding helper"] : []),
|
|
414
|
-
"preset environment lighting",
|
|
415
|
-
includeStageAccents ? "stage accent panels" : "stage accent panels disabled"
|
|
416
|
-
],
|
|
417
|
-
capabilityIds: stageCapabilities(preset),
|
|
418
|
-
limitations: [
|
|
419
|
-
...stageLimitations(preset),
|
|
420
|
-
...(contactGrounding ? contactGrounding.limitations : []),
|
|
421
|
-
...(includeStageShell ? [] : ["Physical stage shell is disabled for this environment stage; it proves reusable backdrop/lighting behavior, not floor, wall, or catch-plane rendering."]),
|
|
422
|
-
...(includeGroundGrid ? [] : ["Ground grid/catch-plane rendering is disabled for this environment stage."]),
|
|
423
|
-
...(includeStageAccents ? [] : ["Stage accent panel rendering is disabled for this environment stage."])
|
|
424
|
-
],
|
|
425
|
-
...(contactGrounding ? { contactGrounding } : {})
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export function createEnvironmentFogProfile(options: EnvironmentFogPresetId | EnvironmentFogOptions = {}): EnvironmentFogProfile {
|
|
430
|
-
const requestedPreset = typeof options === "string" ? options : options.preset;
|
|
431
|
-
const preset = requestedPreset ?? "distant-haze";
|
|
432
|
-
const defaults = fogPresetDefaults(preset);
|
|
433
|
-
const overrides = typeof options === "string" ? {} : options;
|
|
434
|
-
const mode = overrides.mode ?? defaults.mode;
|
|
435
|
-
const color = rgb(overrides.color ?? defaults.color, "fog color");
|
|
436
|
-
const near = finite(overrides.near ?? defaults.near, "fog near");
|
|
437
|
-
const far = finite(overrides.far ?? defaults.far, "fog far");
|
|
438
|
-
if (far <= near) throw new RangeError("Environment platform fog far must be greater than fog near.");
|
|
439
|
-
const density = nonNegative(overrides.density ?? defaults.density, "fog density");
|
|
440
|
-
const heightFalloff = nonNegative(overrides.heightFalloff ?? defaults.heightFalloff, "fog heightFalloff");
|
|
441
|
-
const heightReference = finite(overrides.heightReference ?? defaults.heightReference, "fog heightReference");
|
|
442
|
-
const maxOpacity = unit(overrides.maxOpacity ?? defaults.maxOpacity, "fog maxOpacity");
|
|
443
|
-
const capabilityIds = fogCapabilities(mode);
|
|
444
|
-
const uniforms: EnvironmentFogUniforms = {
|
|
445
|
-
u_environmentFogEnabled: 1,
|
|
446
|
-
u_environmentFogMode: fogModeUniform(mode),
|
|
447
|
-
u_environmentFogColor: color,
|
|
448
|
-
u_environmentFogNear: round3(near),
|
|
449
|
-
u_environmentFogFar: round3(far),
|
|
450
|
-
u_environmentFogDensity: round5(density),
|
|
451
|
-
u_environmentFogHeightFalloff: round5(heightFalloff),
|
|
452
|
-
u_environmentFogHeightReference: round3(heightReference),
|
|
453
|
-
u_environmentFogMaxOpacity: round3(maxOpacity)
|
|
454
|
-
};
|
|
455
|
-
const limitations = [
|
|
456
|
-
"Environment fog profiles are reusable uniform payloads and CPU reference math, not proof that every renderer shader path applies fog.",
|
|
457
|
-
"Volumetric fog, participating media, god rays, cloud scattering, and water caustic/refraction effects remain unsupported."
|
|
458
|
-
];
|
|
459
|
-
const profileBase = {
|
|
460
|
-
preset,
|
|
461
|
-
mode,
|
|
462
|
-
color,
|
|
463
|
-
near,
|
|
464
|
-
far,
|
|
465
|
-
density,
|
|
466
|
-
heightFalloff,
|
|
467
|
-
heightReference,
|
|
468
|
-
maxOpacity,
|
|
469
|
-
capabilityIds,
|
|
470
|
-
uniforms,
|
|
471
|
-
limitations
|
|
472
|
-
};
|
|
473
|
-
const sampleDistances = sanitizeFogSampleDistances(overrides.sampleDistances ?? defaultFogSampleDistances(near, far));
|
|
474
|
-
const sampleFactors = sampleDistances.map((distance) => sampleEnvironmentFogFactor(profileBase, distance));
|
|
475
|
-
return {
|
|
476
|
-
...profileBase,
|
|
477
|
-
telemetry: {
|
|
478
|
-
mode,
|
|
479
|
-
preset,
|
|
480
|
-
capabilityIds,
|
|
481
|
-
sampleDistances,
|
|
482
|
-
sampleFactors,
|
|
483
|
-
monotonicDistanceResponse: sampleFactors.every((value, index) => index === 0 || value >= sampleFactors[index - 1]!),
|
|
484
|
-
uniformKeys: Object.keys(uniforms),
|
|
485
|
-
claimBoundary: "Uniform-ready A3D environment fog helper with deterministic CPU attenuation samples; not an accepted volumetric fog, atmospheric scattering, or Three.js Fog/FogExp2 parity claim.",
|
|
486
|
-
limitations
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
export function sampleEnvironmentFogFactor(
|
|
492
|
-
fog: Pick<EnvironmentFogProfile, "mode" | "near" | "far" | "density" | "heightFalloff" | "heightReference" | "maxOpacity">,
|
|
493
|
-
distance: number,
|
|
494
|
-
worldY = fog.heightReference
|
|
495
|
-
): number {
|
|
496
|
-
const d = Math.max(0, finite(distance, "fog sample distance"));
|
|
497
|
-
const height = finite(worldY, "fog sample height");
|
|
498
|
-
let factor = 0;
|
|
499
|
-
if (fog.mode === "linear") {
|
|
500
|
-
factor = (d - fog.near) / Math.max(0.000001, fog.far - fog.near);
|
|
501
|
-
} else if (fog.mode === "exponential") {
|
|
502
|
-
factor = 1 - Math.exp(-fog.density * d);
|
|
503
|
-
} else {
|
|
504
|
-
const scaled = fog.density * d;
|
|
505
|
-
factor = 1 - Math.exp(-(scaled * scaled));
|
|
506
|
-
}
|
|
507
|
-
const heightMultiplier = fog.heightFalloff > 0
|
|
508
|
-
? Math.exp(-Math.max(0, height - fog.heightReference) * fog.heightFalloff)
|
|
509
|
-
: 1;
|
|
510
|
-
return round5(clamp(factor * heightMultiplier, 0, 1) * fog.maxOpacity);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
export function applyEnvironmentFogToColor(
|
|
514
|
-
color: Rgb,
|
|
515
|
-
fog: EnvironmentFogProfile,
|
|
516
|
-
distance: number,
|
|
517
|
-
worldY = fog.heightReference
|
|
518
|
-
): Rgb {
|
|
519
|
-
const source = rgb(color, "source color");
|
|
520
|
-
const factor = sampleEnvironmentFogFactor(fog, distance, worldY);
|
|
521
|
-
return [
|
|
522
|
-
round5(source[0] + (fog.color[0] - source[0]) * factor),
|
|
523
|
-
round5(source[1] + (fog.color[1] - source[1]) * factor),
|
|
524
|
-
round5(source[2] + (fog.color[2] - source[2]) * factor)
|
|
525
|
-
];
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
export function createEnvironmentPreset(options: EnvironmentPresetOptions = {}): EnvironmentPreset {
|
|
529
|
-
const type = options.type ?? "clean-void";
|
|
530
|
-
const background = options.background ?? "procedural";
|
|
531
|
-
const ground = options.ground ?? "grid";
|
|
532
|
-
const lightingPreset = options.lighting ?? defaultLightingForType(type);
|
|
533
|
-
const preset = stagePresetForType(type);
|
|
534
|
-
const fog = resolveEnvironmentFog(options.fog, type);
|
|
535
|
-
const stage = createEnvironmentStage({
|
|
536
|
-
size: options.size,
|
|
537
|
-
gridDivisions: options.gridDivisions,
|
|
538
|
-
timeSeconds: options.timeSeconds,
|
|
539
|
-
preset,
|
|
540
|
-
includeSkyDome: background !== "none",
|
|
541
|
-
includeStageShell: options.includeStageShell,
|
|
542
|
-
includeGroundGrid: ground === "grid"
|
|
543
|
-
});
|
|
544
|
-
const unsupportedRequestDetails = createEnvironmentUnsupportedRequestDisclosures({
|
|
545
|
-
type,
|
|
546
|
-
lighting: lightingPreset,
|
|
547
|
-
background,
|
|
548
|
-
ground,
|
|
549
|
-
fog,
|
|
550
|
-
requestedFeatures: options.requestedFeatures
|
|
551
|
-
});
|
|
552
|
-
const unsupportedRequests = unsupportedRequestDetails.map((request) => request.disclosure);
|
|
553
|
-
return {
|
|
554
|
-
...stage,
|
|
555
|
-
type,
|
|
556
|
-
lightingPreset,
|
|
557
|
-
background,
|
|
558
|
-
ground,
|
|
559
|
-
capabilityIds: uniqueCapabilities([
|
|
560
|
-
...stage.capabilityIds,
|
|
561
|
-
...backgroundCapabilities(background),
|
|
562
|
-
...groundCapabilities(ground),
|
|
563
|
-
...(fog ? fog.capabilityIds : []),
|
|
564
|
-
...unsupportedRequestDetails.flatMap((request) => request.capabilityIds),
|
|
565
|
-
...(type === "ocean" ? ["dynamic-ocean-plane" as const] : [])
|
|
566
|
-
]),
|
|
567
|
-
systems: fog ? [...stage.systems, "environment fog profile"] : stage.systems,
|
|
568
|
-
limitations: [
|
|
569
|
-
...stage.limitations,
|
|
570
|
-
...(fog ? fog.limitations : []),
|
|
571
|
-
...unsupportedRequests
|
|
572
|
-
],
|
|
573
|
-
...(fog ? { fog } : {}),
|
|
574
|
-
unsupportedRequests,
|
|
575
|
-
unsupportedRequestDetails
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
export function createEnvironmentUnsupportedRequestDisclosures(
|
|
580
|
-
options: EnvironmentUnsupportedRequestDisclosureOptions = {}
|
|
581
|
-
): readonly EnvironmentUnsupportedRequestDisclosure[] {
|
|
582
|
-
const type = options.type ?? "clean-void";
|
|
583
|
-
const background = options.background ?? "procedural";
|
|
584
|
-
const ground = options.ground ?? "grid";
|
|
585
|
-
const lighting = options.lighting ?? defaultLightingForType(type);
|
|
586
|
-
const fog = resolveEnvironmentFog(options.fog, type);
|
|
587
|
-
const requested = new Set<EnvironmentFeatureRequest>(options.requestedFeatures ?? []);
|
|
588
|
-
|
|
589
|
-
if (background === "cubemap") requested.add("cubemap-background");
|
|
590
|
-
if (background === "equirect") requested.add("equirect-background");
|
|
591
|
-
if (ground === "reflective-floor") {
|
|
592
|
-
requested.add("reflective-floor");
|
|
593
|
-
requested.add("planar-reflection");
|
|
594
|
-
}
|
|
595
|
-
if (ground === "terrain") requested.add("terrain-heightfield");
|
|
596
|
-
if (lighting === "softbox") requested.add("rectangular-area-light");
|
|
597
|
-
if (type === "ocean") {
|
|
598
|
-
requested.add("fft-webgpu-water");
|
|
599
|
-
requested.add("planar-reflection");
|
|
600
|
-
requested.add("transmission-refraction");
|
|
601
|
-
requested.add("water-caustics");
|
|
602
|
-
requested.add("underwater-volume");
|
|
603
|
-
}
|
|
604
|
-
if (fog?.mode === "linear") requested.delete("linear-fog");
|
|
605
|
-
if (fog?.mode === "exponential" || fog?.mode === "exponential-squared") requested.delete("exponential-fog");
|
|
606
|
-
|
|
607
|
-
return [...requested].map((request) => unsupportedRequestDisclosure(request));
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
function createStageShell(
|
|
611
|
-
preset: EnvironmentStagePresetId,
|
|
612
|
-
size: number,
|
|
613
|
-
palette: StagePalette,
|
|
614
|
-
floorY: number,
|
|
615
|
-
studioTone: EnvironmentStudioTone
|
|
616
|
-
): RenderItem[] {
|
|
617
|
-
const premiumStudio = preset === "indoor-studio" && (studioTone === "premium-dark" || studioTone === "product-premium");
|
|
618
|
-
const productPremiumStudio = preset === "indoor-studio" && studioTone === "product-premium";
|
|
619
|
-
const floorScale: Vec3 = productPremiumStudio
|
|
620
|
-
? [size * 0.94, 0.028, size * 0.52]
|
|
621
|
-
: premiumStudio
|
|
622
|
-
? [size * 1.78, 0.052, size * 1.22]
|
|
623
|
-
: [size * 1.65, 0.06, size * 1.65];
|
|
624
|
-
const wallCenter: Vec3 = premiumStudio
|
|
625
|
-
? [0, floorY + size * 1.38, -size * 1.55]
|
|
626
|
-
: [0, floorY + size * 0.36, -size * 0.82];
|
|
627
|
-
const wallScale: Vec3 = premiumStudio
|
|
628
|
-
? [size * 8.0, size * 4.0, 0.07]
|
|
629
|
-
: [size * 1.65, size * 0.74, 0.08];
|
|
630
|
-
const floor = new PBRMaterial({
|
|
631
|
-
name: `${preset} environment floor`,
|
|
632
|
-
baseColor: [...(productPremiumStudio ? ([0.06, 0.064, 0.067] as Rgb) : palette.floor), 1],
|
|
633
|
-
roughness: productPremiumStudio ? 0.74 : premiumStudio ? 0.68 : preset === "indoor-studio" ? 0.54 : 0.62,
|
|
634
|
-
metallic: productPremiumStudio ? 0.04 : preset === "urban-city" || preset === "industrial-warehouse" ? 0.14 : 0.02,
|
|
635
|
-
environmentColor: palette.ambient,
|
|
636
|
-
environmentIntensity: productPremiumStudio ? 0.012 : premiumStudio ? 0.0 : preset === "indoor-studio" ? 0.24 : 0.48,
|
|
637
|
-
proceduralEnvironmentMap: proceduralMap(palette)
|
|
638
|
-
});
|
|
639
|
-
const wall = new PBRMaterial({
|
|
640
|
-
name: `${preset} environment backdrop`,
|
|
641
|
-
baseColor: [...palette.backdrop, 1],
|
|
642
|
-
roughness: premiumStudio ? 0.92 : preset === "indoor-studio" ? 0.86 : 0.72,
|
|
643
|
-
metallic: 0,
|
|
644
|
-
environmentColor: palette.ambient,
|
|
645
|
-
environmentIntensity: premiumStudio ? 0.0 : preset === "indoor-studio" ? 0.16 : 0.36,
|
|
646
|
-
proceduralEnvironmentMap: proceduralMap(palette)
|
|
647
|
-
});
|
|
648
|
-
const floorItem: RenderItem = {
|
|
649
|
-
geometry: productPremiumStudio ? Geometry.litCube(1) : premiumStudio ? Geometry.cylinder({ radius: 0.5, height: 1, segments: 96 }) : Geometry.litCube(1),
|
|
650
|
-
material: floor,
|
|
651
|
-
modelMatrix: trs([0, floorY - floorScale[1] * 0.5 - 0.005, productPremiumStudio ? 0.08 : 0.04], floorScale),
|
|
652
|
-
includeInAutoFrame: false,
|
|
653
|
-
label: `${preset} floor/catch plane`
|
|
654
|
-
};
|
|
655
|
-
if (premiumStudio) return [floorItem];
|
|
656
|
-
return [
|
|
657
|
-
floorItem,
|
|
658
|
-
{
|
|
659
|
-
geometry: Geometry.litCube(1),
|
|
660
|
-
material: wall,
|
|
661
|
-
modelMatrix: trs(wallCenter, wallScale),
|
|
662
|
-
includeInAutoFrame: false,
|
|
663
|
-
label: `${preset} rear infinity wall`
|
|
664
|
-
}
|
|
665
|
-
];
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
function createStageAccents(
|
|
669
|
-
preset: EnvironmentStagePresetId,
|
|
670
|
-
size: number,
|
|
671
|
-
palette: StagePalette,
|
|
672
|
-
time: number,
|
|
673
|
-
floorY: number,
|
|
674
|
-
studioTone: EnvironmentStudioTone
|
|
675
|
-
): RenderItem[] {
|
|
676
|
-
if (preset === "clean-void" || preset === "outdoor-nature") {
|
|
677
|
-
return horizonBands(preset, size, palette, floorY);
|
|
678
|
-
}
|
|
679
|
-
if (preset === "deep-space") {
|
|
680
|
-
const points: Vec3[] = [];
|
|
681
|
-
for (let i = 0; i < 220; i += 1) {
|
|
682
|
-
const a = hash01(i, 17) * Math.PI * 2;
|
|
683
|
-
const r = size * (1.1 + hash01(i, 23) * 1.15);
|
|
684
|
-
points.push([
|
|
685
|
-
Math.cos(a) * r,
|
|
686
|
-
floorY + size * (0.14 + hash01(i, 31) * 0.72),
|
|
687
|
-
-size * (0.28 + hash01(i, 43) * 1.1) + Math.sin(time * 0.05 + i) * 0.04
|
|
688
|
-
]);
|
|
689
|
-
}
|
|
690
|
-
return [{
|
|
691
|
-
geometry: Geometry.points(points),
|
|
692
|
-
material: new UnlitMaterial({ name: "deep space star field", color: [0.78, 0.9, 1, 0.82], pointSize: 2.2, roundPoints: true, renderState: { blend: true, depthWrite: false } }),
|
|
693
|
-
includeInAutoFrame: false,
|
|
694
|
-
label: "deep space reusable star field"
|
|
695
|
-
}];
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
const panels: RenderItem[] = [];
|
|
699
|
-
const panelCount = preset === "urban-city" ? 10 : preset === "industrial-warehouse" ? 8 : 6;
|
|
700
|
-
const premiumStudio = preset === "indoor-studio" && (studioTone === "premium-dark" || studioTone === "product-premium");
|
|
701
|
-
const productPremiumStudio = preset === "indoor-studio" && studioTone === "product-premium";
|
|
702
|
-
if (premiumStudio) {
|
|
703
|
-
const studioPanels: readonly { readonly position: Vec3; readonly scale: Vec3; readonly rotation: Vec3; readonly color: Rgb; readonly label: string }[] = [
|
|
704
|
-
{ position: [-size * 0.24, floorY + size * (productPremiumStudio ? 1.02 : 0.66), -size * (productPremiumStudio ? 0.92 : 0.54)], scale: [size * (productPremiumStudio ? 0.095 : 0.18), size * 0.01, size * (productPremiumStudio ? 0.026 : 0.045)], rotation: [0, 0, 0.05], color: palette.accentB, label: "upper warm softbox" },
|
|
705
|
-
{ position: [size * 0.28, floorY + size * (productPremiumStudio ? 1.03 : 0.66), -size * (productPremiumStudio ? 0.94 : 0.56)], scale: [size * (productPremiumStudio ? 0.095 : 0.18), size * 0.01, size * (productPremiumStudio ? 0.026 : 0.045)], rotation: [0, 0, -0.05], color: palette.accentA, label: "upper cool softbox" }
|
|
706
|
-
];
|
|
707
|
-
return studioPanels.map((panel, index): RenderItem => ({
|
|
708
|
-
geometry: Geometry.litCube(1),
|
|
709
|
-
material: new PBRMaterial({
|
|
710
|
-
name: `${preset} premium analytical ${panel.label}`,
|
|
711
|
-
baseColor: [...panel.color, 1],
|
|
712
|
-
roughness: 0.38,
|
|
713
|
-
emissiveColor: panel.color,
|
|
714
|
-
emissiveStrength: productPremiumStudio ? index === 0 ? 0.052 : 0.044 : index === 0 ? 0.16 : 0.12,
|
|
715
|
-
environmentColor: palette.ambient,
|
|
716
|
-
proceduralEnvironmentMap: proceduralMap(palette)
|
|
717
|
-
}),
|
|
718
|
-
modelMatrix: trs(panel.position, panel.scale, panel.rotation),
|
|
719
|
-
includeInAutoFrame: false,
|
|
720
|
-
label: `${preset} reusable ${panel.label}`
|
|
721
|
-
}));
|
|
722
|
-
}
|
|
723
|
-
for (let i = 0; i < panelCount; i += 1) {
|
|
724
|
-
const x = premiumStudio
|
|
725
|
-
? -size * 0.56 + (i / Math.max(1, panelCount - 1)) * size * 1.12
|
|
726
|
-
: -size * 0.72 + (i / Math.max(1, panelCount - 1)) * size * 1.44;
|
|
727
|
-
const y = floorY + size * (premiumStudio ? 0.68 : preset === "indoor-studio" ? 0.62 : 0.62 + (i % 2) * 0.08);
|
|
728
|
-
const z = premiumStudio ? -size * 0.42 : preset === "indoor-studio" ? -size * 0.52 : -size * 0.77;
|
|
729
|
-
const emissive = i % 2 === 0 ? palette.accentA : palette.accentB;
|
|
730
|
-
panels.push({
|
|
731
|
-
geometry: Geometry.litCube(1),
|
|
732
|
-
material: new PBRMaterial({
|
|
733
|
-
name: `${preset} analytical light panel ${i}`,
|
|
734
|
-
baseColor: [...emissive, 1],
|
|
735
|
-
roughness: 0.22,
|
|
736
|
-
emissiveColor: emissive,
|
|
737
|
-
emissiveStrength: preset === "urban-city" ? 2.4 : premiumStudio ? 0.42 : preset === "indoor-studio" ? 0.82 : 1.55,
|
|
738
|
-
environmentColor: palette.ambient,
|
|
739
|
-
proceduralEnvironmentMap: proceduralMap(palette)
|
|
740
|
-
}),
|
|
741
|
-
modelMatrix: trs([x, y, z], premiumStudio ? [size * 0.07, size * 0.014, size * 0.11] : [size * 0.09, size * 0.018, size * 0.16], [0, 0, (i % 2 ? -0.1 : 0.1)]),
|
|
742
|
-
includeInAutoFrame: false,
|
|
743
|
-
label: `${preset} reusable light panel`
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
return panels;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
function createStageContactGrounding(
|
|
750
|
-
preset: EnvironmentStagePresetId,
|
|
751
|
-
size: number,
|
|
752
|
-
floorY: number,
|
|
753
|
-
studioTone: EnvironmentStudioTone,
|
|
754
|
-
input: EnvironmentStageOptions["contactGrounding"]
|
|
755
|
-
): EnvironmentContactGrounding | undefined {
|
|
756
|
-
const requestedMode = typeof input === "string" ? input : input?.mode ?? "auto";
|
|
757
|
-
if (requestedMode === "off") return undefined;
|
|
758
|
-
const defaultProductGrounding = preset === "indoor-studio" && studioTone === "product-premium";
|
|
759
|
-
if (requestedMode === "auto" && !defaultProductGrounding) return undefined;
|
|
760
|
-
const options: EnvironmentContactGroundingOptions = typeof input === "object" ? input : {};
|
|
761
|
-
const casterRadius = positive(options.casterRadius ?? size * (defaultProductGrounding ? 0.28 : 0.34), "contact grounding casterRadius");
|
|
762
|
-
const receiverDistance = positive(options.receiverDistance ?? size * 0.075, "contact grounding receiverDistance");
|
|
763
|
-
const label = options.label ?? `${preset} product grounding`;
|
|
764
|
-
const plan = createExternalParityContactShadowPlan({
|
|
765
|
-
casterRadius,
|
|
766
|
-
receiverDistance,
|
|
767
|
-
softness: options.softness ?? (defaultProductGrounding ? 0.62 : 0.52),
|
|
768
|
-
opacity: options.opacity ?? (defaultProductGrounding ? 0.3 : 0.42),
|
|
769
|
-
layerCount: options.layerCount ?? (defaultProductGrounding ? 3 : 2),
|
|
770
|
-
anisotropy: options.anisotropy ?? (defaultProductGrounding ? 1.72 : 1.22),
|
|
771
|
-
yOffset: options.yOffset ?? 0.003
|
|
772
|
-
});
|
|
773
|
-
const items = plan.layers.map((layer): RenderItem => ({
|
|
774
|
-
geometry: Geometry.cylinder({ radius: 0.5, height: 1, segments: 96 }),
|
|
775
|
-
material: new PBRMaterial({
|
|
776
|
-
name: `${label} layer ${layer.index}`,
|
|
777
|
-
baseColor: [0, 0, 0, layer.opacity],
|
|
778
|
-
roughness: 1,
|
|
779
|
-
metallic: 0,
|
|
780
|
-
environmentColor: [0, 0, 0],
|
|
781
|
-
environmentIntensity: 0,
|
|
782
|
-
proceduralEnvironmentMap: {
|
|
783
|
-
skyColor: [0, 0, 0],
|
|
784
|
-
horizonColor: [0, 0, 0],
|
|
785
|
-
groundColor: [0, 0, 0],
|
|
786
|
-
specularColor: [0, 0, 0],
|
|
787
|
-
intensity: 0,
|
|
788
|
-
specularIntensity: 0
|
|
789
|
-
},
|
|
790
|
-
renderState: {
|
|
791
|
-
blend: true,
|
|
792
|
-
depthWrite: false,
|
|
793
|
-
cullMode: "none",
|
|
794
|
-
polygonOffset: { factor: -1, units: -1 }
|
|
795
|
-
}
|
|
796
|
-
}),
|
|
797
|
-
modelMatrix: trs([0, floorY + layer.yOffset, 0.03], [layer.scale[0], 0.003, layer.scale[1]]),
|
|
798
|
-
includeInAutoFrame: false,
|
|
799
|
-
label: `${label} contact shadow layer ${layer.index}`
|
|
800
|
-
}));
|
|
801
|
-
return {
|
|
802
|
-
mode: "contact-shadow",
|
|
803
|
-
plan,
|
|
804
|
-
items,
|
|
805
|
-
receiverLabel: `${preset} floor/catch plane`,
|
|
806
|
-
limitations: [
|
|
807
|
-
"Contact grounding uses layered receiver geometry so product assets have reusable visual grounding without camera reframing or floor expansion.",
|
|
808
|
-
plan.claimBoundary
|
|
809
|
-
]
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
function horizonBands(preset: EnvironmentStagePresetId, size: number, palette: StagePalette, floorY = 0): RenderItem[] {
|
|
814
|
-
return [0, 1, 2].map((band): RenderItem => ({
|
|
815
|
-
geometry: Geometry.litCube(1),
|
|
816
|
-
material: new UnlitMaterial({
|
|
817
|
-
name: `${preset} horizon band ${band}`,
|
|
818
|
-
color: [...mixRgb(palette.horizon, palette.sky, band * 0.28), 0.28 - band * 0.05],
|
|
819
|
-
renderState: { blend: true, depthWrite: false }
|
|
820
|
-
}),
|
|
821
|
-
modelMatrix: trs([0, floorY + size * (0.18 + band * 0.12), -size * (0.76 + band * 0.02)], [size * 1.64, size * 0.08, 0.025]),
|
|
822
|
-
includeInAutoFrame: false,
|
|
823
|
-
label: `${preset} procedural horizon band`
|
|
824
|
-
}));
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
function createStageLighting(preset: EnvironmentStagePresetId, palette: StagePalette): EnvironmentLightingOptions {
|
|
828
|
-
return {
|
|
829
|
-
color: palette.ambient,
|
|
830
|
-
intensity: preset === "deep-space" ? 0.18 : preset === "urban-city" ? 0.62 : 0.48,
|
|
831
|
-
proceduralMap: proceduralMap(palette)
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
function stageCapabilities(preset: EnvironmentStagePresetId): readonly EnvironmentCapabilityId[] {
|
|
836
|
-
const base: EnvironmentCapabilityId[] = ["procedural-sky-dome", "infinite-ground-grid"];
|
|
837
|
-
if (preset === "clean-void") return [...base, "clean-void-backdrop"];
|
|
838
|
-
if (preset === "indoor-studio") return [...base, "analytical-studio-box", "indoor-studio-stage"];
|
|
839
|
-
if (preset === "outdoor-nature") return [...base, "outdoor-nature-backdrop"];
|
|
840
|
-
if (preset === "urban-city") return [...base, "urban-city-shell"];
|
|
841
|
-
if (preset === "industrial-warehouse") return [...base, "industrial-warehouse-void"];
|
|
842
|
-
return [...base, "deep-space-box"];
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
function stagePresetForType(type: EnvironmentPresetType): EnvironmentStagePresetId {
|
|
846
|
-
switch (type) {
|
|
847
|
-
case "studio": return "indoor-studio";
|
|
848
|
-
case "outdoor": return "outdoor-nature";
|
|
849
|
-
case "city": return "urban-city";
|
|
850
|
-
case "warehouse": return "industrial-warehouse";
|
|
851
|
-
case "space": return "deep-space";
|
|
852
|
-
case "ocean": return "outdoor-nature";
|
|
853
|
-
default: return type;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
function defaultLightingForType(type: EnvironmentPresetType): EnvironmentPresetLighting {
|
|
858
|
-
switch (type) {
|
|
859
|
-
case "studio":
|
|
860
|
-
case "indoor-studio":
|
|
861
|
-
case "clean-void":
|
|
862
|
-
return "softbox";
|
|
863
|
-
case "city":
|
|
864
|
-
case "urban-city":
|
|
865
|
-
return "neon";
|
|
866
|
-
case "warehouse":
|
|
867
|
-
case "industrial-warehouse":
|
|
868
|
-
return "warehouse";
|
|
869
|
-
case "space":
|
|
870
|
-
case "deep-space":
|
|
871
|
-
return "space";
|
|
872
|
-
case "ocean":
|
|
873
|
-
return "sunset";
|
|
874
|
-
case "outdoor":
|
|
875
|
-
case "outdoor-nature":
|
|
876
|
-
return "overcast";
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
function backgroundCapabilities(background: EnvironmentPresetBackground): readonly EnvironmentCapabilityId[] {
|
|
881
|
-
if (background === "cubemap") return ["cubemap-renderer"];
|
|
882
|
-
if (background === "equirect") return ["equirectangular-projection"];
|
|
883
|
-
if (background === "sky" || background === "procedural") return ["procedural-sky-dome"];
|
|
884
|
-
return [];
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
function groundCapabilities(ground: EnvironmentPresetGround): readonly EnvironmentCapabilityId[] {
|
|
888
|
-
if (ground === "grid") return ["infinite-ground-grid"];
|
|
889
|
-
if (ground === "reflective-floor") return ["clean-void-backdrop", "cube-camera-reflections"];
|
|
890
|
-
if (ground === "shadow-catcher") return ["clean-void-backdrop"];
|
|
891
|
-
if (ground === "terrain") return ["outdoor-nature-backdrop"];
|
|
892
|
-
return [];
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
function uniqueCapabilities(values: readonly EnvironmentCapabilityId[]): readonly EnvironmentCapabilityId[] {
|
|
896
|
-
return [...new Set(values)];
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
function resolveEnvironmentFog(input: EnvironmentFogInput | EnvironmentFogProfile | undefined, type: EnvironmentPresetType): EnvironmentFogProfile | undefined {
|
|
900
|
-
if (input === false) return undefined;
|
|
901
|
-
if (input && typeof input === "object" && "uniforms" in input && "telemetry" in input) return input;
|
|
902
|
-
if (input !== undefined) return createEnvironmentFogProfile(input);
|
|
903
|
-
const preset = defaultFogForType(type);
|
|
904
|
-
return preset ? createEnvironmentFogProfile(preset) : undefined;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
function defaultFogForType(type: EnvironmentPresetType): EnvironmentFogPresetId | undefined {
|
|
908
|
-
switch (type) {
|
|
909
|
-
case "ocean":
|
|
910
|
-
return "marine-layer";
|
|
911
|
-
case "outdoor":
|
|
912
|
-
case "outdoor-nature":
|
|
913
|
-
return "distant-haze";
|
|
914
|
-
case "city":
|
|
915
|
-
case "urban-city":
|
|
916
|
-
return "night-smog";
|
|
917
|
-
case "warehouse":
|
|
918
|
-
case "industrial-warehouse":
|
|
919
|
-
return "warehouse-dust";
|
|
920
|
-
default:
|
|
921
|
-
return undefined;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
function fogPresetDefaults(preset: EnvironmentFogPresetId): Required<Omit<EnvironmentFogOptions, "sampleDistances">> {
|
|
926
|
-
switch (preset) {
|
|
927
|
-
case "morning-mist":
|
|
928
|
-
return {
|
|
929
|
-
preset,
|
|
930
|
-
mode: "exponential",
|
|
931
|
-
color: [0.68, 0.76, 0.78],
|
|
932
|
-
near: 0,
|
|
933
|
-
far: 90,
|
|
934
|
-
density: 0.026,
|
|
935
|
-
heightFalloff: 0.18,
|
|
936
|
-
heightReference: 0,
|
|
937
|
-
maxOpacity: 0.64
|
|
938
|
-
};
|
|
939
|
-
case "marine-layer":
|
|
940
|
-
return {
|
|
941
|
-
preset,
|
|
942
|
-
mode: "exponential-squared",
|
|
943
|
-
color: [0.56, 0.74, 0.82],
|
|
944
|
-
near: 4,
|
|
945
|
-
far: 130,
|
|
946
|
-
density: 0.012,
|
|
947
|
-
heightFalloff: 0.045,
|
|
948
|
-
heightReference: 0,
|
|
949
|
-
maxOpacity: 0.68
|
|
950
|
-
};
|
|
951
|
-
case "night-smog":
|
|
952
|
-
return {
|
|
953
|
-
preset,
|
|
954
|
-
mode: "exponential",
|
|
955
|
-
color: [0.07, 0.1, 0.16],
|
|
956
|
-
near: 0,
|
|
957
|
-
far: 120,
|
|
958
|
-
density: 0.018,
|
|
959
|
-
heightFalloff: 0.025,
|
|
960
|
-
heightReference: 0,
|
|
961
|
-
maxOpacity: 0.58
|
|
962
|
-
};
|
|
963
|
-
case "warehouse-dust":
|
|
964
|
-
return {
|
|
965
|
-
preset,
|
|
966
|
-
mode: "linear",
|
|
967
|
-
color: [0.46, 0.43, 0.35],
|
|
968
|
-
near: 12,
|
|
969
|
-
far: 72,
|
|
970
|
-
density: 0.012,
|
|
971
|
-
heightFalloff: 0.02,
|
|
972
|
-
heightReference: 0,
|
|
973
|
-
maxOpacity: 0.48
|
|
974
|
-
};
|
|
975
|
-
case "distant-haze":
|
|
976
|
-
return {
|
|
977
|
-
preset,
|
|
978
|
-
mode: "linear",
|
|
979
|
-
color: [0.62, 0.7, 0.78],
|
|
980
|
-
near: 32,
|
|
981
|
-
far: 160,
|
|
982
|
-
density: 0.006,
|
|
983
|
-
heightFalloff: 0.015,
|
|
984
|
-
heightReference: 0,
|
|
985
|
-
maxOpacity: 0.7
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
function fogCapabilities(mode: EnvironmentFogMode): readonly EnvironmentCapabilityId[] {
|
|
991
|
-
return mode === "linear" ? ["linear-fog"] : ["exponential-fog"];
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
function fogModeUniform(mode: EnvironmentFogMode): 1 | 2 | 3 {
|
|
995
|
-
if (mode === "linear") return 1;
|
|
996
|
-
if (mode === "exponential") return 2;
|
|
997
|
-
return 3;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
function defaultFogSampleDistances(near: number, far: number): readonly number[] {
|
|
1001
|
-
const span = far - near;
|
|
1002
|
-
return [0, near, near + span * 0.35, near + span * 0.7, far, far + span * 0.35].map(round3);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
function sanitizeFogSampleDistances(values: readonly number[]): readonly number[] {
|
|
1006
|
-
if (values.length === 0) throw new RangeError("Environment platform fog sampleDistances must not be empty.");
|
|
1007
|
-
return values.map((value, index) => round3(nonNegative(value, `fog sampleDistances[${index}]`)));
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
function unsupportedRequestDisclosure(request: EnvironmentFeatureRequest): EnvironmentUnsupportedRequestDisclosure {
|
|
1011
|
-
switch (request) {
|
|
1012
|
-
case "cubemap-background":
|
|
1013
|
-
return unsupported(
|
|
1014
|
-
request,
|
|
1015
|
-
["cubemap-renderer"],
|
|
1016
|
-
"Renderer.environmentBackground cubemap binding when a cube texture is supplied",
|
|
1017
|
-
"Renderer cubemap background support exists, but this preset request did not attach six cube faces or accepted screenshot evidence."
|
|
1018
|
-
);
|
|
1019
|
-
case "equirect-background":
|
|
1020
|
-
return unsupported(
|
|
1021
|
-
request,
|
|
1022
|
-
["equirectangular-projection"],
|
|
1023
|
-
"Renderer.environmentBackground equirect binding when a panorama texture is supplied",
|
|
1024
|
-
"Renderer equirect background support exists, but this preset request did not attach a panorama texture or accepted screenshot evidence."
|
|
1025
|
-
);
|
|
1026
|
-
case "reflective-floor":
|
|
1027
|
-
return unsupported(
|
|
1028
|
-
request,
|
|
1029
|
-
["clean-void-backdrop", "cube-camera-reflections"],
|
|
1030
|
-
"staged floor/catch-plane geometry",
|
|
1031
|
-
"Requested reflective floor falls back to staged geometry; planar reflector/cube-camera floor reflections are not implemented."
|
|
1032
|
-
);
|
|
1033
|
-
case "terrain-heightfield":
|
|
1034
|
-
return unsupported(
|
|
1035
|
-
request,
|
|
1036
|
-
["outdoor-nature-backdrop"],
|
|
1037
|
-
"outdoor backdrop and finite stage shell",
|
|
1038
|
-
"Requested terrain ground falls back to outdoor backdrop geometry; reusable terrain/heightfield generation is not implemented."
|
|
1039
|
-
);
|
|
1040
|
-
case "rectangular-area-light":
|
|
1041
|
-
return unsupported(
|
|
1042
|
-
request,
|
|
1043
|
-
["analytical-studio-box"],
|
|
1044
|
-
"emissive panels plus environment lighting",
|
|
1045
|
-
"Softbox preset uses emissive panels and environment lighting; true rectangular area-light shading is not implemented."
|
|
1046
|
-
);
|
|
1047
|
-
case "cube-camera-reflection":
|
|
1048
|
-
return unsupported(
|
|
1049
|
-
request,
|
|
1050
|
-
["cube-camera-reflections"],
|
|
1051
|
-
"static procedural environment lighting",
|
|
1052
|
-
"Cube-camera reflection requests remain unsupported; live six-direction probe capture and reflective material binding are not implemented."
|
|
1053
|
-
);
|
|
1054
|
-
case "planar-reflection":
|
|
1055
|
-
return unsupported(
|
|
1056
|
-
request,
|
|
1057
|
-
["cube-camera-reflections"],
|
|
1058
|
-
"static procedural environment lighting and stage geometry",
|
|
1059
|
-
"Planar reflection requests remain unsupported; the environment preset does not create reflector render targets or screen-space reflections."
|
|
1060
|
-
);
|
|
1061
|
-
case "transmission-refraction":
|
|
1062
|
-
return unsupported(
|
|
1063
|
-
request,
|
|
1064
|
-
["pmrem-generator"],
|
|
1065
|
-
"bounded material/environment response",
|
|
1066
|
-
"Scene-space refraction requests remain unsupported; current material/environment helpers do not provide water refraction, caustics, or background ray marching parity."
|
|
1067
|
-
);
|
|
1068
|
-
case "linear-fog":
|
|
1069
|
-
return unsupported(
|
|
1070
|
-
request,
|
|
1071
|
-
["linear-fog"],
|
|
1072
|
-
"Renderer.environmentFog linear profile when a fog profile is supplied",
|
|
1073
|
-
"Renderer linear fog support exists, but this request did not attach an environment fog profile; accepted Fog parity still requires route visual gates."
|
|
1074
|
-
);
|
|
1075
|
-
case "exponential-fog":
|
|
1076
|
-
return unsupported(
|
|
1077
|
-
request,
|
|
1078
|
-
["exponential-fog"],
|
|
1079
|
-
"Renderer.environmentFog exponential profile when a fog profile is supplied",
|
|
1080
|
-
"Renderer exponential fog support exists, but this request did not attach an exponential environment fog profile; accepted FogExp2 parity still requires route visual gates."
|
|
1081
|
-
);
|
|
1082
|
-
case "volumetric-fog":
|
|
1083
|
-
return unsupported(
|
|
1084
|
-
request,
|
|
1085
|
-
["volumetric-weather-enclosure"],
|
|
1086
|
-
"deterministic mist/dust helper geometry",
|
|
1087
|
-
"Volumetric fog remains helper-only; no participating-media, volumetric cloud, or native god-ray pass is implemented."
|
|
1088
|
-
);
|
|
1089
|
-
case "fft-webgpu-water":
|
|
1090
|
-
return unsupported(
|
|
1091
|
-
request,
|
|
1092
|
-
["dynamic-ocean-plane"],
|
|
1093
|
-
"CPU/Gerstner water telemetry and finite mesh helpers",
|
|
1094
|
-
"Ocean preset does not provide FFT/WebGPU water; dynamic water remains helper-level CPU/Gerstner/procedural geometry."
|
|
1095
|
-
);
|
|
1096
|
-
case "water-caustics":
|
|
1097
|
-
return unsupported(
|
|
1098
|
-
request,
|
|
1099
|
-
["dynamic-ocean-plane"],
|
|
1100
|
-
"foam/glint helper geometry and material highlights",
|
|
1101
|
-
"Water caustics remain unsupported; environment presets do not create caustic projection, photon, or screen-space caustic passes."
|
|
1102
|
-
);
|
|
1103
|
-
case "underwater-volume":
|
|
1104
|
-
return unsupported(
|
|
1105
|
-
request,
|
|
1106
|
-
["dynamic-ocean-plane"],
|
|
1107
|
-
"surface-only water helper geometry",
|
|
1108
|
-
"Underwater volume rendering remains unsupported; environment presets do not provide absorption/scattering volumes or underwater camera transitions."
|
|
1109
|
-
);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
function unsupported(
|
|
1114
|
-
request: EnvironmentFeatureRequest,
|
|
1115
|
-
capabilityIds: readonly EnvironmentCapabilityId[],
|
|
1116
|
-
fallback: string,
|
|
1117
|
-
disclosure: string
|
|
1118
|
-
): EnvironmentUnsupportedRequestDisclosure {
|
|
1119
|
-
return {
|
|
1120
|
-
request,
|
|
1121
|
-
supported: false,
|
|
1122
|
-
capabilityIds,
|
|
1123
|
-
fallback,
|
|
1124
|
-
disclosure
|
|
1125
|
-
};
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
function stageLimitations(preset: EnvironmentStagePresetId): readonly string[] {
|
|
1129
|
-
const shared = [
|
|
1130
|
-
"Environment stage helpers are reusable A3D geometry/material systems, not proof of full Three.js environment parity.",
|
|
1131
|
-
"Linear/exponential fog profiles are uniform-ready helpers; accepted shader integration, cube-camera reflections, and volumetric weather remain separate backlog items."
|
|
1132
|
-
];
|
|
1133
|
-
if (preset === "indoor-studio") return [
|
|
1134
|
-
...shared,
|
|
1135
|
-
"Softboxes are emissive geometry and environment-light presets, not physically integrated area lights.",
|
|
1136
|
-
"Product studio tones use compact analytical catch planes; full contact shadows and live area-light integration remain separate renderer evidence."
|
|
1137
|
-
];
|
|
1138
|
-
if (preset === "deep-space") return [...shared, "Star field is point geometry, not HDR cubemap or volumetric nebula rendering."];
|
|
1139
|
-
if (preset === "outdoor-nature") return [...shared, "Outdoor sky is a colored dome/horizon helper, not atmospheric scattering."];
|
|
1140
|
-
return shared;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
interface StagePalette {
|
|
1144
|
-
readonly sky: Rgb;
|
|
1145
|
-
readonly horizon: Rgb;
|
|
1146
|
-
readonly ground: Rgb;
|
|
1147
|
-
readonly floor: Rgb;
|
|
1148
|
-
readonly backdrop: Rgb;
|
|
1149
|
-
readonly grid: Rgb;
|
|
1150
|
-
readonly ambient: Rgb;
|
|
1151
|
-
readonly specular: Rgb;
|
|
1152
|
-
readonly accentA: Rgb;
|
|
1153
|
-
readonly accentB: Rgb;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
function stagePalette(preset: EnvironmentStagePresetId, studioTone: EnvironmentStudioTone = "standard"): StagePalette {
|
|
1157
|
-
switch (preset) {
|
|
1158
|
-
case "indoor-studio":
|
|
1159
|
-
if (studioTone === "premium-dark" || studioTone === "product-premium") {
|
|
1160
|
-
return colors([0.004, 0.005, 0.008], [0.009, 0.012, 0.018], [0.003, 0.004, 0.006], [0.006, 0.008, 0.012], [0.004, 0.005, 0.009], [0.06, 0.1, 0.13], [0.1, 0.13, 0.16], [0.44, 0.52, 0.62], [0.28, 0.44, 0.58], [0.72, 0.42, 0.24]);
|
|
1161
|
-
}
|
|
1162
|
-
return colors([0.02, 0.028, 0.038], [0.08, 0.095, 0.12], [0.018, 0.02, 0.024], [0.035, 0.039, 0.044], [0.026, 0.03, 0.038], [0.18, 0.28, 0.34], [0.42, 0.46, 0.5], [0.72, 0.78, 0.86], [0.55, 0.72, 0.86], [0.92, 0.68, 0.42]);
|
|
1163
|
-
case "outdoor-nature":
|
|
1164
|
-
return colors([0.38, 0.58, 0.8], [0.95, 0.55, 0.28], [0.08, 0.18, 0.12], [0.18, 0.24, 0.16], [0.2, 0.32, 0.28], [0.42, 0.58, 0.42], [0.62, 0.72, 0.58], [1, 0.76, 0.46], [0.88, 0.54, 0.28], [0.35, 0.62, 0.42]);
|
|
1165
|
-
case "urban-city":
|
|
1166
|
-
return colors([0.025, 0.045, 0.09], [0.08, 0.18, 0.28], [0.015, 0.018, 0.025], [0.035, 0.04, 0.05], [0.025, 0.03, 0.045], [0.1, 0.74, 0.92], [0.34, 0.46, 0.72], [0.56, 0.82, 1], [0.0, 0.82, 1], [1, 0.22, 0.68]);
|
|
1167
|
-
case "industrial-warehouse":
|
|
1168
|
-
return colors([0.08, 0.1, 0.11], [0.2, 0.22, 0.2], [0.06, 0.055, 0.05], [0.22, 0.22, 0.2], [0.14, 0.145, 0.14], [0.74, 0.64, 0.42], [0.58, 0.56, 0.5], [1, 0.86, 0.55], [1, 0.72, 0.32], [0.36, 0.62, 0.72]);
|
|
1169
|
-
case "deep-space":
|
|
1170
|
-
return colors([0.004, 0.006, 0.02], [0.045, 0.03, 0.12], [0, 0, 0.01], [0.012, 0.014, 0.025], [0.006, 0.008, 0.018], [0.32, 0.46, 0.78], [0.18, 0.24, 0.42], [0.42, 0.56, 1], [0.44, 0.72, 1], [0.8, 0.35, 1]);
|
|
1171
|
-
case "clean-void":
|
|
1172
|
-
return colors([0.68, 0.72, 0.76], [0.78, 0.8, 0.82], [0.24, 0.25, 0.26], [0.56, 0.58, 0.6], [0.48, 0.5, 0.52], [0.32, 0.36, 0.4], [0.74, 0.76, 0.78], [0.95, 0.95, 0.92], [0.74, 0.78, 0.82], [0.56, 0.6, 0.64]);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
function proceduralMap(palette: StagePalette): PBRProceduralEnvironmentMapOptions {
|
|
1177
|
-
return {
|
|
1178
|
-
skyColor: palette.sky,
|
|
1179
|
-
horizonColor: palette.horizon,
|
|
1180
|
-
groundColor: palette.ground,
|
|
1181
|
-
specularColor: palette.specular,
|
|
1182
|
-
intensity: 0.7,
|
|
1183
|
-
specularIntensity: 0.82
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
function capability(
|
|
1188
|
-
id: EnvironmentCapabilityId,
|
|
1189
|
-
label: string,
|
|
1190
|
-
status: EnvironmentCapabilityStatus,
|
|
1191
|
-
reusable: boolean,
|
|
1192
|
-
evidence: readonly string[],
|
|
1193
|
-
gap: string,
|
|
1194
|
-
requiredForAcceptedClaim: string
|
|
1195
|
-
): EnvironmentCapability {
|
|
1196
|
-
return { id, label, status, reusable, evidence, gap, requiredForAcceptedClaim };
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
function colors(
|
|
1200
|
-
sky: Rgb,
|
|
1201
|
-
horizon: Rgb,
|
|
1202
|
-
ground: Rgb,
|
|
1203
|
-
floor: Rgb,
|
|
1204
|
-
backdrop: Rgb,
|
|
1205
|
-
grid: Rgb,
|
|
1206
|
-
ambient: Rgb,
|
|
1207
|
-
specular: Rgb,
|
|
1208
|
-
accentA: Rgb,
|
|
1209
|
-
accentB: Rgb
|
|
1210
|
-
): StagePalette {
|
|
1211
|
-
return { sky, horizon, ground, floor, backdrop, grid, ambient, specular, accentA, accentB };
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
function trs(position: Vec3, scale: Vec3, rotation: Vec3 = [0, 0, 0]): Float32Array {
|
|
1215
|
-
const [sx, sy, sz] = scale;
|
|
1216
|
-
const [rx, ry, rz] = rotation;
|
|
1217
|
-
const cx = Math.cos(rx);
|
|
1218
|
-
const sxr = Math.sin(rx);
|
|
1219
|
-
const cy = Math.cos(ry);
|
|
1220
|
-
const syr = Math.sin(ry);
|
|
1221
|
-
const cz = Math.cos(rz);
|
|
1222
|
-
const szr = Math.sin(rz);
|
|
1223
|
-
const m00 = cy * cz;
|
|
1224
|
-
const m01 = sxr * syr * cz + cx * szr;
|
|
1225
|
-
const m02 = -cx * syr * cz + sxr * szr;
|
|
1226
|
-
const m10 = -cy * szr;
|
|
1227
|
-
const m11 = -sxr * syr * szr + cx * cz;
|
|
1228
|
-
const m12 = cx * syr * szr + sxr * cz;
|
|
1229
|
-
const m20 = syr;
|
|
1230
|
-
const m21 = -sxr * cy;
|
|
1231
|
-
const m22 = cx * cy;
|
|
1232
|
-
return new Float32Array([
|
|
1233
|
-
m00 * sx, m01 * sx, m02 * sx, 0,
|
|
1234
|
-
m10 * sy, m11 * sy, m12 * sy, 0,
|
|
1235
|
-
m20 * sz, m21 * sz, m22 * sz, 0,
|
|
1236
|
-
position[0], position[1], position[2], 1
|
|
1237
|
-
]);
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
function translation(position: Vec3): Float32Array {
|
|
1241
|
-
return trs(position, [1, 1, 1]);
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
function mixRgb(a: Rgb, b: Rgb, t: number): Rgb {
|
|
1245
|
-
const k = Math.max(0, Math.min(1, t));
|
|
1246
|
-
return [
|
|
1247
|
-
a[0] + (b[0] - a[0]) * k,
|
|
1248
|
-
a[1] + (b[1] - a[1]) * k,
|
|
1249
|
-
a[2] + (b[2] - a[2]) * k
|
|
1250
|
-
];
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
function hash01(index: number, salt: number): number {
|
|
1254
|
-
let value = Math.imul(index + 1, 0x9e3779b1) ^ Math.imul(salt + 1, 0x85ebca6b);
|
|
1255
|
-
value ^= value >>> 16;
|
|
1256
|
-
value = Math.imul(value, 0x7feb352d);
|
|
1257
|
-
value ^= value >>> 15;
|
|
1258
|
-
return ((value >>> 0) / 0xffffffff);
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
function finite(value: number, label: string): number {
|
|
1262
|
-
if (!Number.isFinite(value)) throw new RangeError(`Environment platform ${label} must be finite.`);
|
|
1263
|
-
return value;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
function nonNegative(value: number, label: string): number {
|
|
1267
|
-
if (!Number.isFinite(value) || value < 0) throw new RangeError(`Environment platform ${label} must be finite and non-negative.`);
|
|
1268
|
-
return value;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
function positive(value: number, label: string): number {
|
|
1272
|
-
if (!Number.isFinite(value) || value <= 0) throw new RangeError(`Environment platform ${label} must be positive.`);
|
|
1273
|
-
return value;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
function unit(value: number, label: string): number {
|
|
1277
|
-
if (!Number.isFinite(value) || value < 0 || value > 1) throw new RangeError(`Environment platform ${label} must be in [0, 1].`);
|
|
1278
|
-
return value;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
function integerInRange(value: number, min: number, max: number, label: string): number {
|
|
1282
|
-
if (!Number.isInteger(value) || value < min || value > max) {
|
|
1283
|
-
throw new RangeError(`Environment platform ${label} must be an integer in [${min}, ${max}].`);
|
|
1284
|
-
}
|
|
1285
|
-
return value;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
function rgb(value: Rgb, label: string): Rgb {
|
|
1289
|
-
return [
|
|
1290
|
-
unit(value[0], `${label}[0]`),
|
|
1291
|
-
unit(value[1], `${label}[1]`),
|
|
1292
|
-
unit(value[2], `${label}[2]`)
|
|
1293
|
-
];
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
function clamp(value: number, min: number, max: number): number {
|
|
1297
|
-
return Math.max(min, Math.min(max, value));
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
function round3(value: number): number {
|
|
1301
|
-
return Math.round(value * 1000) / 1000;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
function round5(value: number): number {
|
|
1305
|
-
return Math.round(value * 100000) / 100000;
|
|
1306
|
-
}
|