rayzee 11.13.0 → 11.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -22
- package/dist/{ActiveColor-YvuQq44O.js → ActiveColor-DakLCifA.js} +1 -1
- package/dist/{ArchiveImporter-DQU55mit.js → ArchiveImporter-DuWqpbXf.js} +282 -277
- package/dist/{BidirectionalIntegrator-CLmFjSN3.js → BidirectionalIntegrator-BEXXxmZH.js} +199 -198
- package/dist/{BufferLayout-BROyMqO1.js → BufferLayout-ny3WneEc.js} +1 -1
- package/dist/ColorManagement-CKN2pTRS.js +2537 -0
- package/dist/DepthPass-u5g7hr7J.js +68 -0
- package/dist/{EngineEvents-CLckhYbL.js → EngineEvents-oQGofgRf.js} +16 -2
- package/dist/{EngineIssues-CfJiBaNj.js → EngineIssues-t5p7TEjb.js} +2 -0
- package/dist/{FileFormats-sPGJeCRc.js → FileFormats-C91JE5DM.js} +1 -1
- package/dist/LocalExposure-Cw1g8rdU.js +344 -0
- package/dist/{Logger-dDDGj9Av.js → Logger-CH-TZ1co.js} +1 -1
- package/dist/{NeuralRetouch-CEkBhI1M.js → NeuralRetouch-CLtoW6Vt.js} +5 -5
- package/dist/{NeuralSuperRes-Drjws9nE.js → NeuralSuperRes-PlLjWpMF.js} +14 -14
- package/dist/{SolarLimb-ZYl-Pwl0.js → PackedRayBuffer-DwhV931f.js} +8 -12
- package/dist/{PathTracer-7a7L3cGF.js → PathTracer-BMtUFjdP.js} +5263 -4868
- package/dist/{PhysicalSky-DUIbTE93.js → PhysicalSky-DqanSS2m.js} +49 -48
- package/dist/PictureView-DpHE_jDr.js +96 -0
- package/dist/RayzeeRenderer-C9zGAMJo.js +3281 -0
- package/dist/{sceneCachePolicy-DavHt6Ii.js → SceneMetadata-BUfzHMSj.js} +335 -608
- package/dist/SolarLimb-BiVdxxmL.js +8 -0
- package/dist/TextureBuckets-D09iX9_y.js +308 -0
- package/dist/TextureSampling-CvMi8LNc.js +904 -0
- package/dist/{ToneMapGPU-4GPwoG_c.js → ToneMapGPU-tJZo_-7S.js} +22 -12
- package/dist/{ViewTransforms-CYN7bq2w.js → ViewTransforms-Bh7hSjSb.js} +1 -1
- package/dist/{WorkingMatrix-C6y233hT.js → WorkingMatrix-CDGicYGE.js} +1 -1
- package/dist/{ZipReader-gDSWr0I5.js → ZipReader-KPFbIuOs.js} +1 -1
- package/dist/addons/archives.es.js +2 -2
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/color.es.js +3 -3
- package/dist/addons/formats.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/addons/storage.es.js +3 -3
- package/dist/archiveFormats-j39rQeKs.js +37 -0
- package/dist/encoders.es.js +942 -0
- package/dist/identity-x_UfobDa.js +65 -0
- package/dist/{openStorage-CdyVjmps.js → openStorage-CxLMw2_a.js} +61 -62
- package/dist/rayzee-core.es.js +13 -12
- package/dist/rayzee.es.js +795 -1053
- package/dist/rayzee.umd.js +163 -115
- package/package.json +5 -2
- package/src/AssetConfig.js +1 -1
- package/src/EngineDefaults.js +1 -1
- package/src/EngineEvents.js +26 -0
- package/src/EngineIssues.js +2 -0
- package/src/Platform.js +40 -0
- package/src/RayzeeRenderer.js +221 -1111
- package/src/RenderSettings.js +3 -3
- package/src/addons/archives.js +2 -2
- package/src/addons/bidirectional.js +1 -1
- package/src/addons/color.js +6 -6
- package/src/addons/formats.js +1 -1
- package/src/addons/physicalSky.js +1 -1
- package/src/addons/storage.js +3 -3
- package/src/{Processor → bvh}/BVHBuilder.js +2 -2
- package/src/{Processor → bvh}/BVHLeafFold.js +1 -1
- package/src/{Processor/Workers → bvh}/BVHRefitWorker.js +2 -2
- package/src/{Processor → bvh}/BVHRefitter.js +1 -1
- package/src/{Processor/Workers → bvh}/BVHSubtreeWorker.js +2 -2
- package/src/{Processor/Workers → bvh}/BVHWorker.js +3 -3
- package/src/{Processor → bvh}/ParallelBVHBuilder.js +3 -3
- package/src/{Processor → bvh}/SplitBLAS.js +2 -2
- package/src/{Processor → bvh}/TLASBuilder.js +4 -4
- package/src/{Processor/Workers → bvh}/TLASWorker.js +2 -2
- package/src/{Color → color}/BakedViews.js +5 -1
- package/src/{Color → color}/BasicColor.js +7 -0
- package/src/{Color → color}/ColorManagement.js +132 -64
- package/src/{Color → color}/Displays.js +35 -0
- package/src/{Color → color}/LutBake.js +163 -9
- package/src/{Color → color}/OcioRuntime.js +1 -1
- package/src/color/OcioViews.js +1086 -0
- package/src/core.js +8 -8
- package/src/{Processor/Workers → environment}/CDFWorker.js +1 -1
- package/src/{Processor → environment}/EnvironmentExactTable.js +2 -2
- package/src/{managers → environment}/EnvironmentManager.js +10 -10
- package/src/{Processor → environment}/EquirectHDRInfo.js +1 -1
- package/src/{Processor → environment}/PhysicalSky.js +5 -5
- package/src/{Processor → environment}/SolarLimb.js +1 -1
- package/src/index.js +46 -46
- package/src/{Processor → lights}/EmissiveTriangleBuilder.js +5 -5
- package/src/{managers → lights}/LightManager.js +3 -3
- package/src/{Processor → lights}/LightSerializer.js +1 -1
- package/src/{Processor → loaders}/AssetLoader.js +115 -11
- package/src/loaders/SceneLoading.js +730 -0
- package/src/{Processor → loaders/archives}/ArchiveCache.js +3 -3
- package/src/{Processor → loaders/archives}/ArchiveImporter.js +15 -15
- package/src/{Processor/PBRT → loaders/pbrt}/PBRTSceneBuilder.js +2 -3
- package/src/{Processor/USD → loaders/usd}/USDScene.js +1 -1
- package/src/{Processor/USD → loaders/usd}/index.js +1 -1
- package/src/{managers → materials}/MaterialDataManager.js +8 -8
- package/src/{Processor → materials}/MaterialPacking.js +1 -1
- package/src/{Processor/Workers → materials}/PackWorker.js +1 -1
- package/src/{Processor → materials}/TextureCreator.js +160 -54
- package/src/{Processor/Workers → materials}/TexturesWorker.js +11 -14
- package/src/{Processor → memory}/HostMemory.js +1 -1
- package/src/memory/SceneSpill.js +477 -0
- package/src/node/nodePlatform.js +4 -2
- package/src/output/ImageEncoders.js +1306 -0
- package/src/output/Pictures.js +460 -0
- package/src/{Processor → output}/ToneMapCPU.js +37 -11
- package/src/{Processor → output}/ToneMapGPU.js +54 -8
- package/src/{integrators → pathtracer}/BidirectionalIntegrator.js +16 -16
- package/src/{Processor → pathtracer}/KernelManager.js +29 -4
- package/src/{Processor → pathtracer}/PackedRayBuffer.js +3 -3
- package/src/{Stages → pathtracer}/PathTracer.js +294 -180
- package/src/{Stages → pathtracer}/PathTracerStage.js +84 -26
- package/src/{Processor → pathtracer}/QueueManager.js +42 -13
- package/src/{Processor → pathtracer}/ShaderBuilder.js +1 -1
- package/src/{Processor → pathtracer}/StorageTexturePool.js +2 -2
- package/src/{managers → pathtracer}/UniformManager.js +2 -2
- package/src/{Pipeline → pipeline}/CompletionTracker.js +8 -1
- package/src/{Stages → pipeline}/Compositor.js +128 -21
- package/src/{Processor → scene}/BuildTimer.js +1 -1
- package/src/{Processor → scene}/GeometryExtractor.js +46 -6
- package/src/scene/SceneEdits.js +260 -0
- package/src/{Processor → scene}/SceneProcessor.js +65 -1106
- package/src/scene/SceneRefit.js +823 -0
- package/src/{TSL → shaders}/Atmosphere.js +1 -1
- package/src/{TSL → shaders}/BVHTraversal.js +1 -1
- package/src/{TSL → shaders}/CameraRay.js +1 -1
- package/src/{TSL → shaders}/Common.js +1 -1
- package/src/{TSL → shaders}/EmissiveSampling.js +1 -1
- package/src/{TSL → shaders}/Environment.js +1 -1
- package/src/{TSL → shaders}/LightGuide.js +1 -1
- package/src/{TSL → shaders}/LightVisibility.js +1 -1
- package/src/{TSL → shaders}/Sun.js +1 -1
- package/src/{TSL → shaders}/TextureSampling.js +1 -1
- package/src/{TSL → shaders/kernels}/CompactKernel.js +2 -2
- package/src/{TSL → shaders/kernels}/ConnectKernel.js +10 -10
- package/src/{TSL → shaders/kernels}/DebugKernel.js +4 -4
- package/src/shaders/kernels/DepthPass.js +146 -0
- package/src/{TSL → shaders/kernels}/ExtendKernel.js +5 -5
- package/src/{TSL → shaders/kernels}/FinalWriteKernel.js +14 -4
- package/src/{TSL → shaders/kernels}/GenerateKernel.js +5 -5
- package/src/{TSL → shaders/kernels}/LightGenerateKernel.js +14 -14
- package/src/{TSL → shaders/kernels}/LightSplatKernel.js +9 -9
- package/src/{TSL → shaders/kernels}/MergeKernel.js +7 -7
- package/src/{TSL → shaders/kernels}/ShadeKernel.js +27 -27
- package/src/{TSL → shaders/kernels}/SortGlobalKernels.js +2 -2
- package/src/{TSL → shaders}/patches.js +1 -1
- package/src/{Storage → storage}/BLASCache.js +1 -1
- package/src/{Storage → storage}/DownloadCache.js +10 -0
- package/src/{Storage → storage}/SceneGraphCodec.js +17 -2
- package/src/{Headless.js → viewer/Headless.js} +15 -3
- package/src/{PathTracerApp.js → viewer/PathTracerApp.js} +54 -32
- package/src/{SceneState → viewer}/SceneState.js +3 -3
- package/src/{managers → viewer/animation}/AnimationManager.js +1 -1
- package/src/{managers/timeline → viewer/animation}/CameraTrack.js +1 -1
- package/src/{managers/timeline → viewer/animation}/TimelineManager.js +1 -1
- package/src/{managers → viewer/animation}/VideoRenderManager.js +10 -6
- package/src/{managers → viewer/camera}/CameraManager.js +10 -10
- package/src/{managers → viewer/camera}/InteractionManager.js +4 -4
- package/src/{Stages → viewer/denoise}/DenoiserSettings.js +1 -1
- package/src/{managers → viewer/denoise}/DenoisingManager.js +27 -17
- package/src/{Stages → viewer/denoise}/MotionVector.js +3 -3
- package/src/{Stages → viewer/denoise}/NRD.js +4 -4
- package/src/{Stages → viewer/denoise}/NormalDepth.js +8 -8
- package/src/{Passes → viewer/denoise}/OIDNDenoiser.js +94 -25
- package/src/{Passes → viewer/denoise}/OIDNTemporalHistory.js +1 -1
- package/src/{managers → viewer/lights}/GoboManager.js +3 -3
- package/src/{managers → viewer/lights}/IESManager.js +4 -4
- package/src/{Processor → viewer/lights}/IESParser.js +1 -1
- package/src/{managers → viewer/overlays}/OverlayManager.js +10 -10
- package/src/{managers/helpers → viewer/overlays}/TransformGizmoHelper.js +1 -1
- package/src/{managers → viewer/overlays}/TransformManager.js +1 -1
- package/src/{managers/helpers → viewer/overlays}/ViewOverlayRenderer.js +2 -12
- package/src/{Passes → viewer/picture}/AIUpscaler.js +3 -3
- package/src/{Processor/Workers → viewer/picture}/AIUpscalerWorker.js +2 -2
- package/src/{Stages → viewer/picture}/AutoExposure.js +2 -2
- package/src/{Stages → viewer/picture}/LocalExposure.js +2 -2
- package/src/{neural → viewer/picture}/NeuralRetouch.js +3 -3
- package/src/{neural → viewer/picture}/NeuralSuperRes.js +5 -5
- package/src/viewer/picture/PictureView.js +205 -0
- package/dist/ColorManagement-3xw0xXRg.js +0 -1973
- package/dist/RayzeeRenderer-CjjGT2e0.js +0 -3717
- package/dist/SceneMetadata-CoAHTAmo.js +0 -183
- package/dist/identity-C1cLD1C0.js +0 -49
- package/dist/shared-BGBcSxBQ.js +0 -17
- package/src/Color/OcioViews.js +0 -633
- package/src/Processor/generateMaterialSpheres.js +0 -71
- package/src/Processor/utils.js +0 -613
- /package/dist/{AssetConfig-DSEntE65.js → AssetConfig-C8BsprCp.js} +0 -0
- /package/src/{utils/Logger.js → Logger.js} +0 -0
- /package/src/{Processor → bvh}/ReinsertionOptimizer.js +0 -0
- /package/src/{Color → color}/ActiveColor.js +0 -0
- /package/src/{Color → color}/BuiltinViews.js +0 -0
- /package/src/{Color → color}/ColorSpaces.js +0 -0
- /package/src/{Color → color}/InputColorSpaces.js +0 -0
- /package/src/{Color → color}/ViewTransforms.js +0 -0
- /package/src/{Color → color}/WorkingMatrix.js +0 -0
- /package/src/{Processor → environment}/AtmosphereModel.js +0 -0
- /package/src/{Processor → environment}/SimpleSky.js +0 -0
- /package/src/{Processor → environment}/SunPosition.js +0 -0
- /package/src/{Processor → lights}/LightBVHBuilder.js +0 -0
- /package/src/{Processor → lights}/blackbody.js +0 -0
- /package/src/{Processor → loaders}/FileFormats.js +0 -0
- /package/src/{Processor → loaders}/GLTFDecoders.js +0 -0
- /package/src/{Processor → loaders}/GLTFDiffuseTransmission.js +0 -0
- /package/src/{Processor → loaders}/PlatformImageLoader.js +0 -0
- /package/src/{Processor → loaders}/SceneMetadata.js +0 -0
- /package/src/{Processor → loaders/archives}/ArchiveReader.js +0 -0
- /package/src/{Processor → loaders/archives}/ZipReader.js +0 -0
- /package/src/{Processor → loaders/archives}/archiveFormats.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/EqualAreaOctahedral.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/LoopSubdivision.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTAnimation.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTCurves.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTMaterials.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTMath.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTParser.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTScattering.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTTextureBake.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PBRTTokenizer.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/PFM.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/buffers.js +0 -0
- /package/src/{Processor/PBRT → loaders/pbrt}/index.js +0 -0
- /package/src/{Processor/USD → loaders/usd}/USDLayer.js +0 -0
- /package/src/{Processor/USD → loaders/usd}/USDStage.js +0 -0
- /package/src/{Processor/USD → loaders/usd}/USDText.js +0 -0
- /package/src/{Processor → materials}/ResampleRGBA8.js +0 -0
- /package/src/{Processor → materials}/TextureBuckets.js +0 -0
- /package/src/{Processor → memory}/ChunkedRecords.js +0 -0
- /package/src/{Processor → memory}/VRAMTracker.js +0 -0
- /package/src/{Processor → output}/TextureReadback.js +0 -0
- /package/src/{Processor → pathtracer}/CameraOptimizer.js +0 -0
- /package/src/{Pipeline → pipeline}/BindingAudit.js +0 -0
- /package/src/{Pipeline → pipeline}/EventDispatcher.js +0 -0
- /package/src/{Pipeline → pipeline}/PipelineContext.js +0 -0
- /package/src/{Pipeline → pipeline}/RenderPipeline.js +0 -0
- /package/src/{Pipeline → pipeline}/RenderStage.js +0 -0
- /package/src/{SceneState/portable.js → portable.js} +0 -0
- /package/src/{Processor → scene}/BufferLayout.js +0 -0
- /package/src/{Processor → scene}/InstanceTable.js +0 -0
- /package/src/{SceneHelpers.js → scene/SceneHelpers.js} +0 -0
- /package/src/{managers → scene}/ViewCamera.js +0 -0
- /package/src/{TSL → shaders}/Bidirectional.js +0 -0
- /package/src/{TSL → shaders}/BidirectionalLamps.js +0 -0
- /package/src/{TSL → shaders}/Clearcoat.js +0 -0
- /package/src/{TSL → shaders}/Debugger.js +0 -0
- /package/src/{TSL → shaders}/Displacement.js +0 -0
- /package/src/{TSL → shaders}/EnvironmentCDF.js +0 -0
- /package/src/{TSL → shaders}/Fresnel.js +0 -0
- /package/src/{TSL → shaders}/HitFacet.js +0 -0
- /package/src/{TSL → shaders}/LightBVHSampling.js +0 -0
- /package/src/{TSL → shaders}/LightsCore.js +0 -0
- /package/src/{TSL → shaders}/LightsDirect.js +0 -0
- /package/src/{TSL → shaders}/LightsIndirect.js +0 -0
- /package/src/{TSL → shaders}/LightsSampling.js +0 -0
- /package/src/{TSL → shaders}/MaterialEvaluation.js +0 -0
- /package/src/{TSL → shaders}/MaterialProperties.js +0 -0
- /package/src/{TSL → shaders}/MaterialSampling.js +0 -0
- /package/src/{TSL → shaders}/MaterialTransmission.js +0 -0
- /package/src/{TSL → shaders}/PathTracerCore.js +0 -0
- /package/src/{TSL → shaders}/Random.js +0 -0
- /package/src/{TSL → shaders}/SceneResources.js +0 -0
- /package/src/{TSL → shaders}/ShadowTerminator.js +0 -0
- /package/src/{TSL → shaders}/Struct.js +0 -0
- /package/src/{TSL → shaders}/Subsurface.js +0 -0
- /package/src/{Storage → storage}/CDFCache.js +0 -0
- /package/src/{Storage → storage}/GeometrySpill.js +0 -0
- /package/src/{Storage → storage}/SpillStore.js +0 -0
- /package/src/{Storage → storage}/StorageManager.js +0 -0
- /package/src/{Storage → storage}/StorageOps.js +0 -0
- /package/src/{Storage → storage}/StorageWorker.js +0 -0
- /package/src/{Storage → storage}/areas.js +0 -0
- /package/src/{Storage → storage}/events.js +0 -0
- /package/src/{Storage → storage}/identity.js +0 -0
- /package/src/{Storage → storage}/index.js +0 -0
- /package/src/{Storage → storage}/inlineTransport.js +0 -0
- /package/src/{Storage → storage}/locks.js +0 -0
- /package/src/{Storage → storage}/openStorage.js +0 -0
- /package/src/{Storage → storage}/sceneCachePolicy.js +0 -0
- /package/src/{Storage → storage}/shared.js +0 -0
- /package/src/{Storage → storage}/transport.js +0 -0
- /package/src/{managers → viewer/camera}/WalkControls.js +0 -0
- /package/src/{managers/helpers → viewer/overlays}/OutlineHelper.js +0 -0
- /package/src/{managers/helpers → viewer/overlays}/TileHelper.js +0 -0
- /package/src/{managers/helpers → viewer/overlays}/overlaySurface.js +0 -0
|
@@ -1,14 +1,55 @@
|
|
|
1
|
-
import { BufferAttribute, Vector3, Vector2, Color, Matrix3, Matrix4, FrontSide, BackSide, DoubleSide, RGBAFormat } from "three";
|
|
1
|
+
import { Box3, BufferAttribute, Vector3, Vector2, Color, Matrix3, Matrix4, FrontSide, BackSide, DoubleSide, RGBAFormat } from "three";
|
|
2
2
|
import { MATERIAL_DEFAULTS } from '../EngineDefaults.js';
|
|
3
3
|
import { TRIANGLE_DATA_LAYOUT, packNormalOct, packTriangleFlags } from './BufferLayout.js';
|
|
4
|
-
import { TEXTURE_CONSTANTS } from '
|
|
4
|
+
import { TEXTURE_CONSTANTS } from '../materials/TextureBuckets.js';
|
|
5
5
|
import { ISSUE_CODES } from '../EngineIssues.js';
|
|
6
|
-
import { ChunkedRecords, SHARED_MEMORY_AVAILABLE } from '
|
|
7
|
-
import { createLogger, fmt, warnOnce } from '../
|
|
8
|
-
import { GeometrySpill } from '../
|
|
6
|
+
import { ChunkedRecords, SHARED_MEMORY_AVAILABLE } from '../memory/ChunkedRecords.js';
|
|
7
|
+
import { createLogger, fmt, warnOnce } from '../Logger.js';
|
|
8
|
+
import { GeometrySpill } from '../storage/GeometrySpill.js';
|
|
9
9
|
|
|
10
10
|
const log = createLogger( 'geometry' );
|
|
11
11
|
|
|
12
|
+
/** InstancedMesh.computeBoundingBox, bit for bit, for each instanced mesh under `object` without a box yet. */
|
|
13
|
+
export function computeInstanceBoundingBoxes( object ) {
|
|
14
|
+
|
|
15
|
+
object.traverse( mesh => {
|
|
16
|
+
|
|
17
|
+
if ( ! mesh.isInstancedMesh || mesh.boundingBox !== null ) return;
|
|
18
|
+
const geometry = mesh.geometry;
|
|
19
|
+
if ( geometry.boundingBox === null ) geometry.computeBoundingBox();
|
|
20
|
+
const box = mesh.boundingBox = new Box3();
|
|
21
|
+
const local = geometry.boundingBox;
|
|
22
|
+
if ( local.isEmpty() ) return;
|
|
23
|
+
|
|
24
|
+
const xs = [ local.min.x, local.max.x ], ys = [ local.min.y, local.max.y ], zs = [ local.min.z, local.max.z ];
|
|
25
|
+
const m = mesh.instanceMatrix.array;
|
|
26
|
+
let x0 = Infinity, y0 = Infinity, z0 = Infinity, x1 = - Infinity, y1 = - Infinity, z1 = - Infinity;
|
|
27
|
+
for ( let i = 0, o = 0; i < mesh.count; i ++, o += 16 ) {
|
|
28
|
+
|
|
29
|
+
const e0 = m[ o ], e1 = m[ o + 1 ], e2 = m[ o + 2 ], e3 = m[ o + 3 ], e4 = m[ o + 4 ], e5 = m[ o + 5 ], e6 = m[ o + 6 ], e7 = m[ o + 7 ];
|
|
30
|
+
const e8 = m[ o + 8 ], e9 = m[ o + 9 ], e10 = m[ o + 10 ], e11 = m[ o + 11 ], e12 = m[ o + 12 ], e13 = m[ o + 13 ], e14 = m[ o + 14 ], e15 = m[ o + 15 ];
|
|
31
|
+
for ( let c = 0; c < 8; c ++ ) {
|
|
32
|
+
|
|
33
|
+
const x = xs[ c >> 2 ], y = ys[ ( c >> 1 ) & 1 ], z = zs[ c & 1 ];
|
|
34
|
+
// Vector3.applyMatrix4's operations, in its order.
|
|
35
|
+
const w = 1 / ( e3 * x + e7 * y + e11 * z + e15 );
|
|
36
|
+
const px = ( e0 * x + e4 * y + e8 * z + e12 ) * w;
|
|
37
|
+
const py = ( e1 * x + e5 * y + e9 * z + e13 ) * w;
|
|
38
|
+
const pz = ( e2 * x + e6 * y + e10 * z + e14 ) * w;
|
|
39
|
+
x0 = Math.min( x0, px ); y0 = Math.min( y0, py ); z0 = Math.min( z0, pz );
|
|
40
|
+
x1 = Math.max( x1, px ); y1 = Math.max( y1, py ); z1 = Math.max( z1, pz );
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
box.min.set( x0, y0, z0 );
|
|
47
|
+
box.max.set( x1, y1, z1 );
|
|
48
|
+
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
12
53
|
const MAX_TEXTURES_LIMIT = TEXTURE_CONSTANTS.MAX_TEXTURES_LIMIT;
|
|
13
54
|
|
|
14
55
|
const COLOR_DEFAULTS = new Set( [ 'color', 'emissive', 'attenuationColor', 'sheenColor', 'specularColor', 'subsurfaceColor', 'diffuseTransmissionColor' ] );
|
|
@@ -1062,7 +1103,6 @@ export class GeometryExtractor {
|
|
|
1062
1103
|
|
|
1063
1104
|
}
|
|
1064
1105
|
|
|
1065
|
-
|
|
1066
1106
|
getMaterialType( material ) {
|
|
1067
1107
|
|
|
1068
1108
|
// Detect material type for appropriate property mapping
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { SRGBColorSpace, LinearSRGBColorSpace } from 'three/webgpu';
|
|
2
|
+
import { ISSUE_CODES } from '../EngineIssues.js';
|
|
3
|
+
import { TRIANGLE_PATCH_PROPERTIES } from '../materials/MaterialDataManager.js';
|
|
4
|
+
import { usesTextureCoordinates } from './GeometryExtractor.js';
|
|
5
|
+
import { scheduleRespill } from '../memory/SceneSpill.js';
|
|
6
|
+
|
|
7
|
+
export async function refitBVH( app, newPositions, newNormals ) {
|
|
8
|
+
|
|
9
|
+
await app.ensureSceneResident();
|
|
10
|
+
const { triRanges, bvhRanges, ...result } = await app._sdf.refitBVH( newPositions, newNormals );
|
|
11
|
+
|
|
12
|
+
app.stages.pathTracer.updateTriangleData( app._sdf.triangles, triRanges );
|
|
13
|
+
app.stages.pathTracer.updateBVHData( app._sdf.bvh, bvhRanges );
|
|
14
|
+
app.reset( false, { motion: true } );
|
|
15
|
+
|
|
16
|
+
return result;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function refitBLASes( app, affectedMeshIndices, newPositions, newNormals ) {
|
|
21
|
+
|
|
22
|
+
if ( app._sdf?.spilled ) throw new Error( 'refitBLASes: the scene is spilled to disk — await app.ensureSceneResident() first' );
|
|
23
|
+
const result = app._sdf.refitBLASes( affectedMeshIndices, newPositions, newNormals );
|
|
24
|
+
|
|
25
|
+
const { triRanges, bvhRanges } = app._sdf.computeBLASDirtyRanges( affectedMeshIndices );
|
|
26
|
+
app.stages.pathTracer.updateBufferRanges( triRanges, bvhRanges );
|
|
27
|
+
app.reset( false, { motion: true } );
|
|
28
|
+
|
|
29
|
+
// Kick off background rebuild for optimal SAH quality
|
|
30
|
+
app._sdf.scheduleBackgroundRebuild( affectedMeshIndices, ( meshIndex ) => {
|
|
31
|
+
|
|
32
|
+
// Swap complete — upload just that mesh's triangles and nodes, plus the TLAS. A whole
|
|
33
|
+
// re-upload here is gigabytes on a large scene, for one mesh's worth of change.
|
|
34
|
+
const dirty = app._sdf.computeBLASDirtyRanges( [ meshIndex ] );
|
|
35
|
+
app.stages.pathTracer.updateBufferRanges( dirty.triRanges, dirty.bvhRanges );
|
|
36
|
+
app.reset( false, { motion: true } );
|
|
37
|
+
|
|
38
|
+
} );
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function updateMeshTransforms( app, meshIndices ) {
|
|
45
|
+
|
|
46
|
+
// A spilled scene's matrix lists, TLAS or copy records are on disk: the move lands once they are back.
|
|
47
|
+
if ( app._sdf?.needsPageInForMove( meshIndices ) ) {
|
|
48
|
+
|
|
49
|
+
app._sdf.ensureMovable( meshIndices )
|
|
50
|
+
.then( () => app.updateMeshTransforms( meshIndices ) )
|
|
51
|
+
.catch( error => app._issues.warn( ISSUE_CODES.STORAGE_READ_FAILED, `reading instance matrices back failed: ${error.message}` ) );
|
|
52
|
+
return null;
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
app._notePlacementsMoving( meshIndices );
|
|
57
|
+
const result = app._sdf.updateMeshTransforms( meshIndices );
|
|
58
|
+
|
|
59
|
+
app.stages.pathTracer.updateBufferRanges( [], app._sdf.takeMoveRanges() );
|
|
60
|
+
app.reset( false, { motion: true } );
|
|
61
|
+
scheduleRespill( app );
|
|
62
|
+
|
|
63
|
+
return result;
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getMaterialProperty( app, materialIndex, property ) {
|
|
68
|
+
|
|
69
|
+
return app.stages.pathTracer?.materialData.getMaterialProperty( materialIndex, property );
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getMaterialPropertySource( app, materialIndex, property ) {
|
|
74
|
+
|
|
75
|
+
return app.stages.pathTracer?.materialData.getMaterialPropertySource( materialIndex, property );
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function setMaterialProperty( app, materialIndex, property, value ) {
|
|
80
|
+
|
|
81
|
+
// These rewrite triangle records, which a spilled scene has to read back first.
|
|
82
|
+
if ( app._sdf?.spilled && TRIANGLE_PATCH_PROPERTIES.has( property ) ) {
|
|
83
|
+
|
|
84
|
+
app.ensureSceneResident().then( () => app.setMaterialProperty( materialIndex, property, value ) );
|
|
85
|
+
return;
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
app.stages.pathTracer?.materialData.updateMaterialProperty( materialIndex, property, value );
|
|
90
|
+
|
|
91
|
+
// Keep the emissive-NEE structure in sync unconditionally (not gated on the
|
|
92
|
+
// sampling toggle) so edits made while NEE is off aren't lost on re-enable.
|
|
93
|
+
const emissiveAffectingProps = [ 'emissive', 'emissiveIntensity' ];
|
|
94
|
+
if ( emissiveAffectingProps.includes( property ) && app._sdf ) {
|
|
95
|
+
|
|
96
|
+
app._uploadEmissivePayload( app._sdf.updateMaterialEmissive( materialIndex, property, value ) );
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
app.reset();
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Upload a rebuilt emissive-NEE payload (sorted emissive data + Light BVH +
|
|
106
|
+
* bit-trail map) to the path tracer stage. No-op for a null payload.
|
|
107
|
+
* @param {object|null} payload
|
|
108
|
+
*/
|
|
109
|
+
export function uploadEmissivePayload( app, payload ) {
|
|
110
|
+
|
|
111
|
+
if ( ! payload || ! app.stages.pathTracer ) return;
|
|
112
|
+
|
|
113
|
+
app.stages.pathTracer.setEmissiveTriangleData(
|
|
114
|
+
payload.rawData, payload.emissiveCount, payload.totalPower, payload.bitTrailMap,
|
|
115
|
+
);
|
|
116
|
+
if ( payload.lightBVHNodeData ) {
|
|
117
|
+
|
|
118
|
+
app.stages.pathTracer.setLightBVHData( payload.lightBVHNodeData, payload.lightBVHNodeCount );
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Re-derive the emissive-NEE sampled set from current per-mesh world-visibility
|
|
126
|
+
* (InstanceTable is the source of truth — patched by the stage's visibility API).
|
|
127
|
+
* Hidden meshes' triangles are dropped from the Light BVH so they stop casting
|
|
128
|
+
* NEE light; the shadow ray can't do it (a hidden mesh no longer self-occludes).
|
|
129
|
+
*/
|
|
130
|
+
export function refreshEmissiveForVisibility( app ) {
|
|
131
|
+
|
|
132
|
+
const table = app._sdf?.instanceTable;
|
|
133
|
+
if ( ! table ) return;
|
|
134
|
+
|
|
135
|
+
// The emitter list names meshes, the table placements.
|
|
136
|
+
const hidden = new Set();
|
|
137
|
+
for ( let i = 0; i < table.count; i ++ ) {
|
|
138
|
+
|
|
139
|
+
if ( table.isSet[ i ] && ! table.visible[ i ] ) hidden.add( table.sourceMesh[ i ] );
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
app._uploadEmissivePayload( app._sdf.rebuildEmissiveForVisibility( hidden ) );
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function setEmissiveTriangleSampling( app, enabled ) {
|
|
148
|
+
|
|
149
|
+
app._emissiveSamplingUserSet = true;
|
|
150
|
+
app.settings.set( 'enableEmissiveTriangleSampling', enabled );
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function hasEmissiveGeometry( app ) {
|
|
155
|
+
|
|
156
|
+
return ( app._sdf?.emissiveTriangleBuilder?.emissiveTriangles?.length
|
|
157
|
+
?? app._sdf?.emissiveTriangleCount ?? 0 ) > 0;
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function setMeshVisibility( app, meshIndex, visible ) {
|
|
162
|
+
|
|
163
|
+
whenTLASEditable( app, () => app.stages.pathTracer?.updateMeshVisibility( meshIndex, visible ) );
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function updateAllMeshVisibility( app ) {
|
|
168
|
+
|
|
169
|
+
whenTLASEditable( app, () => app.stages.pathTracer?.updateAllMeshVisibility() );
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Applies a visibility edit, then resets — once a spilled TLAS is back in memory. @private */
|
|
174
|
+
function whenTLASEditable( app, edit ) {
|
|
175
|
+
|
|
176
|
+
const apply = () => {
|
|
177
|
+
|
|
178
|
+
edit();
|
|
179
|
+
app._refreshEmissiveForVisibility();
|
|
180
|
+
app.reset();
|
|
181
|
+
scheduleRespill( app );
|
|
182
|
+
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const ready = app._sdf?.whenTLASEditable();
|
|
186
|
+
if ( ! ready ) return apply();
|
|
187
|
+
ready.then( apply ).catch( error => app._issues.warn( ISSUE_CODES.STORAGE_READ_FAILED, `reading the TLAS back failed: ${error.message}` ) );
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function setMeshVisibilityByUuid( app, uuid, visible ) {
|
|
192
|
+
|
|
193
|
+
const object = app.getScene()?.getObjectByProperty( 'uuid', uuid );
|
|
194
|
+
if ( ! object ) return null;
|
|
195
|
+
const next = typeof visible === 'function' ? !! visible( object.visible ) : !! visible;
|
|
196
|
+
object.visible = next;
|
|
197
|
+
app.updateAllMeshVisibility();
|
|
198
|
+
return next;
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function setTextureTransform( app, materialIndex, textureName, transform ) {
|
|
203
|
+
|
|
204
|
+
app.stages.pathTracer?.materialData.updateTextureTransform( materialIndex, textureName, transform );
|
|
205
|
+
app.reset();
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export async function setTextureColorSpace( app, texture, choice ) {
|
|
210
|
+
|
|
211
|
+
if ( ! texture?.isTexture ) throw new Error( 'setTextureColorSpace wants a three.js texture' );
|
|
212
|
+
|
|
213
|
+
const ud = texture.userData ?? ( texture.userData = {} );
|
|
214
|
+
if ( ud.__rayzeeOriginalColorSpace === undefined ) ud.__rayzeeOriginalColorSpace = texture.colorSpace;
|
|
215
|
+
const original = ud.__rayzeeOriginalColorSpace;
|
|
216
|
+
|
|
217
|
+
delete ud.ocioColorSpace;
|
|
218
|
+
delete ud.__rayzeeColorSpaceChoice;
|
|
219
|
+
|
|
220
|
+
if ( choice === null || choice === undefined ) {
|
|
221
|
+
|
|
222
|
+
texture.colorSpace = original;
|
|
223
|
+
delete ud.__rayzeeOriginalColorSpace;
|
|
224
|
+
|
|
225
|
+
} else if ( choice === 'srgb' || choice === 'linear' ) {
|
|
226
|
+
|
|
227
|
+
texture.colorSpace = choice === 'srgb' ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
228
|
+
ud.__rayzeeColorSpaceChoice = choice;
|
|
229
|
+
|
|
230
|
+
} else {
|
|
231
|
+
|
|
232
|
+
if ( ! app.color?.hasConfig ) throw new Error( `"${choice}" needs a colour config loaded` );
|
|
233
|
+
ud.ocioColorSpace = choice;
|
|
234
|
+
texture.colorSpace = SRGBColorSpace;
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
texture.needsUpdate = true;
|
|
239
|
+
if ( app.stages.pathTracer?.sdfs ) await app.rebuildMaterials();
|
|
240
|
+
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export async function rebuildMaterials( app, scene ) {
|
|
244
|
+
|
|
245
|
+
await app.ensureSceneResident();
|
|
246
|
+
const stage = app.stages.pathTracer;
|
|
247
|
+
await stage?.rebuildMaterials( scene || app.meshScene );
|
|
248
|
+
|
|
249
|
+
// Loaded without texture coordinates, and a material has a texture now: they go up again from the records.
|
|
250
|
+
if ( stage?.triangleStorageNode?.withoutUV && app._sdf?.triangles && usesTextureCoordinates( scene || app.meshScene ) ) {
|
|
251
|
+
|
|
252
|
+
app._sdf.textureCoordinates = true;
|
|
253
|
+
stage.setTriangleData( app._sdf.triangles, app._sdf.triangleCount, { textureCoordinates: true } );
|
|
254
|
+
stage.setupMaterial();
|
|
255
|
+
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
app.reset();
|
|
259
|
+
|
|
260
|
+
}
|