rayzee 9.4.2 → 9.5.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 +223 -21
- package/dist/ActiveColor-YvuQq44O.js +13 -0
- package/dist/ArchiveImporter-xuUJiklP.js +4301 -0
- package/dist/AssetConfig-DSEntE65.js +30 -0
- package/dist/BidirectionalIntegrator-C5PKjJoT.js +934 -0
- package/dist/ColorManagement-CheBCPaW.js +1488 -0
- package/dist/EngineDefaults-DH3bI5t-.js +844 -0
- package/dist/EngineEvents-Ci8dVWCP.js +73 -0
- package/dist/EngineIssues-CIZnXHsF.js +72 -0
- package/dist/FileFormats-sPGJeCRc.js +102 -0
- package/dist/Logger-BnHghprG.js +97 -0
- package/dist/{NeuralRetouch-vkdXXyK2.js → NeuralRetouch-CW11yLZ_.js} +8 -6
- package/dist/{NeuralSuperRes-FVqRJKQV.js → NeuralSuperRes-BekaecYg.js} +55 -120
- package/dist/PathTracer-Ccl9KOuF.js +29729 -0
- package/dist/PhysicalSky-Dv2PMFGW.js +1219 -0
- package/dist/RayzeeRenderer-BQxnzCTD.js +3542 -0
- package/dist/SolarLimb-ken-JbDK.js +721 -0
- package/dist/ToneMapGPU-BHi5JzIq.js +177 -0
- package/dist/ViewTransforms-D0rTLBsX.js +255 -0
- package/dist/WorkingMatrix-C6y233hT.js +27 -0
- package/dist/ZipReader-gDSWr0I5.js +98 -0
- package/dist/addons/archives.es.js +3 -0
- package/dist/addons/bidirectional.es.js +2 -0
- package/dist/addons/color.es.js +3 -0
- package/dist/addons/formats.es.js +2 -0
- package/dist/addons/physical-sky.es.js +2 -0
- package/dist/addons/storage.es.js +3 -0
- package/dist/archiveFormats-BZw7TiDp.js +75 -0
- package/dist/identity-DrQsGT2o.js +39 -0
- package/dist/openStorage-DwcBRUj7.js +820 -0
- package/dist/rayzee-core.es.js +12 -0
- package/dist/rayzee.es.js +2266 -44079
- package/dist/rayzee.umd.js +485 -473
- package/dist/sceneCachePolicy-BmwYOYDu.js +183 -0
- package/dist/shared-BGBcSxBQ.js +17 -0
- package/package.json +23 -2
- package/src/Color/ActiveColor.js +34 -0
- package/src/Color/BasicColor.js +147 -0
- package/src/Color/ColorManagement.js +7 -31
- package/src/EngineDefaults.js +22 -8
- package/src/EngineEvents.js +2 -0
- package/src/EngineIssues.js +1 -0
- package/src/PathTracerApp.js +617 -4016
- package/src/Pipeline/PipelineContext.js +0 -4
- package/src/Platform.js +36 -0
- package/src/Processor/ArchiveCache.js +1 -1
- package/src/Processor/ArchiveImporter.js +1259 -0
- package/src/Processor/AssetLoader.js +322 -1746
- package/src/Processor/AtmosphereModel.js +1 -2
- package/src/Processor/BVHBuilder.js +4 -95
- package/src/Processor/EnvironmentExactTable.js +187 -0
- package/src/Processor/EquirectHDRInfo.js +30 -223
- package/src/Processor/FileFormats.js +116 -0
- package/src/Processor/GLTFDecoders.js +85 -0
- package/src/Processor/GLTFDiffuseTransmission.js +63 -0
- package/src/Processor/GeometryExtractor.js +12 -1
- package/src/Processor/IESParser.js +47 -35
- package/src/Processor/KernelManager.js +35 -2
- package/src/Processor/MaterialPacking.js +8 -7
- package/src/Processor/PBRT/PBRTMaterials.js +129 -41
- package/src/Processor/PBRT/PBRTParser.js +30 -17
- package/src/Processor/PBRT/PBRTSceneBuilder.js +548 -37
- package/src/Processor/PBRT/PBRTTextureBake.js +154 -0
- package/src/Processor/PBRT/PFM.js +59 -0
- package/src/Processor/PackedRayBuffer.js +116 -9
- package/src/Processor/ParallelBVHBuilder.js +3 -6
- package/src/Processor/PhysicalSky.js +5 -4
- package/src/Processor/PlatformImageLoader.js +50 -6
- package/src/Processor/QueueManager.js +12 -3
- package/src/Processor/ReinsertionOptimizer.js +2 -2
- package/src/Processor/SceneProcessor.js +15 -55
- package/src/Processor/ShaderBuilder.js +6 -16
- package/src/Processor/SolarLimb.js +3 -0
- package/src/Processor/TextureCreator.js +1 -1
- package/src/Processor/Workers/BVHSubtreeWorker.js +1 -34
- package/src/Processor/Workers/BVHWorker.js +5 -18
- package/src/Processor/Workers/CDFWorker.js +6 -183
- package/src/Processor/archiveFormats.js +7 -0
- package/src/Processor/utils.js +2 -1
- package/src/RayzeeRenderer.js +3902 -0
- package/src/RenderSettings.js +49 -41
- package/src/Stages/ASVGF.js +5 -7
- package/src/Stages/AutoExposure.js +3 -12
- package/src/Stages/Compositor.js +8 -23
- package/src/Stages/NRD.js +9 -2
- package/src/Stages/NormalDepth.js +9 -6
- package/src/Stages/PathTracer.js +254 -38
- package/src/Stages/PathTracerStage.js +11 -16
- package/src/Storage/BLASCache.js +1 -1
- package/src/Storage/CDFCache.js +18 -17
- package/src/Storage/DownloadCache.js +1 -1
- package/src/Storage/SceneGraphCodec.js +46 -3
- package/src/Storage/SpillStore.js +1 -1
- package/src/Storage/StorageManager.js +2 -4
- package/src/Storage/areas.js +4 -0
- package/src/TSL/BVHTraversal.js +62 -24
- package/src/TSL/Bidirectional.js +204 -0
- package/src/TSL/BidirectionalLamps.js +132 -0
- package/src/TSL/Clearcoat.js +15 -6
- package/src/TSL/Common.js +19 -14
- package/src/TSL/ConnectKernel.js +147 -0
- package/src/TSL/Debugger.js +1 -1
- package/src/TSL/Displacement.js +4 -3
- package/src/TSL/EmissiveSampling.js +64 -17
- package/src/TSL/Environment.js +77 -106
- package/src/TSL/EnvironmentCDF.js +85 -39
- package/src/TSL/ExtendKernel.js +8 -3
- package/src/TSL/FinalWriteKernel.js +4 -4
- package/src/TSL/GenerateKernel.js +18 -4
- package/src/TSL/HitFacet.js +35 -5
- package/src/TSL/LightBVHSampling.js +40 -9
- package/src/TSL/LightGenerateKernel.js +293 -0
- package/src/TSL/LightGuide.js +198 -0
- package/src/TSL/LightSplatKernel.js +165 -0
- package/src/TSL/LightsCore.js +13 -38
- package/src/TSL/LightsDirect.js +28 -29
- package/src/TSL/LightsIndirect.js +3 -1
- package/src/TSL/LightsSampling.js +90 -38
- package/src/TSL/MaterialEvaluation.js +113 -31
- package/src/TSL/MaterialProperties.js +44 -17
- package/src/TSL/MaterialTransmission.js +52 -47
- package/src/TSL/MergeKernel.js +218 -0
- package/src/TSL/PathTracerCore.js +65 -29
- package/src/TSL/Random.js +4 -0
- package/src/TSL/SceneResources.js +51 -0
- package/src/TSL/ShadeKernel.js +881 -103
- package/src/TSL/Struct.js +10 -0
- package/src/TSL/Sun.js +1 -1
- package/src/TSL/TextureSampling.js +65 -60
- package/src/addons/archives.js +14 -0
- package/src/addons/bidirectional.js +13 -0
- package/src/addons/color.js +32 -0
- package/src/addons/formats.js +16 -0
- package/src/addons/physicalSky.js +14 -0
- package/src/addons/storage.js +19 -0
- package/src/core.js +35 -0
- package/src/index.js +3 -1
- package/src/integrators/BidirectionalIntegrator.js +832 -0
- package/src/managers/EnvironmentManager.js +85 -33
- package/src/managers/MaterialDataManager.js +42 -0
- package/src/managers/UniformManager.js +0 -1
- package/dist/ToneMapGPU-DKQM1pMd.js +0 -552
- package/dist/rolldown-runtime-CAFD8bLK.js +0 -11
- package/src/Processor/TreeletOptimizer.js +0 -574
package/src/TSL/Struct.js
CHANGED
|
@@ -68,6 +68,11 @@ export const RayTracingMaterial = struct( {
|
|
|
68
68
|
iridescenceThicknessMapIndex: 'int',
|
|
69
69
|
specularIntensityMapIndex: 'int',
|
|
70
70
|
specularColorMapIndex: 'int',
|
|
71
|
+
// KHR_materials_diffuse_transmission: the diffuse lobe's share sent through to the other side, and its tint.
|
|
72
|
+
diffuseTransmission: 'float',
|
|
73
|
+
diffuseTransmissionColor: 'vec3',
|
|
74
|
+
diffuseTransmissionMapIndex: 'int',
|
|
75
|
+
diffuseTransmissionColorMapIndex: 'int',
|
|
71
76
|
} );
|
|
72
77
|
|
|
73
78
|
// Result of folding the glTF extension textures into their scalar factors (applyExtensionMaps).
|
|
@@ -82,6 +87,8 @@ export const ExtMapResult = struct( {
|
|
|
82
87
|
iridescenceThickness: 'float', // resolved thin-film thickness → written into iridescenceThicknessRange.y
|
|
83
88
|
specularIntensity: 'float',
|
|
84
89
|
specularColor: 'vec3',
|
|
90
|
+
diffuseTransmission: 'float',
|
|
91
|
+
diffuseTransmissionColor: 'vec3',
|
|
85
92
|
} );
|
|
86
93
|
|
|
87
94
|
// Lightweight material for shadow ray evaluation — only the fields needed
|
|
@@ -159,6 +166,8 @@ export const DirectionSample = struct( {
|
|
|
159
166
|
isTransmission: 'bool',
|
|
160
167
|
// Spectral tint from the transmission sampler; vec3(1) for every reflection lobe.
|
|
161
168
|
colorWeight: 'vec3',
|
|
169
|
+
// Drawn from the diffuse transmission lobe: `value` is its BTDF and the direction is below N.
|
|
170
|
+
isDiffuseTransmission: 'bool',
|
|
162
171
|
} );
|
|
163
172
|
|
|
164
173
|
export const BRDFWeights = struct( {
|
|
@@ -168,6 +177,7 @@ export const BRDFWeights = struct( {
|
|
|
168
177
|
clearcoat: 'float',
|
|
169
178
|
transmission: 'float',
|
|
170
179
|
iridescence: 'float',
|
|
180
|
+
diffuseTransmission: 'float',
|
|
171
181
|
} );
|
|
172
182
|
|
|
173
183
|
|
package/src/TSL/Sun.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fn, float, vec3, sqrt, max, dot, cross, pow, cos, sin, abs, normalize, select, If } from 'three/tsl';
|
|
2
2
|
|
|
3
|
-
import { LIMB_DARKENING_EXPONENT } from '../Processor/
|
|
3
|
+
import { LIMB_DARKENING_EXPONENT } from '../Processor/SolarLimb.js';
|
|
4
4
|
|
|
5
5
|
const LIMB_EXPONENT = vec3( ...LIMB_DARKENING_EXPONENT );
|
|
6
6
|
// µ^α averages to 2 / (α + 2) over the disc, so this keeps the mean at `sunRadiance`.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sceneResources, materialLayers } from './SceneResources.js';
|
|
1
2
|
import { Fn, wgslFn, float, vec2, vec3, vec4, int, If, normalize, cross, dot, length, sign, abs, atan, mix, clamp, texture, textureSize, uintBitsToFloat } from 'three/tsl';
|
|
2
3
|
import { DataArrayTexture, LinearFilter } from 'three';
|
|
3
4
|
|
|
@@ -18,30 +19,11 @@ import { TEXTURE_CONSTANTS } from '../EngineDefaults.js';
|
|
|
18
19
|
// footprint. Bucket shapes are planned per scene (planTextureBuckets) — not powers of two.
|
|
19
20
|
// A map's stored index encodes (bucket, layer) as bucket * BUCKET_LAYER_STRIDE + layer.
|
|
20
21
|
//
|
|
21
|
-
// The bucket texture nodes
|
|
22
|
-
//
|
|
23
|
-
// so each pipeline bakes in its own fresh nodes (avoiding cross-pipeline TextureNode
|
|
24
|
-
// caching, just like the per-type nodes did before).
|
|
22
|
+
// The bucket texture nodes are the kernel's own (SceneResources.js): each pipeline builds fresh nodes,
|
|
23
|
+
// avoiding cross-pipeline TextureNode caching, and hands them to its kernels' build context.
|
|
25
24
|
|
|
26
25
|
const _STRIDE = TEXTURE_CONSTANTS.BUCKET_LAYER_STRIDE;
|
|
27
26
|
|
|
28
|
-
// Array<MATERIAL_BUCKET_COUNT> of texture nodes (never null — empty buckets get placeholders).
|
|
29
|
-
let _srgbBuckets = null;
|
|
30
|
-
let _linearBuckets = null;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Set the bucket texture node arrays read by the sampling functions. Call before building
|
|
34
|
-
* any graph that samples material textures (Shade / NormalDepth / Debug kernels).
|
|
35
|
-
* @param {Array} srgb sRGB pool nodes (albedo + emissive)
|
|
36
|
-
* @param {Array} linear linear pool nodes (normal/bump/roughness/metalness/displacement)
|
|
37
|
-
*/
|
|
38
|
-
export function setMaterialBucketTextures( srgb, linear ) {
|
|
39
|
-
|
|
40
|
-
_srgbBuckets = srgb;
|
|
41
|
-
_linearBuckets = linear;
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
27
|
// Run `fn(node, layer)` inside a runtime branch that selects the bucket node a packed
|
|
46
28
|
// index points to. Emits one If/ElseIf arm per bucket; only the matching arm executes.
|
|
47
29
|
// Caller must guard packedIndex >= 0.
|
|
@@ -89,13 +71,6 @@ export const bucketTexelSize = ( buckets, packedIndex ) => {
|
|
|
89
71
|
|
|
90
72
|
};
|
|
91
73
|
|
|
92
|
-
// The linear-pool node set (displacement lives here) — for Displacement.js texel sizing.
|
|
93
|
-
export function getLinearBucketTextures() {
|
|
94
|
-
|
|
95
|
-
return _linearBuckets;
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
74
|
// 1×1 white placeholder array so empty-bucket branches always reference a valid node.
|
|
100
75
|
export function makeBucketPlaceholder() {
|
|
101
76
|
|
|
@@ -334,13 +309,15 @@ export const computeUVCache = Fn( ( [ baseUV, material ] ) => {
|
|
|
334
309
|
// PROCESSING FUNCTIONS
|
|
335
310
|
// ================================================================================
|
|
336
311
|
|
|
337
|
-
export const processAlbedo = Fn( ( [ material, uvCache ] ) => {
|
|
312
|
+
export const processAlbedo = Fn( ( [ material, uvCache ], builder ) => {
|
|
313
|
+
|
|
314
|
+
const { srgbBuckets } = sceneResources( builder );
|
|
338
315
|
|
|
339
316
|
const result = material.color.toVar();
|
|
340
317
|
|
|
341
318
|
If( material.albedoMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
342
319
|
|
|
343
|
-
const albedoSample = sampleBucket(
|
|
320
|
+
const albedoSample = sampleBucket( srgbBuckets, material.albedoMapIndex, uvCache.albedoUV ).toVar();
|
|
344
321
|
// sRGB→linear handled by GPU hardware (sRGB bucket arrays carry SRGBColorSpace → rgba8unorm-srgb)
|
|
345
322
|
result.assign( vec4( material.color.rgb.mul( albedoSample.rgb ), material.color.a.mul( albedoSample.a ) ) );
|
|
346
323
|
|
|
@@ -350,7 +327,9 @@ export const processAlbedo = Fn( ( [ material, uvCache ] ) => {
|
|
|
350
327
|
|
|
351
328
|
} );
|
|
352
329
|
|
|
353
|
-
export const processMetalnessRoughness = Fn( ( [ material, uvCache ] ) => {
|
|
330
|
+
export const processMetalnessRoughness = Fn( ( [ material, uvCache ], builder ) => {
|
|
331
|
+
|
|
332
|
+
const { linearBuckets } = sceneResources( builder );
|
|
354
333
|
|
|
355
334
|
const metalness = material.metalness.toVar();
|
|
356
335
|
const roughness = material.roughness.toVar();
|
|
@@ -358,7 +337,7 @@ export const processMetalnessRoughness = Fn( ( [ material, uvCache ] ) => {
|
|
|
358
337
|
If( material.metalnessMapIndex.greaterThanEqual( int( 0 ) ).and( material.metalnessMapIndex.equal( material.roughnessMapIndex ) ), () => {
|
|
359
338
|
|
|
360
339
|
// Same packed index → same bucket layer (e.g. ORM) → sample once.
|
|
361
|
-
const sample = sampleBucket(
|
|
340
|
+
const sample = sampleBucket( linearBuckets, material.metalnessMapIndex, uvCache.metalnessUV );
|
|
362
341
|
metalness.assign( material.metalness.mul( sample.b ) );
|
|
363
342
|
roughness.assign( material.roughness.mul( sample.g ) );
|
|
364
343
|
|
|
@@ -366,14 +345,14 @@ export const processMetalnessRoughness = Fn( ( [ material, uvCache ] ) => {
|
|
|
366
345
|
|
|
367
346
|
If( material.metalnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
368
347
|
|
|
369
|
-
const metSample = sampleBucket(
|
|
348
|
+
const metSample = sampleBucket( linearBuckets, material.metalnessMapIndex, uvCache.metalnessUV );
|
|
370
349
|
metalness.assign( material.metalness.mul( metSample.b ) );
|
|
371
350
|
|
|
372
351
|
} );
|
|
373
352
|
|
|
374
353
|
If( material.roughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
375
354
|
|
|
376
|
-
const rghSample = sampleBucket(
|
|
355
|
+
const rghSample = sampleBucket( linearBuckets, material.roughnessMapIndex, uvCache.roughnessUV );
|
|
377
356
|
roughness.assign( material.roughness.mul( rghSample.g ) );
|
|
378
357
|
|
|
379
358
|
} );
|
|
@@ -471,13 +450,15 @@ export const triangleUVTangent = Fn( ( [ triangleBuffer, triIndex, geometryNorma
|
|
|
471
450
|
* arbitrary frame comes out 90 deg off, so the rib normals tilt up/down instead of across
|
|
472
451
|
* the ribs.
|
|
473
452
|
*/
|
|
474
|
-
export const processNormal = Fn( ( [ geometryNormal, material, uvCache, uvTangent ] ) => {
|
|
453
|
+
export const processNormal = Fn( ( [ geometryNormal, material, uvCache, uvTangent ], builder ) => {
|
|
454
|
+
|
|
455
|
+
const { linearBuckets } = sceneResources( builder );
|
|
475
456
|
|
|
476
457
|
const result = geometryNormal.toVar();
|
|
477
458
|
|
|
478
459
|
If( material.normalMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
479
460
|
|
|
480
|
-
const normalSample = sampleBucket(
|
|
461
|
+
const normalSample = sampleBucket( linearBuckets, material.normalMapIndex, uvCache.normalUV );
|
|
481
462
|
const normalMap = normalSample.xyz.mul( 2.0 ).sub( 1.0 ).toVar();
|
|
482
463
|
normalMap.x.mulAssign( material.normalScale.x );
|
|
483
464
|
normalMap.y.assign( normalMap.y.negate().mul( material.normalScale.x ) );
|
|
@@ -512,7 +493,9 @@ export const processNormal = Fn( ( [ geometryNormal, material, uvCache, uvTangen
|
|
|
512
493
|
|
|
513
494
|
} );
|
|
514
495
|
|
|
515
|
-
export const processBump = Fn( ( [ currentNormal, material, uvCache ] ) => {
|
|
496
|
+
export const processBump = Fn( ( [ currentNormal, material, uvCache ], builder ) => {
|
|
497
|
+
|
|
498
|
+
const { linearBuckets } = sceneResources( builder );
|
|
516
499
|
|
|
517
500
|
const result = currentNormal.toVar();
|
|
518
501
|
|
|
@@ -521,7 +504,7 @@ export const processBump = Fn( ( [ currentNormal, material, uvCache ] ) => {
|
|
|
521
504
|
// Taps + texel size come from the SELECTED bucket node (its real dimensions), so the
|
|
522
505
|
// finite-difference step is correct per bucket — done inside one bucket-branch.
|
|
523
506
|
const bumpNormal = vec3( 0.0, 0.0, 1.0 ).toVar();
|
|
524
|
-
withBucket(
|
|
507
|
+
withBucket( linearBuckets, material.bumpMapIndex, ( node, layer ) => {
|
|
525
508
|
|
|
526
509
|
const texelSize = vec2( 1.0 ).div( vec2( textureSize( node ) ) ).toVar();
|
|
527
510
|
const h_c = texture( node, uvCache.bumpUV ).depth( layer ).r;
|
|
@@ -549,11 +532,13 @@ export const processBump = Fn( ( [ currentNormal, material, uvCache ] ) => {
|
|
|
549
532
|
// Fold the glTF anisotropyTexture (RG = tangent-space direction, B = strength) into scalar
|
|
550
533
|
// (strength, rotationRadians) per three.js: anisotropy · R(rotation) · (normalize(rg·2−1)·b).
|
|
551
534
|
// Caller guarantees anisotropyMapIndex >= 0. `uv` is pre-transformed by the caller (albedo transform).
|
|
552
|
-
export const processAnisotropyMap = Fn( ( [ material, uv ] ) => {
|
|
535
|
+
export const processAnisotropyMap = Fn( ( [ material, uv ], builder ) => {
|
|
536
|
+
|
|
537
|
+
const { linearBuckets } = sceneResources( builder );
|
|
553
538
|
|
|
554
539
|
const result = vec2( material.anisotropy, material.anisotropyRotation ).toVar();
|
|
555
540
|
|
|
556
|
-
const s = sampleBucket(
|
|
541
|
+
const s = sampleBucket( linearBuckets, material.anisotropyMapIndex, uv ).toVar();
|
|
557
542
|
const texDir = s.rg.mul( 2.0 ).sub( 1.0 ).toVar();
|
|
558
543
|
const dlen = texDir.length().toVar();
|
|
559
544
|
|
|
@@ -581,7 +566,10 @@ export const processAnisotropyMap = Fn( ( [ material, uv ] ) => {
|
|
|
581
566
|
// pre-transformed by the caller with the material's albedo KHR_texture_transform (extension maps
|
|
582
567
|
// share the base UV set/transform in practice). Color maps (sheenColor, specularColor) read the
|
|
583
568
|
// sRGB pool; data maps read the linear pool.
|
|
584
|
-
export const applyExtensionMaps = Fn( ( [ material, uv ] ) => {
|
|
569
|
+
export const applyExtensionMaps = Fn( ( [ material, uv ], builder ) => {
|
|
570
|
+
|
|
571
|
+
const { srgbBuckets, linearBuckets } = sceneResources( builder );
|
|
572
|
+
const layers = materialLayers( builder );
|
|
585
573
|
|
|
586
574
|
const r = ExtMapResult( {
|
|
587
575
|
transmission: material.transmission,
|
|
@@ -593,53 +581,66 @@ export const applyExtensionMaps = Fn( ( [ material, uv ] ) => {
|
|
|
593
581
|
iridescenceThickness: material.iridescenceThicknessRange.y, // default = max (no-texture behavior)
|
|
594
582
|
specularIntensity: material.specularIntensity,
|
|
595
583
|
specularColor: material.specularColor,
|
|
584
|
+
diffuseTransmission: material.diffuseTransmission,
|
|
585
|
+
diffuseTransmissionColor: material.diffuseTransmissionColor,
|
|
596
586
|
} ).toVar();
|
|
597
587
|
|
|
598
588
|
If( material.transmissionMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
599
589
|
|
|
600
|
-
r.transmission.assign( r.transmission.mul( sampleBucket(
|
|
590
|
+
r.transmission.assign( r.transmission.mul( sampleBucket( linearBuckets, material.transmissionMapIndex, uv ).r ) );
|
|
601
591
|
|
|
602
592
|
} );
|
|
603
|
-
If( material.clearcoatMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
593
|
+
if ( layers.clearcoat ) If( material.clearcoatMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
604
594
|
|
|
605
|
-
r.clearcoat.assign( r.clearcoat.mul( sampleBucket(
|
|
595
|
+
r.clearcoat.assign( r.clearcoat.mul( sampleBucket( linearBuckets, material.clearcoatMapIndex, uv ).r ) );
|
|
606
596
|
|
|
607
597
|
} );
|
|
608
|
-
If( material.clearcoatRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
598
|
+
if ( layers.clearcoat ) If( material.clearcoatRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
609
599
|
|
|
610
|
-
r.clearcoatRoughness.assign( r.clearcoatRoughness.mul( sampleBucket(
|
|
600
|
+
r.clearcoatRoughness.assign( r.clearcoatRoughness.mul( sampleBucket( linearBuckets, material.clearcoatRoughnessMapIndex, uv ).g ) );
|
|
611
601
|
|
|
612
602
|
} );
|
|
613
|
-
If( material.sheenColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
603
|
+
if ( layers.sheen ) If( material.sheenColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
614
604
|
|
|
615
|
-
r.sheenColor.assign( r.sheenColor.mul( sampleBucket(
|
|
605
|
+
r.sheenColor.assign( r.sheenColor.mul( sampleBucket( srgbBuckets, material.sheenColorMapIndex, uv ).rgb ) );
|
|
616
606
|
|
|
617
607
|
} );
|
|
618
|
-
If( material.sheenRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
608
|
+
if ( layers.sheen ) If( material.sheenRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
619
609
|
|
|
620
610
|
// clamp to [0.05,1] to keep parity with the sample/PDF floor applied in ShadeKernel
|
|
621
|
-
r.sheenRoughness.assign( clamp( r.sheenRoughness.mul( sampleBucket(
|
|
611
|
+
r.sheenRoughness.assign( clamp( r.sheenRoughness.mul( sampleBucket( linearBuckets, material.sheenRoughnessMapIndex, uv ).a ), 0.05, 1.0 ) );
|
|
622
612
|
|
|
623
613
|
} );
|
|
624
|
-
If( material.iridescenceMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
614
|
+
if ( layers.iridescence ) If( material.iridescenceMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
625
615
|
|
|
626
|
-
r.iridescence.assign( r.iridescence.mul( sampleBucket(
|
|
616
|
+
r.iridescence.assign( r.iridescence.mul( sampleBucket( linearBuckets, material.iridescenceMapIndex, uv ).r ) );
|
|
627
617
|
|
|
628
618
|
} );
|
|
629
|
-
If( material.iridescenceThicknessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
619
|
+
if ( layers.iridescence ) If( material.iridescenceThicknessMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
630
620
|
|
|
631
|
-
const g = sampleBucket(
|
|
621
|
+
const g = sampleBucket( linearBuckets, material.iridescenceThicknessMapIndex, uv ).g;
|
|
632
622
|
r.iridescenceThickness.assign( mix( material.iridescenceThicknessRange.x, material.iridescenceThicknessRange.y, g ) );
|
|
633
623
|
|
|
634
624
|
} );
|
|
635
625
|
If( material.specularIntensityMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
636
626
|
|
|
637
|
-
r.specularIntensity.assign( r.specularIntensity.mul( sampleBucket(
|
|
627
|
+
r.specularIntensity.assign( r.specularIntensity.mul( sampleBucket( linearBuckets, material.specularIntensityMapIndex, uv ).a ) );
|
|
638
628
|
|
|
639
629
|
} );
|
|
640
630
|
If( material.specularColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
641
631
|
|
|
642
|
-
r.specularColor.assign( r.specularColor.mul( sampleBucket(
|
|
632
|
+
r.specularColor.assign( r.specularColor.mul( sampleBucket( srgbBuckets, material.specularColorMapIndex, uv ).rgb ) );
|
|
633
|
+
|
|
634
|
+
} );
|
|
635
|
+
// KHR_materials_diffuse_transmission: the factor from the map's alpha, the colour from its RGB.
|
|
636
|
+
if ( layers.diffuseTransmission ) If( material.diffuseTransmissionMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
637
|
+
|
|
638
|
+
r.diffuseTransmission.assign( r.diffuseTransmission.mul( sampleBucket( linearBuckets, material.diffuseTransmissionMapIndex, uv ).a ) );
|
|
639
|
+
|
|
640
|
+
} );
|
|
641
|
+
if ( layers.diffuseTransmission ) If( material.diffuseTransmissionColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
642
|
+
|
|
643
|
+
r.diffuseTransmissionColor.assign( r.diffuseTransmissionColor.mul( sampleBucket( srgbBuckets, material.diffuseTransmissionColorMapIndex, uv ).rgb ) );
|
|
643
644
|
|
|
644
645
|
} );
|
|
645
646
|
|
|
@@ -647,13 +648,15 @@ export const applyExtensionMaps = Fn( ( [ material, uv ] ) => {
|
|
|
647
648
|
|
|
648
649
|
} );
|
|
649
650
|
|
|
650
|
-
export const processEmissive = Fn( ( [ material, uvCache ] ) => {
|
|
651
|
+
export const processEmissive = Fn( ( [ material, uvCache ], builder ) => {
|
|
652
|
+
|
|
653
|
+
const { srgbBuckets } = sceneResources( builder );
|
|
651
654
|
|
|
652
655
|
const emissionBase = material.emissive.mul( material.emissiveIntensity ).toVar();
|
|
653
656
|
|
|
654
657
|
If( material.emissiveMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
655
658
|
|
|
656
|
-
const emissiveSample = sampleBucket(
|
|
659
|
+
const emissiveSample = sampleBucket( srgbBuckets, material.emissiveMapIndex, uvCache.emissiveUV ).toVar();
|
|
657
660
|
// sRGB→linear handled by GPU hardware (sRGB bucket arrays carry SRGBColorSpace → rgba8unorm-srgb)
|
|
658
661
|
emissionBase.assign( emissionBase.mul( emissiveSample.rgb ) );
|
|
659
662
|
|
|
@@ -707,14 +710,16 @@ export const sampleAllMaterialTextures = Fn( ( [ material, uv, geometryNormal, u
|
|
|
707
710
|
} );
|
|
708
711
|
|
|
709
712
|
// Sample displacement map (linear pool) at given UV coordinates.
|
|
710
|
-
export const sampleDisplacementMap = Fn( ( [ displacementMapIndex, uv, transform ] ) => {
|
|
713
|
+
export const sampleDisplacementMap = Fn( ( [ displacementMapIndex, uv, transform ], builder ) => {
|
|
714
|
+
|
|
715
|
+
const { linearBuckets } = sceneResources( builder );
|
|
711
716
|
|
|
712
717
|
const result = float( 0.0 ).toVar();
|
|
713
718
|
|
|
714
719
|
If( displacementMapIndex.greaterThanEqual( int( 0 ) ), () => {
|
|
715
720
|
|
|
716
721
|
const transformedUV = getTransformedUV( { uv, transform } );
|
|
717
|
-
result.assign( sampleBucket(
|
|
722
|
+
result.assign( sampleBucket( linearBuckets, displacementMapIndex, transformedUV ).r );
|
|
718
723
|
|
|
719
724
|
} );
|
|
720
725
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scene archives (.zip, .tar, .tar.gz) and the pbrt-v4 scenes in them — `rayzee/addons/archives`. PathTracerApp
|
|
3
|
+
* installs it itself; on the renderer core, install it once:
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* import { RayzeeRenderer } from 'rayzee/core';
|
|
7
|
+
* import { ArchiveImporter } from 'rayzee/addons/archives';
|
|
8
|
+
*
|
|
9
|
+
* renderer.assetLoader.setArchiveImporter( new ArchiveImporter( renderer.assetLoader ) );
|
|
10
|
+
* await renderer.loadFile( 'scene.tar' );
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { ArchiveImporter, ARCHIVE_ELEMENT_PROMPT_BYTES } from '../Processor/ArchiveImporter.js';
|
|
14
|
+
export { openZip, readZipDirectory } from '../Processor/ZipReader.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bidirectional path tracing and vertex merging — `rayzee/addons/bidirectional`: the path tracer's 'bidirectional'
|
|
3
|
+
* and 'vcm' integrators. PathTracerApp registers them itself; on the renderer core, register them once:
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* import { RayzeeRenderer } from 'rayzee/core';
|
|
7
|
+
* import { BidirectionalIntegrator } from 'rayzee/addons/bidirectional';
|
|
8
|
+
*
|
|
9
|
+
* renderer.stages.pathTracer.registerIntegrator( [ 'bidirectional', 'vcm' ], pt => new BidirectionalIntegrator( pt ) );
|
|
10
|
+
* renderer.settings.set( 'integrator', 'bidirectional' );
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { BidirectionalIntegrator } from '../integrators/BidirectionalIntegrator.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OCIO colour pipeline — `rayzee/addons/color`: colour configs, OCIO views and looks, working spaces, input
|
|
3
|
+
* colour spaces and export spaces. The renderer core renders in linear Rec.709 through three.js's own view transforms
|
|
4
|
+
* (BasicColor); PathTracerApp installs this itself. On the core, install it once — before or after init():
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { RayzeeRenderer, configureAssets } from 'rayzee/core';
|
|
8
|
+
* import { ColorManagement } from 'rayzee/addons/color';
|
|
9
|
+
*
|
|
10
|
+
* configureAssets( { ocioRuntimeFactory: () => import( '@bb-studio/ocio' ) } );
|
|
11
|
+
* renderer.setColorManagement( ColorManagement );
|
|
12
|
+
* await renderer.loadColorConfig( { builtin: 'ocio://cg-config-v4.0.0_aces-v2.0_ocio-v2.5' } );
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
ColorManagement, getActiveColorManagement, setActiveColorManagement,
|
|
17
|
+
isColorManaged, DEFAULT_WORKING_SPACE, findNativeLinearSpace, canvasColorSpaceFor,
|
|
18
|
+
} from '../Color/ColorManagement.js';
|
|
19
|
+
export { displayCanvasFit } from '../Color/Displays.js';
|
|
20
|
+
export {
|
|
21
|
+
buildOcioView, addOcioView, addAllOcioViews,
|
|
22
|
+
DEFAULT_LUT_SIZE, DEFAULT_MIN_EV, DEFAULT_MAX_EV,
|
|
23
|
+
} from '../Color/OcioViews.js';
|
|
24
|
+
export {
|
|
25
|
+
resolveInputSpace, textureInputSpace, setInputOverride, clearInputOverrides,
|
|
26
|
+
listInputOverrides, listFileRules, isDataTexture,
|
|
27
|
+
} from '../Color/InputColorSpaces.js';
|
|
28
|
+
export {
|
|
29
|
+
convertColor, convertPixelsF32, convertEncodedRGBA8, applyMatrixRGBA8, extractMatrix,
|
|
30
|
+
hasColorSpace, isDataSpace, srgbToLinear, linearToSrgb,
|
|
31
|
+
} from '../Color/ColorSpaces.js';
|
|
32
|
+
export { measureBakeError, bakeLut, makeCpuSampler } from '../Color/LutBake.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File formats beyond glTF and .hdr — `rayzee/addons/formats`: FBX, OBJ, STL, PLY, Collada, 3MF and USD models, and
|
|
3
|
+
* EXR environments. PathTracerApp registers all of them itself; on the renderer core, register the ones you read (each
|
|
4
|
+
* three.js loader is downloaded the first time its format is read, and a bundler drops the formats you leave out):
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { RayzeeRenderer } from 'rayzee/core';
|
|
8
|
+
* import { objFormat, exrFormat } from 'rayzee/addons/formats';
|
|
9
|
+
*
|
|
10
|
+
* renderer.assetLoader.registerFormat( objFormat, exrFormat );
|
|
11
|
+
* await renderer.loadFile( objFile );
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
fbxFormat, objFormat, stlFormat, plyFormat, colladaFormat, threeMFFormat, usdFormat, exrFormat, allFormats,
|
|
16
|
+
} from '../Processor/FileFormats.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The physical sky — `rayzee/addons/physical-sky`: Bruneton's atmosphere baked on the GPU for environment mode
|
|
3
|
+
* 'procedural', with its importance-sampling table and analytic sun. PathTracerApp installs it itself; on the renderer
|
|
4
|
+
* core, install it once:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { RayzeeRenderer } from 'rayzee/core';
|
|
8
|
+
* import { PhysicalSky } from 'rayzee/addons/physical-sky';
|
|
9
|
+
*
|
|
10
|
+
* renderer.environmentManager.setProceduralSky( PhysicalSky );
|
|
11
|
+
* await renderer.environmentManager.setMode( 'procedural' );
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export { PhysicalSky } from '../Processor/PhysicalSky.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* On-disk storage — `rayzee/addons/storage`: the origin private file system behind the download, environment and
|
|
3
|
+
* scene caches and the memory spill. The renderer core runs without it (downloads land in memory, nothing is cached);
|
|
4
|
+
* PathTracerApp installs it itself. On the core, install it before init():
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { RayzeeRenderer } from 'rayzee/core';
|
|
8
|
+
* import { acquireSharedStorage } from 'rayzee/addons/storage';
|
|
9
|
+
*
|
|
10
|
+
* const renderer = new RayzeeRenderer( canvas );
|
|
11
|
+
* renderer.setStorageOpener( acquireSharedStorage );
|
|
12
|
+
* await renderer.init();
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export { openStorage, acquireSharedStorage } from '../Storage/openStorage.js';
|
|
16
|
+
export {
|
|
17
|
+
StorageManager, StorageArea, StorageEntry, EntryWriter, STORAGE_KIND, ENGINE_AREAS, openInlineStorage,
|
|
18
|
+
} from '../Storage/StorageManager.js';
|
|
19
|
+
export { acquireLock, heldLockNames } from '../Storage/locks.js';
|
package/src/core.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rayzee renderer core — `rayzee/core`.
|
|
3
|
+
*
|
|
4
|
+
* A scene and camera in, path-traced samples accumulated, the image out. No denoisers, camera controls,
|
|
5
|
+
* gizmo, overlays or timeline: `rayzee` adds those (PathTracerApp). See docs/CORE_AND_ADDONS.md.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const renderer = await new RayzeeRenderer( canvas ).init();
|
|
9
|
+
* await renderer.loadObject3D( gltf.scene );
|
|
10
|
+
* await renderer.renderFrames( 256 );
|
|
11
|
+
* const image = await renderer.renderToBuffer( { colorSpace: 'srgb' } );
|
|
12
|
+
* renderer.dispose();
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import './TSL/patches.js';
|
|
16
|
+
|
|
17
|
+
export { RayzeeRenderer, describeAdapter } from './RayzeeRenderer.js';
|
|
18
|
+
export { EngineEvents, LEGACY_EVENT_NAMES } from './EngineEvents.js';
|
|
19
|
+
export { ISSUE_CODES, ISSUE_SEVERITY, IssueLog, EngineIssueError } from './EngineIssues.js';
|
|
20
|
+
export { RenderSettings, SETTING_SOURCE } from './RenderSettings.js';
|
|
21
|
+
export { configureAssets, getAssetConfig } from './AssetConfig.js';
|
|
22
|
+
export { configurePlatform, getPlatform } from './Platform.js';
|
|
23
|
+
export { LightManager } from './managers/LightManager.js';
|
|
24
|
+
export { listViewTransforms, getViewTransform, onRegistryChange } from './Color/ViewTransforms.js';
|
|
25
|
+
export { ARCHIVE_FORMATS } from './Processor/archiveFormats.js';
|
|
26
|
+
export {
|
|
27
|
+
ENGINE_DEFAULTS,
|
|
28
|
+
MATERIAL_DEFAULTS,
|
|
29
|
+
RENDER_PROFILES,
|
|
30
|
+
getRenderProfile,
|
|
31
|
+
MAX_RESERVABLE_RENDER_SIZE,
|
|
32
|
+
TRIANGLE_DATA_LAYOUT,
|
|
33
|
+
} from './EngineDefaults.js';
|
|
34
|
+
export { Logger, createLogger, fmt, LOG_LEVELS } from './utils/Logger.js';
|
|
35
|
+
export { VERSION } from './version.js';
|
package/src/index.js
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
// Patches (side-effect imports — must run before any StorageTexture usage)
|
|
9
9
|
import './TSL/patches.js';
|
|
10
10
|
|
|
11
|
-
// Main application
|
|
11
|
+
// Main application: the viewer, built on the renderer core (also `rayzee/core`)
|
|
12
12
|
export { PathTracerApp, describeAdapter } from './PathTracerApp.js';
|
|
13
|
+
export { RayzeeRenderer } from './RayzeeRenderer.js';
|
|
13
14
|
|
|
14
15
|
// Event types
|
|
15
16
|
export { EngineEvents, LEGACY_EVENT_NAMES } from './EngineEvents.js';
|
|
@@ -35,6 +36,7 @@ export {
|
|
|
35
36
|
|
|
36
37
|
// Archives read in place: one entry at a time, never the whole file in memory
|
|
37
38
|
export { openZip, readZipDirectory } from './Processor/ZipReader.js';
|
|
39
|
+
export { ARCHIVE_FORMATS } from './Processor/archiveFormats.js';
|
|
38
40
|
|
|
39
41
|
// Engine package version, as built
|
|
40
42
|
export { VERSION } from './version.js';
|