@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,16 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatLodLevel {
|
|
2
|
-
readonly distance: number;
|
|
3
|
-
readonly triangleRatio: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class LODSystemThreeCompat {
|
|
7
|
-
readonly levels: readonly ThreeCompatLodLevel[] = [
|
|
8
|
-
{ distance: 0, triangleRatio: 1 },
|
|
9
|
-
{ distance: 35, triangleRatio: 0.5 },
|
|
10
|
-
{ distance: 90, triangleRatio: 0.18 }
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
select(distance: number): ThreeCompatLodLevel {
|
|
14
|
-
return [...this.levels].reverse().find((level) => distance >= level.distance) ?? this.levels[0];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ThreeCompatCullingResult } from "./FrustumCulling";
|
|
2
|
-
|
|
3
|
-
export function runThreeCompatOcclusionCulling(input: ThreeCompatCullingResult, occlusionRatio = 0.2): ThreeCompatCullingResult {
|
|
4
|
-
const occluded = Math.round(input.visible * occlusionRatio);
|
|
5
|
-
return { total: input.total, visible: input.visible - occluded, culled: input.culled + occluded };
|
|
6
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { BVHThreeCompat } from "./BVH";
|
|
2
|
-
|
|
3
|
-
export function estimateThreeCompatAcceleratedRaycast(bvh: BVHThreeCompat, rays: number) {
|
|
4
|
-
const bruteForceTests = bvh.triangleCount * rays;
|
|
5
|
-
const acceleratedTests = Math.ceil(Math.log2(bvh.nodes.length + 1) * rays * 8);
|
|
6
|
-
return {
|
|
7
|
-
rays,
|
|
8
|
-
bruteForceTests,
|
|
9
|
-
acceleratedTests,
|
|
10
|
-
speedup: bruteForceTests / acceleratedTests
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatRendererProfile {
|
|
2
|
-
readonly objectCount: number;
|
|
3
|
-
readonly instanceCount: number;
|
|
4
|
-
readonly triangleCount: number;
|
|
5
|
-
readonly drawCalls: number;
|
|
6
|
-
readonly textureMemoryBytes: number;
|
|
7
|
-
readonly cpuFrameMs: number;
|
|
8
|
-
readonly warnings: readonly string[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createThreeCompatRendererProfile(input: Omit<ThreeCompatRendererProfile, "warnings">): ThreeCompatRendererProfile {
|
|
12
|
-
return {
|
|
13
|
-
...input,
|
|
14
|
-
warnings: [
|
|
15
|
-
...(input.cpuFrameMs > 16.6 ? ["CPU frame time exceeds 60fps budget."] : []),
|
|
16
|
-
...(input.drawCalls > 500 ? ["Draw call count is high; add batching or instancing."] : [])
|
|
17
|
-
]
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { InstancingThreeCompat } from "./Instancing";
|
|
2
|
-
export { runThreeCompatFrustumCulling } from "./FrustumCulling";
|
|
3
|
-
export type { ThreeCompatCullingResult } from "./FrustumCulling";
|
|
4
|
-
export { runThreeCompatOcclusionCulling } from "./OcclusionCulling";
|
|
5
|
-
export { BVHThreeCompat } from "./BVH";
|
|
6
|
-
export type { ThreeCompatBvhNode } from "./BVH";
|
|
7
|
-
export { estimateThreeCompatAcceleratedRaycast } from "./RaycastAcceleration";
|
|
8
|
-
export { LODSystemThreeCompat } from "./LODSystem";
|
|
9
|
-
export type { ThreeCompatLodLevel } from "./LODSystem";
|
|
10
|
-
export { TextureStreamingThreeCompat } from "./TextureStreaming";
|
|
11
|
-
export { createThreeCompatRendererProfile } from "./RendererProfiler";
|
|
12
|
-
export type { ThreeCompatRendererProfile } from "./RendererProfiler";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { bloomPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class BloomPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "BloomPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly strength = 0.45) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, bloom: frame.bloom + this.strength },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => bloomPixels(pixels, width, height, { threshold: 0.58, intensity: this.strength, radius: 2 }).pixels,
|
|
13
|
-
"bloomPixels kernel"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { colorGradePixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class ColorGradingPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "ColorGradingPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly contrast = 1.16, public readonly saturation = 1.08) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, contrast: frame.contrast * this.contrast, saturation: frame.saturation * this.saturation },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => colorGradePixels(pixels, width, height, { contrast: this.contrast, saturation: this.saturation, vibrance: 0.12, vignette: 0.1, sharpening: 0.12 }).pixels,
|
|
13
|
-
"colorGradePixels kernel"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { depthOfFieldPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, createThreeCompatDepthProxy, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class DepthOfFieldPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "DepthOfFieldPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly blur = 0.35) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, blur: frame.blur + this.blur },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => depthOfFieldPixels(pixels, width, height, {
|
|
13
|
-
depth: frame.depth ?? createThreeCompatDepthProxy(width, height),
|
|
14
|
-
focusDepth: 0.44,
|
|
15
|
-
focusRange: 0.09,
|
|
16
|
-
maxRadius: Math.max(1, Math.round(this.blur * 6))
|
|
17
|
-
}).pixels,
|
|
18
|
-
"depthOfFieldPixels kernel"
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ThreeCompatPostProcessFrame, ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
2
|
-
|
|
3
|
-
export class EffectComposerThreeCompat {
|
|
4
|
-
readonly passes: ThreeCompatPostProcessPass[] = [];
|
|
5
|
-
|
|
6
|
-
addPass(pass: ThreeCompatPostProcessPass): this {
|
|
7
|
-
this.passes.push(pass);
|
|
8
|
-
return this;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
render(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
12
|
-
return this.passes.reduce((current, pass) => pass.enabled ? pass.apply(current) : current, frame);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { fxaaPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class FXAAPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "FXAAPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
8
|
-
return applyThreeCompatPixelKernel(
|
|
9
|
-
{ ...frame, sharpness: frame.sharpness + 0.12 },
|
|
10
|
-
this.name,
|
|
11
|
-
(pixels, width, height) => fxaaPixels(pixels, width, height, { edgeThreshold: 0.08, subpixelBlend: 0.68 }).pixels,
|
|
12
|
-
"fxaaPixels kernel"
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { motionBlurPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, createThreeCompatVelocityProxy, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class MotionBlurPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "MotionBlurPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly blur = 0.18) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, blur: frame.blur + this.blur },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => motionBlurPixels(pixels, width, height, {
|
|
13
|
-
velocity: frame.velocity ?? createThreeCompatVelocityProxy(width, height),
|
|
14
|
-
samples: 5,
|
|
15
|
-
scale: Math.max(0.1, this.blur * 4)
|
|
16
|
-
}).pixels,
|
|
17
|
-
"motionBlurPixels kernel"
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { outlinePixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class OutlinePassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "OutlinePass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly strength = 0.5) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, outlines: frame.outlines + this.strength },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => outlinePixels(pixels, width, height, {
|
|
13
|
-
threshold: 0.08,
|
|
14
|
-
width: 2,
|
|
15
|
-
opacity: Math.min(1, 0.45 + this.strength * 0.5),
|
|
16
|
-
color: [64, 190, 255, 255]
|
|
17
|
-
}).pixels,
|
|
18
|
-
"outlinePixels kernel"
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import type { DepthTextureBinding } from "../../PostProcessPass";
|
|
2
|
-
import { countChangedRgb } from "../../production-runtime/postprocess/ProductionPostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export interface ThreeCompatPostProcessFrame {
|
|
5
|
-
readonly label: string;
|
|
6
|
-
readonly exposure: number;
|
|
7
|
-
readonly contrast: number;
|
|
8
|
-
readonly saturation: number;
|
|
9
|
-
readonly bloom: number;
|
|
10
|
-
readonly ambientOcclusion: number;
|
|
11
|
-
readonly sharpness: number;
|
|
12
|
-
readonly blur: number;
|
|
13
|
-
readonly vignette: number;
|
|
14
|
-
readonly outlines: number;
|
|
15
|
-
readonly width?: number;
|
|
16
|
-
readonly height?: number;
|
|
17
|
-
readonly pixels?: Uint8Array;
|
|
18
|
-
readonly depth?: DepthTextureBinding;
|
|
19
|
-
readonly history?: Uint8Array;
|
|
20
|
-
readonly velocity?: Float32Array;
|
|
21
|
-
readonly visualChangedPixels?: number;
|
|
22
|
-
readonly visualPasses?: readonly string[];
|
|
23
|
-
readonly visualDiagnostics?: readonly string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface ThreeCompatPostProcessPass {
|
|
27
|
-
readonly name: string;
|
|
28
|
-
readonly enabled: boolean;
|
|
29
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ThreeCompatBaseFrameOptions {
|
|
33
|
-
readonly width?: number;
|
|
34
|
-
readonly height?: number;
|
|
35
|
-
readonly pixels?: Uint8Array;
|
|
36
|
-
readonly depth?: DepthTextureBinding;
|
|
37
|
-
readonly history?: Uint8Array;
|
|
38
|
-
readonly velocity?: Float32Array;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function createThreeCompatBaseFrame(label = "source", options: ThreeCompatBaseFrameOptions = {}): ThreeCompatPostProcessFrame {
|
|
42
|
-
return {
|
|
43
|
-
label,
|
|
44
|
-
exposure: 1,
|
|
45
|
-
contrast: 1,
|
|
46
|
-
saturation: 1,
|
|
47
|
-
bloom: 0,
|
|
48
|
-
ambientOcclusion: 0,
|
|
49
|
-
sharpness: 0,
|
|
50
|
-
blur: 0,
|
|
51
|
-
vignette: 0,
|
|
52
|
-
outlines: 0,
|
|
53
|
-
...(options.width !== undefined ? { width: options.width } : {}),
|
|
54
|
-
...(options.height !== undefined ? { height: options.height } : {}),
|
|
55
|
-
...(options.pixels !== undefined ? { pixels: new Uint8Array(options.pixels) } : {}),
|
|
56
|
-
...(options.depth !== undefined ? { depth: options.depth } : {}),
|
|
57
|
-
...(options.history !== undefined ? { history: new Uint8Array(options.history) } : {}),
|
|
58
|
-
...(options.velocity !== undefined ? { velocity: new Float32Array(options.velocity) } : {}),
|
|
59
|
-
visualChangedPixels: 0,
|
|
60
|
-
visualPasses: [],
|
|
61
|
-
visualDiagnostics: []
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function createThreeCompatDemoFrame(label = "source", width = 64, height = 48): ThreeCompatPostProcessFrame {
|
|
66
|
-
const pixels = new Uint8Array(width * height * 4);
|
|
67
|
-
for (let y = 0; y < height; y += 1) {
|
|
68
|
-
for (let x = 0; x < width; x += 1) {
|
|
69
|
-
const index = (y * width + x) * 4;
|
|
70
|
-
let red = 20 + Math.round(x * 2.1);
|
|
71
|
-
let green = 24 + Math.round(y * 2);
|
|
72
|
-
let blue = 40 + Math.round((x + y) * 0.68);
|
|
73
|
-
if (x >= width * 0.18 && x <= width * 0.36 && y >= height * 0.16 && y <= height * 0.52) {
|
|
74
|
-
red = 248;
|
|
75
|
-
green = 202;
|
|
76
|
-
blue = 90;
|
|
77
|
-
}
|
|
78
|
-
if (x >= width * 0.58 && x <= width * 0.82 && y >= height * 0.22 && y <= height * 0.64) {
|
|
79
|
-
red = 54;
|
|
80
|
-
green = 190;
|
|
81
|
-
blue = 250;
|
|
82
|
-
}
|
|
83
|
-
if ((Math.abs(x - width * 0.49) < 1.2 || Math.abs(y - height * 0.72) < 1.2) && x > width * 0.1 && x < width * 0.9) {
|
|
84
|
-
red = 248;
|
|
85
|
-
green = 248;
|
|
86
|
-
blue = 242;
|
|
87
|
-
}
|
|
88
|
-
pixels[index] = red;
|
|
89
|
-
pixels[index + 1] = green;
|
|
90
|
-
pixels[index + 2] = blue;
|
|
91
|
-
pixels[index + 3] = 255;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return createThreeCompatBaseFrame(label, {
|
|
95
|
-
width,
|
|
96
|
-
height,
|
|
97
|
-
pixels,
|
|
98
|
-
depth: createThreeCompatDepthProxy(width, height),
|
|
99
|
-
history: createThreeCompatHistoryProxy(pixels, width, height),
|
|
100
|
-
velocity: createThreeCompatVelocityProxy(width, height)
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function applyThreeCompatPixelKernel(
|
|
105
|
-
frame: ThreeCompatPostProcessFrame,
|
|
106
|
-
passName: string,
|
|
107
|
-
transform: (pixels: Uint8Array, width: number, height: number) => Uint8Array,
|
|
108
|
-
diagnostic: string
|
|
109
|
-
): ThreeCompatPostProcessFrame {
|
|
110
|
-
if (!frame.pixels || !frame.width || !frame.height) {
|
|
111
|
-
return {
|
|
112
|
-
...frame,
|
|
113
|
-
visualDiagnostics: [...(frame.visualDiagnostics ?? []), `${passName}: no pixel buffer supplied; metrics updated only.`]
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const before = frame.pixels;
|
|
117
|
-
const after = transform(before, frame.width, frame.height);
|
|
118
|
-
const changed = countChangedRgb(before, after);
|
|
119
|
-
return {
|
|
120
|
-
...frame,
|
|
121
|
-
pixels: after,
|
|
122
|
-
visualChangedPixels: (frame.visualChangedPixels ?? 0) + changed,
|
|
123
|
-
visualPasses: [...(frame.visualPasses ?? []), passName],
|
|
124
|
-
visualDiagnostics: [...(frame.visualDiagnostics ?? []), `${passName}: ${diagnostic}; changedPixels=${changed}`]
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function createThreeCompatDepthProxy(width: number, height: number): DepthTextureBinding {
|
|
129
|
-
const data = new Float32Array(width * height);
|
|
130
|
-
for (let y = 0; y < height; y += 1) {
|
|
131
|
-
for (let x = 0; x < width; x += 1) {
|
|
132
|
-
let depth = y > height * 0.68 ? 0.58 : 0.82;
|
|
133
|
-
if (x >= width * 0.18 && x <= width * 0.36 && y >= height * 0.16 && y <= height * 0.52) depth = 0.28;
|
|
134
|
-
if (x >= width * 0.58 && x <= width * 0.82 && y >= height * 0.22 && y <= height * 0.64) depth = 0.42;
|
|
135
|
-
data[y * width + x] = depth;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return { label: "three-compat-postprocess-depth-proxy", width, height, format: "depth24", data };
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function createThreeCompatHistoryProxy(pixels: Uint8Array, width: number, height: number): Uint8Array {
|
|
142
|
-
const history = new Uint8Array(pixels.length);
|
|
143
|
-
for (let y = 0; y < height; y += 1) {
|
|
144
|
-
for (let x = 0; x < width; x += 1) {
|
|
145
|
-
const sourceX = Math.max(0, x - 2);
|
|
146
|
-
const source = (y * width + sourceX) * 4;
|
|
147
|
-
const target = (y * width + x) * 4;
|
|
148
|
-
history[target] = Math.max(0, (pixels[source] ?? 0) - 12);
|
|
149
|
-
history[target + 1] = Math.max(0, (pixels[source + 1] ?? 0) - 10);
|
|
150
|
-
history[target + 2] = Math.max(0, (pixels[source + 2] ?? 0) - 8);
|
|
151
|
-
history[target + 3] = pixels[source + 3] ?? 255;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return history;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function createThreeCompatVelocityProxy(width: number, height: number): Float32Array {
|
|
158
|
-
const velocity = new Float32Array(width * height * 2);
|
|
159
|
-
for (let y = 0; y < height; y += 1) {
|
|
160
|
-
for (let x = 0; x < width; x += 1) {
|
|
161
|
-
if (x < width * 0.78 && y > height * 0.14 && y < height * 0.7) {
|
|
162
|
-
const index = (y * width + x) * 2;
|
|
163
|
-
velocity[index] = 1.7;
|
|
164
|
-
velocity[index + 1] = x > width * 0.48 ? -0.65 : 0.32;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return velocity;
|
|
169
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ThreeCompatPostProcessFrame, ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
2
|
-
|
|
3
|
-
export class RenderPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
4
|
-
readonly name = "RenderPass";
|
|
5
|
-
readonly enabled = true;
|
|
6
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
7
|
-
return { ...frame, label: "rendered-scene" };
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { fxaaPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class SMAAPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "SMAAPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
8
|
-
return applyThreeCompatPixelKernel(
|
|
9
|
-
{ ...frame, sharpness: frame.sharpness + 0.16 },
|
|
10
|
-
this.name,
|
|
11
|
-
(pixels, width, height) => fxaaPixels(pixels, width, height, { edgeThreshold: 0.06, subpixelBlend: 0.72 }).pixels,
|
|
12
|
-
"FXAA-backed compatibility antialiasing kernel"
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ssaoPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, createThreeCompatDepthProxy, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class SSAOPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "SSAOPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly radius = 0.7) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, ambientOcclusion: frame.ambientOcclusion + this.radius },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => ssaoPixels(pixels, width, height, {
|
|
13
|
-
depth: frame.depth ?? createThreeCompatDepthProxy(width, height),
|
|
14
|
-
radius: Math.max(1, Math.round(this.radius * 3)),
|
|
15
|
-
intensity: Math.max(0.1, this.radius),
|
|
16
|
-
bias: 0.01
|
|
17
|
-
}).pixels,
|
|
18
|
-
"ssaoPixels kernel"
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ThreeCompatPostProcessFrame, ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
2
|
-
|
|
3
|
-
export class ShaderPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
4
|
-
readonly enabled = true;
|
|
5
|
-
constructor(public readonly name: string, private readonly transform: (frame: ThreeCompatPostProcessFrame) => ThreeCompatPostProcessFrame) {}
|
|
6
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame { return this.transform(frame); }
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { taaPixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, createThreeCompatHistoryProxy, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class TAAPassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "TAAPass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
8
|
-
return applyThreeCompatPixelKernel(
|
|
9
|
-
{ ...frame, sharpness: frame.sharpness + 0.18 },
|
|
10
|
-
this.name,
|
|
11
|
-
(pixels, width, height) => taaPixels(pixels, width, height, { history: frame.history ?? createThreeCompatHistoryProxy(pixels, width, height), blend: 0.22 }).pixels,
|
|
12
|
-
"taaPixels kernel"
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { colorGradePixels } from "../../PostProcessPass";
|
|
2
|
-
import { applyThreeCompatPixelKernel, type ThreeCompatPostProcessFrame, type ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
3
|
-
|
|
4
|
-
export class VignettePassThreeCompat implements ThreeCompatPostProcessPass {
|
|
5
|
-
readonly name = "VignettePass";
|
|
6
|
-
readonly enabled = true;
|
|
7
|
-
constructor(public readonly amount = 0.22) {}
|
|
8
|
-
apply(frame: ThreeCompatPostProcessFrame): ThreeCompatPostProcessFrame {
|
|
9
|
-
return applyThreeCompatPixelKernel(
|
|
10
|
-
{ ...frame, vignette: frame.vignette + this.amount },
|
|
11
|
-
this.name,
|
|
12
|
-
(pixels, width, height) => colorGradePixels(pixels, width, height, { vignette: this.amount, contrast: 1.02, saturation: 1 }).pixels,
|
|
13
|
-
"colorGradePixels vignette kernel"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { EffectComposerThreeCompat } from "./EffectComposer";
|
|
2
|
-
export { RenderPassThreeCompat } from "./RenderPass";
|
|
3
|
-
export { ShaderPassThreeCompat } from "./ShaderPass";
|
|
4
|
-
export { BloomPassThreeCompat } from "./BloomPass";
|
|
5
|
-
export { SSAOPassThreeCompat } from "./SSAOPass";
|
|
6
|
-
export { TAAPassThreeCompat } from "./TAAPass";
|
|
7
|
-
export { FXAAPassThreeCompat } from "./FXAAPass";
|
|
8
|
-
export { SMAAPassThreeCompat } from "./SMAAPass";
|
|
9
|
-
export { DepthOfFieldPassThreeCompat } from "./DepthOfFieldPass";
|
|
10
|
-
export { MotionBlurPassThreeCompat } from "./MotionBlurPass";
|
|
11
|
-
export { ColorGradingPassThreeCompat } from "./ColorGradingPass";
|
|
12
|
-
export { VignettePassThreeCompat } from "./VignettePass";
|
|
13
|
-
export { OutlinePassThreeCompat } from "./OutlinePass";
|
|
14
|
-
export { createThreeCompatBaseFrame, createThreeCompatDemoFrame } from "./PostProcessTypes";
|
|
15
|
-
export type { ThreeCompatBaseFrameOptions, ThreeCompatPostProcessFrame, ThreeCompatPostProcessPass } from "./PostProcessTypes";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatShaderNode {
|
|
2
|
-
readonly id: string;
|
|
3
|
-
readonly kind: "color" | "float" | "texture" | "math" | "output";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class NodeMaterialThreeCompat {
|
|
7
|
-
readonly type = "NodeMaterial";
|
|
8
|
-
readonly nodes: ThreeCompatShaderNode[] = [];
|
|
9
|
-
|
|
10
|
-
addNode(node: ThreeCompatShaderNode): this {
|
|
11
|
-
this.nodes.push(node);
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
compileGraph(): { readonly nodeCount: number; readonly hasOutput: boolean } {
|
|
16
|
-
return {
|
|
17
|
-
nodeCount: this.nodes.length,
|
|
18
|
-
hasOutput: this.nodes.some((node) => node.kind === "output")
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatShaderDiagnostic {
|
|
2
|
-
readonly pass: boolean;
|
|
3
|
-
readonly errors: readonly string[];
|
|
4
|
-
readonly warnings: readonly string[];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function diagnoseThreeCompatShader(vertexShader: string, fragmentShader: string): ThreeCompatShaderDiagnostic {
|
|
8
|
-
const errors = [
|
|
9
|
-
...(!vertexShader.includes("void main") ? ["vertex shader missing void main"] : []),
|
|
10
|
-
...(!fragmentShader.includes("void main") ? ["fragment shader missing void main"] : []),
|
|
11
|
-
...(/gl_FragColor/.test(fragmentShader) ? ["fragment shader uses legacy gl_FragColor; use explicit output for modern targets"] : [])
|
|
12
|
-
];
|
|
13
|
-
const warnings = [
|
|
14
|
-
...(!/precision\s+(highp|mediump)/.test(fragmentShader) ? ["fragment shader precision is implicit"] : [])
|
|
15
|
-
];
|
|
16
|
-
return { pass: errors.length === 0, errors, warnings };
|
|
17
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { UniformsThreeCompat } from "./Uniforms";
|
|
2
|
-
import { diagnoseThreeCompatShader, type ThreeCompatShaderDiagnostic } from "./ShaderDiagnostics";
|
|
3
|
-
|
|
4
|
-
export class ShaderMaterialThreeCompat {
|
|
5
|
-
readonly type: string = "ShaderMaterial";
|
|
6
|
-
readonly uniforms = new UniformsThreeCompat();
|
|
7
|
-
|
|
8
|
-
constructor(public vertexShader: string, public fragmentShader: string) {}
|
|
9
|
-
|
|
10
|
-
setUniform(name: string, value: number | boolean | string | readonly number[]): this {
|
|
11
|
-
this.uniforms.set(name, value);
|
|
12
|
-
return this;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
diagnose(): ThreeCompatShaderDiagnostic {
|
|
16
|
-
return diagnoseThreeCompatShader(this.vertexShader, this.fragmentShader);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export const SHADER_CHUNKS_THREE_COMPAT = {
|
|
2
|
-
colorManagement: "vec3 linearToOutput(vec3 color) { return pow(color, vec3(1.0 / 2.2)); }",
|
|
3
|
-
pbrLighting: "vec3 applyPbrLight(vec3 baseColor, float roughness) { return baseColor * (1.0 - roughness * 0.35); }",
|
|
4
|
-
fog: "vec3 applyFog(vec3 color, float depth) { return mix(color, vec3(0.02, 0.03, 0.05), clamp(depth, 0.0, 1.0)); }",
|
|
5
|
-
screenUv: "vec2 getScreenUv(vec2 fragCoord, vec2 resolution) { return fragCoord / resolution; }"
|
|
6
|
-
} as const;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type ThreeCompatUniformValue = number | boolean | string | readonly number[];
|
|
2
|
-
|
|
3
|
-
export class UniformsThreeCompat {
|
|
4
|
-
private readonly values = new Map<string, ThreeCompatUniformValue>();
|
|
5
|
-
|
|
6
|
-
set(name: string, value: ThreeCompatUniformValue): this {
|
|
7
|
-
this.values.set(name, value);
|
|
8
|
-
return this;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get(name: string): ThreeCompatUniformValue | undefined {
|
|
12
|
-
return this.values.get(name);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
entries(): readonly [string, ThreeCompatUniformValue][] {
|
|
16
|
-
return [...this.values.entries()];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { ShaderMaterialThreeCompat } from "./ShaderMaterial";
|
|
2
|
-
export { RawShaderMaterialThreeCompat } from "./RawShaderMaterial";
|
|
3
|
-
export { UniformsThreeCompat } from "./Uniforms";
|
|
4
|
-
export type { ThreeCompatUniformValue } from "./Uniforms";
|
|
5
|
-
export { SHADER_CHUNKS_THREE_COMPAT } from "./ThreeCompatShaderChunks";
|
|
6
|
-
export { NodeMaterialThreeCompat } from "./NodeMaterial";
|
|
7
|
-
export type { ThreeCompatShaderNode } from "./NodeMaterial";
|
|
8
|
-
export { diagnoseThreeCompatShader } from "./ShaderDiagnostics";
|
|
9
|
-
export type { ThreeCompatShaderDiagnostic } from "./ShaderDiagnostics";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatLineSegment {
|
|
2
|
-
readonly from: readonly [number, number, number];
|
|
3
|
-
readonly to: readonly [number, number, number];
|
|
4
|
-
readonly width: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export class LineThreeCompatRenderer {
|
|
8
|
-
readonly segments: ThreeCompatLineSegment[] = [];
|
|
9
|
-
|
|
10
|
-
addSegment(segment: ThreeCompatLineSegment): void {
|
|
11
|
-
this.segments.push(segment);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatParticle {
|
|
2
|
-
readonly x: number;
|
|
3
|
-
readonly y: number;
|
|
4
|
-
readonly z: number;
|
|
5
|
-
readonly life: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class ParticleSystemThreeCompat {
|
|
9
|
-
readonly particles: ThreeCompatParticle[] = [];
|
|
10
|
-
|
|
11
|
-
emit(count: number): void {
|
|
12
|
-
for (let index = 0; index < count; index++) {
|
|
13
|
-
this.particles.push({ x: index % 32, y: Math.floor(index / 32), z: 0, life: 1 });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
update(delta: number): void {
|
|
18
|
-
for (let index = 0; index < this.particles.length; index++) {
|
|
19
|
-
const particle = this.particles[index];
|
|
20
|
-
this.particles[index] = { ...particle, y: particle.y + delta, life: Math.max(0, particle.life - delta * 0.1) };
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|