@playcanvas/supersplat-viewer 1.42.0 → 1.43.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 +8 -8
- package/THIRD_PARTY_NOTICES.md +63 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -3
- package/dist/viewer.css +9 -1
- package/dist/viewer.d.ts +13 -2
- package/dist/viewer.js +308 -161
- package/dist/viewer.js.map +1 -1
- package/dist/zstd-decoder.wasm +0 -0
- package/docs/api.md +2 -0
- package/package.json +10 -9
- package/public/index.css +9 -1
- package/public/index.html +15 -5
- package/public/index.js +11042 -5874
- package/public/index.js.map +1 -1
- package/public/zstd-decoder.wasm +0 -0
package/dist/viewer.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AppBase, AppOptions, CameraComponentSystem, LightComponentSystem, RenderComponentSystem, GSplatComponentSystem, ScriptComponentSystem, ContainerHandler, TextureHandler, GSplatHandler, BinaryHandler, XrManager, Asset, SEMANTIC_POSITION, INDEXFORMAT_UINT32, GSplatContainer, GSplatFormat, Vec3, Entity, Quat, WORKBUFFER_UPDATE_ONCE, Vec4, Mat4, Color, PROJECTION_ORTHOGRAPHIC, ShaderChunks, Texture, ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_RGBA16F, RenderTarget, RenderPassPicker, BlendState, BLENDEQUATION_MIN, BLENDMODE_ONE, PIXELFORMAT_R32U, Shader, BindGroupFormat, UniformBufferFormat, SHADERLANGUAGE_WGSL, BindUniformBufferFormat, BindTextureFormat, BindStorageTextureFormat, SHADERSTAGE_COMPUTE, SAMPLETYPE_FLOAT, SAMPLETYPE_UNFILTERABLE_FLOAT, TEXTUREDIMENSION_2D, UniformFormat, UNIFORMTYPE_VEC4, Compute, PIXELFORMAT_RGBA32U, PIXELFORMAT_R8U, SAMPLETYPE_UINT, PIXELFORMAT_RGBA8, StorageBuffer, BUFFERUSAGE_COPY_DST, PIXELFORMAT_RGBA32F, Vec2, Frustum, BoundingSphere, Camera as Camera$1, BindStorageBufferFormat, UNIFORMTYPE_UINT, SAMPLETYPE_DEPTH, ShaderMaterial, BLEND_NONE, CULLFACE_NONE, MeshInstance, GraphNode, FUNC_LESS, BLEND_PREMULTIPLIED, BUFFERUSAGE_COPY_SRC, UNIFORMTYPE_MAT4, UNIFORMTYPE_VEC2, UNIFORMTYPE_FLOAT, FUNC_ALWAYS, PIXELFORMAT_RGBA16U, FILTER_LINEAR, Mesh, PRIMITIVE_TRIANGLES, RenderPass, SHADER_FORWARD, FramePass, PIXELFORMAT_DEPTH, platform, PROJECTION_PERSPECTIVE, math, Script, SEMANTIC_TEXCOORD0, BLEND_NORMAL, CULLFACE_BACK, PIXELFORMAT_SRGBA8, StandardMaterial, BLENDEQUATION_ADD, BLENDMODE_ZERO, BLENDMODE_SRC_ALPHA, XRTRACKABLE_PLANE, XRTRACKABLE_MESH, SHADERLANGUAGE_GLSL, BoundingBox, BLENDMODE_ONE_MINUS_SRC_ALPHA, DEVICETYPE_WEBGL2, version as version$1, Pose, OrbitController as OrbitController$1, ShaderUtils, ASPECT_AUTO, drawQuadWithShader, PRIMITIVE_TRISTRIP, PIXELFORMAT_R32F, PIXELFORMAT_R16F, GamepadSource, KeyboardMouseSource, MultiTouchSource, InputFrame, Layer, SORTMODE_MANUAL, FUNC_EQUAL, FUNC_LESSEQUAL, RENDERSTYLE_WIREFRAME, GSPLAT_DEBUG_LOD, GSPLAT_DEBUG_NONE, MiniStats, CameraFrame, TONEMAP_NEUTRAL, TONEMAP_ACES2, TONEMAP_ACES, TONEMAP_HEJL, TONEMAP_FILMIC, TONEMAP_LINEAR, TONEMAP_NONE, LAYERID_SKYBOX, GSPLAT_RENDERER_RASTER_GPU_SORT, GSPLAT_RENDERER_RASTER_CPU_SORT, revision, EventHandler, createGraphicsDevice, Keyboard, TouchDevice as TouchDevice$1, Mouse } from 'playcanvas';
|
|
1
|
+
import { AppBase, AppOptions, CameraComponentSystem, LightComponentSystem, RenderComponentSystem, GSplatComponentSystem, ScriptComponentSystem, ContainerHandler, TextureHandler, GSplatHandler, BinaryHandler, XrManager, Asset, SEMANTIC_POSITION, INDEXFORMAT_UINT32, GSplatContainer, GSplatFormat, Vec3, Entity, Quat, WORKBUFFER_UPDATE_ONCE, Vec4, Mat4, Color, PROJECTION_ORTHOGRAPHIC, ShaderChunks, Texture, ADDRESS_CLAMP_TO_EDGE, FILTER_NEAREST, PIXELFORMAT_RGBA16F, RenderTarget, RenderPassPicker, BlendState, BLENDEQUATION_MIN, BLENDMODE_ONE, PIXELFORMAT_R32U, Shader, BindGroupFormat, UniformBufferFormat, SHADERLANGUAGE_WGSL, BindUniformBufferFormat, BindTextureFormat, BindStorageTextureFormat, SHADERSTAGE_COMPUTE, SAMPLETYPE_FLOAT, SAMPLETYPE_UNFILTERABLE_FLOAT, TEXTUREDIMENSION_2D, UniformFormat, UNIFORMTYPE_VEC4, Compute, PIXELFORMAT_RGBA32U, PIXELFORMAT_R8U, SAMPLETYPE_UINT, PIXELFORMAT_RGBA8, StorageBuffer, BUFFERUSAGE_COPY_DST, PIXELFORMAT_RGBA32F, Vec2, Frustum, BoundingSphere, Camera as Camera$1, BindStorageBufferFormat, UNIFORMTYPE_UINT, SAMPLETYPE_DEPTH, ShaderMaterial, BLEND_NONE, CULLFACE_NONE, MeshInstance, GraphNode, FUNC_LESS, BLEND_PREMULTIPLIED, BUFFERUSAGE_COPY_SRC, UNIFORMTYPE_MAT4, UNIFORMTYPE_VEC2, UNIFORMTYPE_FLOAT, FUNC_ALWAYS, PIXELFORMAT_RGBA16U, FILTER_LINEAR, Mesh, PRIMITIVE_TRIANGLES, RenderPass, SHADER_FORWARD, FramePass, PIXELFORMAT_DEPTH, platform, PROJECTION_PERSPECTIVE, math, Script, SEMANTIC_TEXCOORD0, BLEND_NORMAL, CULLFACE_BACK, PIXELFORMAT_SRGBA8, StandardMaterial, BLENDEQUATION_ADD, BLENDMODE_ZERO, BLENDMODE_SRC_ALPHA, XRTRACKABLE_PLANE, XRTRACKABLE_MESH, SHADERLANGUAGE_GLSL, BoundingBox, BLENDMODE_ONE_MINUS_SRC_ALPHA, DEVICETYPE_WEBGL2, version as version$1, Pose, OrbitController as OrbitController$1, ShaderUtils, ASPECT_AUTO, drawQuadWithShader, PRIMITIVE_TRISTRIP, PIXELFORMAT_R32F, PIXELFORMAT_R16F, GamepadSource, KeyboardMouseSource, MultiTouchSource, InputFrame, Layer, SORTMODE_MANUAL, FUNC_EQUAL, FUNC_LESSEQUAL, RENDERSTYLE_WIREFRAME, GSPLAT_DEBUG_LOD, GSPLAT_DEBUG_NONE, MiniStats, CameraFrame, TONEMAP_NEUTRAL, TONEMAP_ACES2, TONEMAP_ACES, TONEMAP_HEJL, TONEMAP_FILMIC, TONEMAP_LINEAR, TONEMAP_NONE, LAYERID_SKYBOX, GSPLAT_RENDERER_RASTER_GPU_SORT, GSPLAT_RENDERER_RASTER_CPU_SORT, WasmModule, revision, EventHandler, createGraphicsDevice, Keyboard, TouchDevice as TouchDevice$1, Mouse } from 'playcanvas';
|
|
2
|
+
import { SpzParser } from 'playcanvas/scripts/esm/parsers/spz-parser.mjs';
|
|
2
3
|
import { XrControllers } from 'playcanvas/scripts/esm/xr/xr-controllers.mjs';
|
|
3
4
|
import { XrNavigation } from 'playcanvas/scripts/esm/xr/xr-navigation.mjs';
|
|
4
5
|
|
|
@@ -20,6 +21,9 @@ class App extends AppBase {
|
|
|
20
21
|
appOptions.keyboard = options.keyboard;
|
|
21
22
|
appOptions.xr = XrManager;
|
|
22
23
|
this.init(appOptions);
|
|
24
|
+
// spz files, and the spz chunks of lcc2 scenes. Version 3 files are gzip compressed;
|
|
25
|
+
// version 4 files need the ZSTD decoder module (src/zstd-decoder.ts)
|
|
26
|
+
this.loader.getHandler('gsplat').addParser(new SpzParser(this));
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
|
|
@@ -4309,7 +4313,7 @@ struct FootprintEye1 {
|
|
|
4309
4313
|
determinant: f32
|
|
4310
4314
|
}
|
|
4311
4315
|
|
|
4312
|
-
fn footprintEye1(center: vec3f, rot: vec4f, scale: vec3f, viewport: vec2f) -> FootprintEye1 {
|
|
4316
|
+
fn footprintEye1(center: vec3f, rot: vec4f, scale: vec3f, viewport: vec2f, lowpass: f32) -> FootprintEye1 {
|
|
4313
4317
|
var f: FootprintEye1;
|
|
4314
4318
|
f.visible = false;
|
|
4315
4319
|
f.ndc = vec2f(1e4);
|
|
@@ -4381,22 +4385,26 @@ ${warp
|
|
|
4381
4385
|
: `
|
|
4382
4386
|
f.ndc = clip.xy / clip.w;
|
|
4383
4387
|
`}
|
|
4388
|
+
// the culls measure the footprint with the cull filter, and the drawn one takes the view's
|
|
4389
|
+
// filter (see project() below)
|
|
4384
4390
|
let us2 = uniforms.unitScale * uniforms.unitScale;
|
|
4385
|
-
|
|
4386
|
-
cov11
|
|
4387
|
-
f.determinant = cov00 * cov11 - cov01 * cov01;
|
|
4391
|
+
let cullDilation = 0.3 / us2;
|
|
4392
|
+
f.determinant = (cov00 + cullDilation) * (cov11 + cullDilation) - cov01 * cov01;
|
|
4388
4393
|
if (f.determinant <= 0.0) {
|
|
4389
4394
|
f.ndc = vec2f(1e4);
|
|
4390
4395
|
return f;
|
|
4391
4396
|
}
|
|
4397
|
+
f.lambda1 = 0.5 * (cov00 + cov11) + cullDilation + length(vec2f(0.5 * (cov00 - cov11), cov01));
|
|
4398
|
+
cov00 += lowpass;
|
|
4399
|
+
cov11 += lowpass;
|
|
4392
4400
|
let mid = 0.5 * (cov00 + cov11);
|
|
4393
4401
|
let radius = length(vec2f(0.5 * (cov00 - cov11), cov01));
|
|
4394
|
-
|
|
4402
|
+
let lambda1 = mid + radius;
|
|
4395
4403
|
let lambda2 = max(mid - radius, 0.1 / us2);
|
|
4396
|
-
let eigenVec = vec2f(cov01,
|
|
4404
|
+
let eigenVec = vec2f(cov01, lambda1 - cov00);
|
|
4397
4405
|
let eigenLen = length(eigenVec);
|
|
4398
4406
|
let direction = select(vec2f(1.0, 0.0), eigenVec / eigenLen, eigenLen > 1e-9);
|
|
4399
|
-
let len1 = 2.0 * sqrt(2.0 *
|
|
4407
|
+
let len1 = 2.0 * sqrt(2.0 * lambda1);
|
|
4400
4408
|
let clampScale = min(1.0, min(1024.0, min(viewport.x, viewport.y)) / len1);
|
|
4401
4409
|
f.axis1 = len1 * clampScale * direction;
|
|
4402
4410
|
f.len2 = 2.0 * sqrt(2.0 * lambda2) * clampScale;
|
|
@@ -4404,7 +4412,83 @@ ${warp
|
|
|
4404
4412
|
return f;
|
|
4405
4413
|
}
|
|
4406
4414
|
`;
|
|
4407
|
-
const projectorWGSL = (readChunk, occlusion, coverage, warp, stereo) =>
|
|
4415
|
+
const projectorWGSL = (readChunk, occlusion, coverage, warp, stereo, antiAlias) => {
|
|
4416
|
+
const aa = antiAlias !== 'off';
|
|
4417
|
+
// the coverage thresholds, drawn from the splat's alpha: before the projection, or with
|
|
4418
|
+
// anti-aliasing after it, once the compensation has set the alpha
|
|
4419
|
+
const coverageWGSL = coverage !== 'pixel'
|
|
4420
|
+
? `
|
|
4421
|
+
// Variant coverage:splat: one coverage threshold per splat and frame instead of one per
|
|
4422
|
+
// pixel. The pixels where alpha exceeds it form a solid ellipse, which the raster draws as a
|
|
4423
|
+
// polygon of the same area with no discard, so a gpu updates depth early and rejects what
|
|
4424
|
+
// lies behind it before rasterising it. Each pixel is still kept with probability alpha,
|
|
4425
|
+
// independently per splat; the noise is a splat at a random size rather than a dither. The
|
|
4426
|
+
// threshold is hashed afresh every frame: one sequence shared by every splat, rotated per
|
|
4427
|
+
// splat, would keep two splats' thresholds a fixed distance apart, so their coverage would
|
|
4428
|
+
// stay correlated over frames and the accumulation would converge to the wrong image. A
|
|
4429
|
+
// splat whose opacity does not exceed its threshold keeps nothing this frame and stops here.
|
|
4430
|
+
// The draw goes into cache word 5 as ${DRAW_BITS} bits, and the raster rebuilds the same
|
|
4431
|
+
// thresholds from them (shaders/raster.ts).
|
|
4432
|
+
let id = slot ^ (file * 2654435761u);
|
|
4433
|
+
let hashed = hashU32(((id + 1u) * 26699u) ^ uniforms.frameSeed);
|
|
4434
|
+
let drawnBits = hashed >> ${32 - DRAW_BITS}u;
|
|
4435
|
+
let drawn = f32(drawnBits) * (1.0 / ${(1 << DRAW_BITS) - 1}.0);
|
|
4436
|
+
// Variant jitter: the threshold is the base of a random stratum instead of the draw itself,
|
|
4437
|
+
// and every pixel adds its own jitter within the stratum in the raster, so the kept region
|
|
4438
|
+
// is the stratum's ellipse with a dithered rim rather than a solid one. Each pixel's
|
|
4439
|
+
// threshold is still uniform over [0, 1) and independent per splat, so the expectation is
|
|
4440
|
+
// unchanged, but neighbouring pixels no longer all agree. Sub-strata (jitterSubs above 1)
|
|
4441
|
+
// narrow the jitter: smaller polygons, more agreement.
|
|
4442
|
+
let subs = uniforms.jitterSubs;
|
|
4443
|
+
let jittered = subs > 0u;
|
|
4444
|
+
let subMask = max(subs, 1u) - 1u;
|
|
4445
|
+
// the per-splat threshold (coverage:splat, and the small splats of the interleaved mode): a
|
|
4446
|
+
// stratum of \`strata\`, its sub-stratum, and the nibble the raster reads them back from
|
|
4447
|
+
// (kept | stratum << 1 | sub << 3)
|
|
4448
|
+
let strata = max(uniforms.strata, 1u);
|
|
4449
|
+
let splatStratum = min(u32(drawn * f32(strata)), strata - 1u);
|
|
4450
|
+
let splatSub = (hashed >> 15u) & subMask;
|
|
4451
|
+
let splatBase = select(drawn, f32(splatStratum * max(subs, 1u) + splatSub) / f32(strata * max(subs, 1u)), jittered);
|
|
4452
|
+
let splatNibble = 1u | (splatStratum << 1u) | (splatSub << 3u);
|
|
4453
|
+
let splatThreshold = max(splatBase, uniforms.alphaClip);
|
|
4454
|
+
let splatKept = splatThreshold < opacity;
|
|
4455
|
+
${coverage === 'interleaved'
|
|
4456
|
+
? `
|
|
4457
|
+
// Variant coverage:interleaved: the pixels split into four interleaved sets, the four of a
|
|
4458
|
+
// 2x2 quad, and each set takes its own threshold, the four quarters of [0, 1) from the one
|
|
4459
|
+
// draw: a quad holds the splat at four stratified sizes, so its mean is nearly the splat's
|
|
4460
|
+
// alpha, as the per-pixel thresholds' is, and neighbouring pixels are no longer all one
|
|
4461
|
+
// splat. Jittered, the sets take the four strata in a random order, each within a random
|
|
4462
|
+
// sub-stratum, and their pixels jitter inside it
|
|
4463
|
+
var setBases = fract(vec4f(drawn) + vec4f(0.0, 0.25, 0.5, 0.75));
|
|
4464
|
+
var setNibbles = vec4u(0u);
|
|
4465
|
+
if (jittered) {
|
|
4466
|
+
let bits = hashU32(hashed ^ 0x9e3779b9u);
|
|
4467
|
+
let packed = PERMUTATIONS[bits % 24u];
|
|
4468
|
+
let perm = (vec4u(packed) >> vec4u(0u, 2u, 4u, 6u)) & vec4u(3u);
|
|
4469
|
+
let subsOf = (vec4u(bits) >> vec4u(8u, 10u, 12u, 14u)) & vec4u(subMask);
|
|
4470
|
+
setBases = vec4f(perm * subs + subsOf) / f32(4u * subs);
|
|
4471
|
+
setNibbles = (perm << vec4u(1u)) | (subsOf << vec4u(3u));
|
|
4472
|
+
}
|
|
4473
|
+
let setThresholds = max(setBases, vec4f(uniforms.alphaClip));
|
|
4474
|
+
let keptSets = setThresholds < vec4f(opacity);
|
|
4475
|
+
setNibbles = select(vec4u(0u), setNibbles | vec4u(1u), keptSets);
|
|
4476
|
+
// whether the splat draws into the sets or the full target waits for its footprint; a splat
|
|
4477
|
+
// keeping nothing either way stops here
|
|
4478
|
+
if (!any(keptSets) && !splatKept) {
|
|
4479
|
+
return result;
|
|
4480
|
+
}
|
|
4481
|
+
let lowest = select(vec4f(2.0), setThresholds, keptSets);
|
|
4482
|
+
let setThreshold = min(min(lowest.x, lowest.y), min(lowest.z, lowest.w));
|
|
4483
|
+
`
|
|
4484
|
+
: `
|
|
4485
|
+
if (!splatKept) {
|
|
4486
|
+
return result;
|
|
4487
|
+
}
|
|
4488
|
+
`}
|
|
4489
|
+
`
|
|
4490
|
+
: '';
|
|
4491
|
+
return /* wgsl */ `
|
|
4408
4492
|
struct ProjectorUniforms {
|
|
4409
4493
|
view: mat4x4f,
|
|
4410
4494
|
viewProj: mat4x4f,
|
|
@@ -4443,7 +4527,7 @@ struct ProjectorUniforms {
|
|
|
4443
4527
|
modelScale: vec4f,
|
|
4444
4528
|
cameraPosition: vec4f,
|
|
4445
4529
|
// 1: covariance in true pixels. 2: the engine's convention (its focal is viewport * proj[0][0],
|
|
4446
|
-
// twice the pixel focal), which
|
|
4530
|
+
// twice the pixel focal), which scales its culls and makes their 0.3 filter 0.075 px^2
|
|
4447
4531
|
unitScale: f32,
|
|
4448
4532
|
// the coverage seed (variant coverage:splat; see the raster's frameSeed)
|
|
4449
4533
|
frameSeed: u32,
|
|
@@ -4466,7 +4550,12 @@ struct ProjectorUniforms {
|
|
|
4466
4550
|
// and its warp table in warpTable
|
|
4467
4551
|
occL2Base: u32,
|
|
4468
4552
|
stereoBase: u32,
|
|
4469
|
-
warpBaseEye1: u32
|
|
4553
|
+
warpBaseEye1: u32,
|
|
4554
|
+
// the variance, in pixels squared, of the filter splats trained with anti-aliasing were
|
|
4555
|
+
// trained with (GSplatParams#antiAliasFilterSize), and the dispatched file's training mode
|
|
4556
|
+
// for the sources that dispatch per file (1: anti-aliased)
|
|
4557
|
+
antiAliasFilterSize: f32,
|
|
4558
|
+
fileAntiAlias: u32
|
|
4470
4559
|
}
|
|
4471
4560
|
|
|
4472
4561
|
// chunk table entry: slotBase, count, node, lod | file << 16
|
|
@@ -4494,21 +4583,21 @@ fn setSplat(idx: u32) {
|
|
|
4494
4583
|
}
|
|
4495
4584
|
|
|
4496
4585
|
${warp
|
|
4497
|
-
|
|
4586
|
+
? `
|
|
4498
4587
|
// variant warp: the view's table (shaders/warp.ts), and in stereo the second eye's after it
|
|
4499
4588
|
@group(0) @binding(7) var<storage, read> warpTable: array<f32>;
|
|
4500
4589
|
${warpWGSL}`
|
|
4501
|
-
|
|
4590
|
+
: ''}
|
|
4502
4591
|
${stereo
|
|
4503
|
-
|
|
4592
|
+
? `
|
|
4504
4593
|
// stereo: the second eye's occlusion grid, and its warp's lookups
|
|
4505
4594
|
@group(0) @binding(8) var<storage, read> occEye1: array<u32>;
|
|
4506
4595
|
${warp ? warpEye1WGSL : ''}
|
|
4507
4596
|
`
|
|
4508
|
-
|
|
4597
|
+
: ''}
|
|
4509
4598
|
${readChunk}
|
|
4510
4599
|
${coverage !== 'pixel'
|
|
4511
|
-
|
|
4600
|
+
? `
|
|
4512
4601
|
// integer hash (Wellons' prospector mix), as the raster's
|
|
4513
4602
|
fn hashU32(x: u32) -> u32 {
|
|
4514
4603
|
var v = x;
|
|
@@ -4530,7 +4619,7 @@ fn radiusAt(threshold: f32, opacity: f32) -> f32 {
|
|
|
4530
4619
|
// the 24 orders of four strata, 2 bits a set
|
|
4531
4620
|
const PERMUTATIONS = array<u32, 24>(${permutations.map((p) => `${p}u`).join(', ')});
|
|
4532
4621
|
`
|
|
4533
|
-
|
|
4622
|
+
: ''}
|
|
4534
4623
|
// quaternion (x, y, z, w) to a rotation matrix (columns)
|
|
4535
4624
|
fn rotationMatrix(qIn: vec4f) -> mat3x3f {
|
|
4536
4625
|
let q = normalize(qIn);
|
|
@@ -4558,82 +4647,12 @@ fn project(slot: u32, file: u32${stereo ? ', local: u32' : ''}) -> Projected {
|
|
|
4558
4647
|
|
|
4559
4648
|
setSplat(slot);
|
|
4560
4649
|
let center = srcCenter();
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
}
|
|
4565
|
-
${coverage !== 'pixel'
|
|
4566
|
-
? `
|
|
4567
|
-
// Variant coverage:splat: one coverage threshold per splat and frame instead of one per
|
|
4568
|
-
// pixel. The pixels where alpha exceeds it form a solid ellipse, which the raster draws as a
|
|
4569
|
-
// polygon of the same area with no discard, so a gpu updates depth early and rejects what
|
|
4570
|
-
// lies behind it before rasterising it. Each pixel is still kept with probability alpha,
|
|
4571
|
-
// independently per splat; the noise is a splat at a random size rather than a dither. The
|
|
4572
|
-
// threshold is hashed afresh every frame: one sequence shared by every splat, rotated per
|
|
4573
|
-
// splat, would keep two splats' thresholds a fixed distance apart, so their coverage would
|
|
4574
|
-
// stay correlated over frames and the accumulation would converge to the wrong image. A
|
|
4575
|
-
// splat whose opacity does not exceed its threshold keeps nothing this frame and stops here.
|
|
4576
|
-
// The draw goes into cache word 5 as ${DRAW_BITS} bits, and the raster rebuilds the same
|
|
4577
|
-
// thresholds from them (shaders/raster.ts).
|
|
4578
|
-
let id = slot ^ (file * 2654435761u);
|
|
4579
|
-
let hashed = hashU32(((id + 1u) * 26699u) ^ uniforms.frameSeed);
|
|
4580
|
-
let drawnBits = hashed >> ${32 - DRAW_BITS}u;
|
|
4581
|
-
let drawn = f32(drawnBits) * (1.0 / ${(1 << DRAW_BITS) - 1}.0);
|
|
4582
|
-
// Variant jitter: the threshold is the base of a random stratum instead of the draw itself,
|
|
4583
|
-
// and every pixel adds its own jitter within the stratum in the raster, so the kept region
|
|
4584
|
-
// is the stratum's ellipse with a dithered rim rather than a solid one. Each pixel's
|
|
4585
|
-
// threshold is still uniform over [0, 1) and independent per splat, so the expectation is
|
|
4586
|
-
// unchanged, but neighbouring pixels no longer all agree. Sub-strata (jitterSubs above 1)
|
|
4587
|
-
// narrow the jitter: smaller polygons, more agreement.
|
|
4588
|
-
let subs = uniforms.jitterSubs;
|
|
4589
|
-
let jittered = subs > 0u;
|
|
4590
|
-
let subMask = max(subs, 1u) - 1u;
|
|
4591
|
-
// the per-splat threshold (coverage:splat, and the small splats of the interleaved mode): a
|
|
4592
|
-
// stratum of \`strata\`, its sub-stratum, and the nibble the raster reads them back from
|
|
4593
|
-
// (kept | stratum << 1 | sub << 3)
|
|
4594
|
-
let strata = max(uniforms.strata, 1u);
|
|
4595
|
-
let splatStratum = min(u32(drawn * f32(strata)), strata - 1u);
|
|
4596
|
-
let splatSub = (hashed >> 15u) & subMask;
|
|
4597
|
-
let splatBase = select(drawn, f32(splatStratum * max(subs, 1u) + splatSub) / f32(strata * max(subs, 1u)), jittered);
|
|
4598
|
-
let splatNibble = 1u | (splatStratum << 1u) | (splatSub << 3u);
|
|
4599
|
-
let splatThreshold = max(splatBase, uniforms.alphaClip);
|
|
4600
|
-
let splatKept = splatThreshold < opacity;
|
|
4601
|
-
${coverage === 'interleaved'
|
|
4602
|
-
? `
|
|
4603
|
-
// Variant coverage:interleaved: the pixels split into four interleaved sets, the four of a
|
|
4604
|
-
// 2x2 quad, and each set takes its own threshold, the four quarters of [0, 1) from the one
|
|
4605
|
-
// draw: a quad holds the splat at four stratified sizes, so its mean is nearly the splat's
|
|
4606
|
-
// alpha, as the per-pixel thresholds' is, and neighbouring pixels are no longer all one
|
|
4607
|
-
// splat. Jittered, the sets take the four strata in a random order, each within a random
|
|
4608
|
-
// sub-stratum, and their pixels jitter inside it
|
|
4609
|
-
var setBases = fract(vec4f(drawn) + vec4f(0.0, 0.25, 0.5, 0.75));
|
|
4610
|
-
var setNibbles = vec4u(0u);
|
|
4611
|
-
if (jittered) {
|
|
4612
|
-
let bits = hashU32(hashed ^ 0x9e3779b9u);
|
|
4613
|
-
let packed = PERMUTATIONS[bits % 24u];
|
|
4614
|
-
let perm = (vec4u(packed) >> vec4u(0u, 2u, 4u, 6u)) & vec4u(3u);
|
|
4615
|
-
let subsOf = (vec4u(bits) >> vec4u(8u, 10u, 12u, 14u)) & vec4u(subMask);
|
|
4616
|
-
setBases = vec4f(perm * subs + subsOf) / f32(4u * subs);
|
|
4617
|
-
setNibbles = (perm << vec4u(1u)) | (subsOf << vec4u(3u));
|
|
4618
|
-
}
|
|
4619
|
-
let setThresholds = max(setBases, vec4f(uniforms.alphaClip));
|
|
4620
|
-
let keptSets = setThresholds < vec4f(opacity);
|
|
4621
|
-
setNibbles = select(vec4u(0u), setNibbles | vec4u(1u), keptSets);
|
|
4622
|
-
// whether the splat draws into the sets or the full target waits for its footprint; a splat
|
|
4623
|
-
// keeping nothing either way stops here
|
|
4624
|
-
if (!any(keptSets) && !splatKept) {
|
|
4625
|
-
return result;
|
|
4626
|
-
}
|
|
4627
|
-
let lowest = select(vec4f(2.0), setThresholds, keptSets);
|
|
4628
|
-
let setThreshold = min(min(lowest.x, lowest.y), min(lowest.z, lowest.w));
|
|
4629
|
-
`
|
|
4630
|
-
: `
|
|
4631
|
-
if (!splatKept) {
|
|
4650
|
+
// the file's alpha; the compensation for anti-aliasing (aa) only lowers it, after the culls
|
|
4651
|
+
let opacityRaw = srcOpacity();
|
|
4652
|
+
if (opacityRaw < uniforms.alphaClip) {
|
|
4632
4653
|
return result;
|
|
4633
4654
|
}
|
|
4634
|
-
`}
|
|
4635
|
-
`
|
|
4636
|
-
: ''}
|
|
4655
|
+
${aa ? '' : ` let opacity = opacityRaw;\n${coverageWGSL}`}
|
|
4637
4656
|
let viewCenter = uniforms.view * vec4f(center, 1.0);
|
|
4638
4657
|
let depth = -viewCenter.z;
|
|
4639
4658
|
if (uniforms.isOrtho == 0u && depth <= 0.0) {
|
|
@@ -4691,7 +4710,7 @@ ${coverage === 'interleaved'
|
|
|
4691
4710
|
}
|
|
4692
4711
|
|
|
4693
4712
|
${warp
|
|
4694
|
-
|
|
4713
|
+
? `
|
|
4695
4714
|
// Variant warp: the splat in the foveated target, through the affine map per axis that is
|
|
4696
4715
|
// exact at the two ends of its quad's extent on screen. For a small splat that is the warp's
|
|
4697
4716
|
// slope at its centre; for a large one the secant over what is visible, since a near splat
|
|
@@ -4713,47 +4732,85 @@ ${warp
|
|
|
4713
4732
|
cov01 *= pixelScale.x * pixelScale.y;
|
|
4714
4733
|
cov11 *= pixelScale.y * pixelScale.y;
|
|
4715
4734
|
`
|
|
4716
|
-
|
|
4735
|
+
: `
|
|
4717
4736
|
let ndc = clip.xy / clip.w;
|
|
4718
4737
|
// the target's pixels per screen pixel (variant warp)
|
|
4719
4738
|
let pixelScale = vec2f(1.0);
|
|
4720
4739
|
`}
|
|
4721
|
-
//
|
|
4740
|
+
// The low-pass filter, a variance added to the footprint. The culls measure the footprint
|
|
4741
|
+
// with 0.3 in the chosen units, so in the engine's units with the 0.075 px^2 its culls still
|
|
4742
|
+
// measure; the drawn footprint takes the filter splats are trained with, in true pixels
|
|
4743
|
+
// whatever the units: 0.3 px^2, as the engine's renderer draws them since 2.24
|
|
4722
4744
|
let us2 = uniforms.unitScale * uniforms.unitScale;
|
|
4723
|
-
|
|
4724
|
-
|
|
4745
|
+
let cullDilation = 0.3 / us2;
|
|
4746
|
+
cov00 += cullDilation;
|
|
4747
|
+
cov11 += cullDilation;
|
|
4725
4748
|
let determinant = cov00 * cov11 - cov01 * cov01;
|
|
4726
4749
|
if (determinant <= 0.0) {
|
|
4727
4750
|
return result;
|
|
4728
4751
|
}
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4752
|
+
let cullLambda1 = 0.5 * (cov00 + cov11) + length(vec2f(0.5 * (cov00 - cov11), cov01));
|
|
4753
|
+
${aa
|
|
4754
|
+
? `
|
|
4755
|
+
// Anti-aliasing compensation, as the engine's projector applies it: a splat trained with
|
|
4756
|
+
// anti-aliasing draws with the filter it was trained with (antiAliasFilterSize), its alpha
|
|
4757
|
+
// scaled by the square root of the unfiltered footprint's determinant over the filtered one's,
|
|
4758
|
+
// which keeps a small splat's alpha mass what it was in training. The culls below still
|
|
4759
|
+
// measure the footprint with the file's alpha, as the engine's do
|
|
4760
|
+
let compensated = ${antiAlias === 'mixed' ? 'srcAntiAlias()' : 'true'};
|
|
4761
|
+
let lowpass = select(0.3, uniforms.antiAliasFilterSize, compensated);
|
|
4762
|
+
`
|
|
4763
|
+
: `
|
|
4764
|
+
let lowpass = 0.3;
|
|
4765
|
+
`}${stereo
|
|
4766
|
+
? `
|
|
4736
4767
|
// Stereo: one projection serves both eyes, as the engine's own stereo projector does: the
|
|
4737
4768
|
// second eye takes this view's depth, colour, coverage and order and its own footprint, and
|
|
4738
4769
|
// every cull keeps what either eye would
|
|
4739
|
-
let eye1 = footprintEye1(center, rot, scale, viewport);
|
|
4770
|
+
let eye1 = footprintEye1(center, rot, scale, viewport, lowpass);
|
|
4740
4771
|
`
|
|
4741
|
-
|
|
4772
|
+
: ''}
|
|
4742
4773
|
// size cull on the footprint's radius in pixels. minPixelSize is a diameter: the engine's
|
|
4743
4774
|
// projector is dispatched with half of it, and its quad path tests the full extent
|
|
4744
4775
|
// (2 sqrt(2 lambda)) against the whole value, so both cut at the same place
|
|
4745
|
-
if (uniforms.unitScale * sqrt(2.0 *
|
|
4746
|
-
|
|
4747
|
-
|
|
4776
|
+
if (uniforms.unitScale * sqrt(2.0 * cullLambda1) < 0.5 * uniforms.minPixelSize${stereo
|
|
4777
|
+
? ' && (!eye1.visible || uniforms.unitScale * sqrt(2.0 * eye1.lambda1) < 0.5 * uniforms.minPixelSize)'
|
|
4778
|
+
: ''}) {
|
|
4748
4779
|
return result;
|
|
4749
4780
|
}
|
|
4750
4781
|
|
|
4751
4782
|
// contribution cull: the splat's alpha mass in pixels (the engine's minContribution rule)
|
|
4752
|
-
if (
|
|
4753
|
-
|
|
4754
|
-
|
|
4783
|
+
if (opacityRaw * 6.283185 * sqrt(determinant) * us2 < uniforms.minContribution${stereo
|
|
4784
|
+
? ' && (!eye1.visible || opacityRaw * 6.283185 * sqrt(eye1.determinant) * us2 < uniforms.minContribution)'
|
|
4785
|
+
: ''}) {
|
|
4786
|
+
return result;
|
|
4787
|
+
}
|
|
4788
|
+
|
|
4789
|
+
// the drawn footprint
|
|
4790
|
+
let raw00 = cov00 - cullDilation;
|
|
4791
|
+
let raw11 = cov11 - cullDilation;
|
|
4792
|
+
cov00 = raw00 + lowpass;
|
|
4793
|
+
cov11 = raw11 + lowpass;
|
|
4794
|
+
${aa
|
|
4795
|
+
? `
|
|
4796
|
+
var opacity = opacityRaw;
|
|
4797
|
+
if (compensated) {
|
|
4798
|
+
opacity *= sqrt(max((raw00 * raw11 - cov01 * cov01) / (cov00 * cov11 - cov01 * cov01), 0.0));
|
|
4799
|
+
}
|
|
4800
|
+
// a splat the compensation faded below the clip is dropped, as the engine's projector drops it.
|
|
4801
|
+
// In stereo the second eye takes this eye's compensated alpha, its clip and its coverage, as it
|
|
4802
|
+
// does in the engine's stereo projector (which shares the footprint too): the factor depends
|
|
4803
|
+
// on the view, so a thin splat edge-on to this eye but not to the other is fainter there than
|
|
4804
|
+
// it should be, or gone. Separate projections (variant stereo:separate) compensate per eye
|
|
4805
|
+
if (opacity < uniforms.alphaClip) {
|
|
4755
4806
|
return result;
|
|
4756
4807
|
}
|
|
4808
|
+
${coverageWGSL}`
|
|
4809
|
+
: ''}
|
|
4810
|
+
let mid = 0.5 * (cov00 + cov11);
|
|
4811
|
+
let radius = length(vec2f(0.5 * (cov00 - cov11), cov01));
|
|
4812
|
+
let lambda1 = mid + radius;
|
|
4813
|
+
let lambda2 = max(mid - radius, 0.1 / us2);
|
|
4757
4814
|
|
|
4758
4815
|
// principal axis; a circular footprint has no defined eigenvector, any axis is right
|
|
4759
4816
|
let eigenVec = vec2f(cov01, lambda1 - cov00);
|
|
@@ -4764,14 +4821,14 @@ ${stereo
|
|
|
4764
4821
|
let len2Full = 2.0 * sqrt(2.0 * lambda2);
|
|
4765
4822
|
let clampScale = min(1.0, maxRadius / len1);
|
|
4766
4823
|
${coverage !== 'pixel'
|
|
4767
|
-
|
|
4824
|
+
? `
|
|
4768
4825
|
// The kept ellipse's polygon, in units of the quad's half extent: area matched to the
|
|
4769
4826
|
// ellipse, or containing it when the raster discards outside it (jitter). The cache keeps
|
|
4770
4827
|
// the full quad's axes and the raster sizes each polygon itself; here the largest bounds the
|
|
4771
4828
|
// culls below
|
|
4772
4829
|
let polygonScale = select(${polygonScale()}, ${polygonScale(true)}, jittered);
|
|
4773
4830
|
${coverage === 'interleaved'
|
|
4774
|
-
|
|
4831
|
+
? `
|
|
4775
4832
|
// the small splats of the interleaved mode draw per splat into the full target: the
|
|
4776
4833
|
// footprint at the alpha clip, in pixels, decides
|
|
4777
4834
|
let footprint = 3.14159265 * len1 * len2Full * pow(radiusAt(max(uniforms.alphaClip, 1e-6), opacity), 2.0);
|
|
@@ -4782,11 +4839,11 @@ ${coverage === 'interleaved'
|
|
|
4782
4839
|
let threshold = select(setThreshold, splatThreshold, fullEntry);
|
|
4783
4840
|
let radiusScale = clampScale * radiusAt(threshold, opacity) * polygonScale;
|
|
4784
4841
|
`
|
|
4785
|
-
|
|
4842
|
+
: `
|
|
4786
4843
|
let radiusScale = clampScale * radiusAt(splatThreshold, opacity) * polygonScale;
|
|
4787
4844
|
`}
|
|
4788
4845
|
`
|
|
4789
|
-
|
|
4846
|
+
: `
|
|
4790
4847
|
let radiusScale = clampScale;
|
|
4791
4848
|
`}
|
|
4792
4849
|
// the extent the culls test: the largest polygon the raster will draw
|
|
@@ -4799,7 +4856,7 @@ ${coverage === 'interleaved'
|
|
|
4799
4856
|
var outside = centerPixels.x + extent.x < 0.0 || centerPixels.x - extent.x > viewport.x
|
|
4800
4857
|
|| centerPixels.y + extent.y < 0.0 || centerPixels.y - extent.y > viewport.y;
|
|
4801
4858
|
${stereo
|
|
4802
|
-
|
|
4859
|
+
? `
|
|
4803
4860
|
// a splat either eye sees survives: the second eye's largest polygon is to its full quad as
|
|
4804
4861
|
// this view's is (both eyes' targets are the same size)
|
|
4805
4862
|
let polygonRatio = radiusScale / clampScale;
|
|
@@ -4810,13 +4867,13 @@ ${stereo
|
|
|
4810
4867
|
outside = outside && (!eye1.visible || centerEye1.x + extentEye1.x < 0.0 || centerEye1.x - extentEye1.x > viewport.x
|
|
4811
4868
|
|| centerEye1.y + extentEye1.y < 0.0 || centerEye1.y - extentEye1.y > viewport.y);
|
|
4812
4869
|
`
|
|
4813
|
-
|
|
4870
|
+
: ''}
|
|
4814
4871
|
if (outside) {
|
|
4815
4872
|
return result;
|
|
4816
4873
|
}
|
|
4817
4874
|
|
|
4818
4875
|
${occlusion
|
|
4819
|
-
|
|
4876
|
+
? `
|
|
4820
4877
|
// Occlusion cull against the previous frame. Each stored depth is the nearest sample that
|
|
4821
4878
|
// survived there, so the farthest depth over the blocks a splat covered bounds what could
|
|
4822
4879
|
// still have shown behind it; a splat whose front (its centre less 2 sqrt(2) sigma along the
|
|
@@ -4828,15 +4885,15 @@ ${occlusion
|
|
|
4828
4885
|
if (uniforms.occlusionMode != 0u) {
|
|
4829
4886
|
let halfExtent = len1 * radiusScale;
|
|
4830
4887
|
if (occludedIn(center, depth, focal.x, halfExtent, c22)${stereo
|
|
4831
|
-
|
|
4832
|
-
|
|
4888
|
+
? ' && (!eye1.visible || occludedInEye1(center, eye1.depth, uniforms.focalEye1.x, length(axis1Eye1), c22))'
|
|
4889
|
+
: ''}) {
|
|
4833
4890
|
result.occluded = true;
|
|
4834
4891
|
return result;
|
|
4835
4892
|
}
|
|
4836
4893
|
}
|
|
4837
4894
|
|
|
4838
4895
|
`
|
|
4839
|
-
|
|
4896
|
+
: ''}
|
|
4840
4897
|
let color = clamp(srcColor(), vec3f(0.0), vec3f(8.0));
|
|
4841
4898
|
|
|
4842
4899
|
// rgb: 10/10/10 unorm with a 2-bit shared exponent (scale 1/2/4/8, range [0, 8])
|
|
@@ -4859,12 +4916,12 @@ ${occlusion
|
|
|
4859
4916
|
result.words[0] = pack2x16snorm(ndc / ndcRange);
|
|
4860
4917
|
result.words[1] = bitcast<u32>(depth);
|
|
4861
4918
|
${coverage !== 'pixel'
|
|
4862
|
-
|
|
4919
|
+
? `
|
|
4863
4920
|
// the full quad's axes (clamped to the radius limit); the raster scales them to each polygon
|
|
4864
4921
|
result.words[2] = pack2x16float(len1 * clampScale * direction);
|
|
4865
4922
|
result.words[3] = pack2x16float(vec2f(len2Full * clampScale, 0.0)) | (u32(clamp(opacity, 0.0, 1.0) * 255.0 + 0.5) << 16u);
|
|
4866
4923
|
`
|
|
4867
|
-
|
|
4924
|
+
: `
|
|
4868
4925
|
result.words[2] = pack2x16float(axis1);
|
|
4869
4926
|
result.words[3] = pack2x16float(vec2f(len2, 0.0)) | (u32(clamp(opacity, 0.0, 1.0) * 255.0 + 0.5) << 16u);
|
|
4870
4927
|
`}
|
|
@@ -4873,24 +4930,24 @@ ${coverage !== 'pixel'
|
|
|
4873
4930
|
result.words[3] |= u32(key) << 24u;
|
|
4874
4931
|
result.words[4] = rgb.r | (rgb.g << 10u) | (rgb.b << 20u) | (exponent << 30u);
|
|
4875
4932
|
${coverage === 'pixel'
|
|
4876
|
-
|
|
4933
|
+
? `
|
|
4877
4934
|
// the stable id the coverage hash seeds from: the slot, salted by the file for sources
|
|
4878
4935
|
// whose indices restart per file
|
|
4879
4936
|
result.words[5] = slot ^ (file * 2654435761u);
|
|
4880
4937
|
`
|
|
4881
|
-
|
|
4882
|
-
|
|
4938
|
+
: coverage === 'interleaved'
|
|
4939
|
+
? `
|
|
4883
4940
|
// the draw's bits, bit 15 for a full-target entry, and a nibble per pixel set (0: the set
|
|
4884
4941
|
// keeps nothing): the raster rebuilds every threshold from them
|
|
4885
4942
|
let nibbles = select(setNibbles, vec4u(splatNibble, 0u, 0u, 0u), fullEntry);
|
|
4886
4943
|
result.words[5] = drawnBits | select(0u, ${FULL_ENTRY_BIT}u, fullEntry)
|
|
4887
4944
|
| (nibbles.x << 16u) | (nibbles.y << 20u) | (nibbles.z << 24u) | (nibbles.w << 28u);
|
|
4888
4945
|
`
|
|
4889
|
-
|
|
4946
|
+
: `
|
|
4890
4947
|
// the draw's bits and the per-splat nibble (shaders/raster.ts)
|
|
4891
4948
|
result.words[5] = drawnBits | (splatNibble << 16u);
|
|
4892
4949
|
`}${stereo
|
|
4893
|
-
|
|
4950
|
+
? `
|
|
4894
4951
|
// the second eye's centre, in the same range, and its full quad's axes (shaders/raster.ts),
|
|
4895
4952
|
// stashed in workgroup memory rather than returned: three more words in the per-thread state
|
|
4896
4953
|
// that main() holds across its barriers put the Adreno 740's compiler on a slow path, 6-9x
|
|
@@ -4900,7 +4957,7 @@ ${coverage === 'pixel'
|
|
|
4900
4957
|
pack2x16float(eye1.axis1),
|
|
4901
4958
|
pack2x16float(vec2f(eye1.len2, 0.0))
|
|
4902
4959
|
);`
|
|
4903
|
-
|
|
4960
|
+
: ''}
|
|
4904
4961
|
return result;
|
|
4905
4962
|
}
|
|
4906
4963
|
|
|
@@ -4908,10 +4965,10 @@ var<workgroup> wgCount: atomic<u32>;
|
|
|
4908
4965
|
var<workgroup> wgOccluded: atomic<u32>;
|
|
4909
4966
|
var<workgroup> wgBase: u32;
|
|
4910
4967
|
var<workgroup> wgBuckets: array<atomic<u32>, ${ORDER_BUCKETS}>;${stereo
|
|
4911
|
-
|
|
4968
|
+
? `
|
|
4912
4969
|
// stereo: each thread's second-eye words, from project() to the cache write
|
|
4913
4970
|
var<workgroup> wgEye1: array<vec3u, ${PROJECTOR_WORKGROUP_SIZE}>;`
|
|
4914
|
-
|
|
4971
|
+
: ''}
|
|
4915
4972
|
|
|
4916
4973
|
@compute @workgroup_size(${PROJECTOR_WORKGROUP_SIZE})
|
|
4917
4974
|
fn main(
|
|
@@ -4956,16 +5013,16 @@ fn main(
|
|
|
4956
5013
|
for (var i = 0u; i < ${CACHE_WORDS}u; i++) {
|
|
4957
5014
|
cache[base + i] = projected.words[i];
|
|
4958
5015
|
}${stereo
|
|
4959
|
-
|
|
5016
|
+
? `
|
|
4960
5017
|
// the second eye's three words, after every entry
|
|
4961
5018
|
let stereoBase = uniforms.stereoBase + (wgBase + localSlot) * 3u;
|
|
4962
5019
|
let eye1Words = wgEye1[local];
|
|
4963
5020
|
cache[stereoBase] = eye1Words.x;
|
|
4964
5021
|
cache[stereoBase + 1u] = eye1Words.y;
|
|
4965
5022
|
cache[stereoBase + 2u] = eye1Words.z;`
|
|
4966
|
-
|
|
5023
|
+
: ''}
|
|
4967
5024
|
${coverage === 'interleaved'
|
|
4968
|
-
|
|
5025
|
+
? `
|
|
4969
5026
|
// one entry per kept pixel set, or one in the full target's group: the group's
|
|
4970
5027
|
// ${SET_BUCKETS} buckets, front to back, from the depth bucket
|
|
4971
5028
|
let depthKey = ((projected.words[3] >> 24u) * ${SET_BUCKETS}u) >> 8u;
|
|
@@ -4978,7 +5035,7 @@ ${coverage === 'interleaved'
|
|
|
4978
5035
|
}
|
|
4979
5036
|
}
|
|
4980
5037
|
}`
|
|
4981
|
-
|
|
5038
|
+
: ` atomicAdd(&wgBuckets[projected.words[3] >> 24u], 1u);`}
|
|
4982
5039
|
}
|
|
4983
5040
|
// a chunk's splats are spatially coherent, so few of its buckets are non-empty: one
|
|
4984
5041
|
// workgroup count each, then one global atomic per non-empty bucket
|
|
@@ -4989,6 +5046,7 @@ ${coverage === 'interleaved'
|
|
|
4989
5046
|
}
|
|
4990
5047
|
}
|
|
4991
5048
|
`;
|
|
5049
|
+
};
|
|
4992
5050
|
|
|
4993
5051
|
// Single-thread pass turning the projector's survivor count into the indexed indirect draw
|
|
4994
5052
|
// arguments for the raster pass and the indirect dispatch size of the order scatter. Nothing
|
|
@@ -6464,6 +6522,11 @@ fn srcOpacity() -> f32 {
|
|
|
6464
6522
|
return f32((packedG.w >> 8u) & 0xffu) / 255.0;
|
|
6465
6523
|
}
|
|
6466
6524
|
|
|
6525
|
+
// the file's training mode: one file per dispatch, so the renderer sets it per dispatch
|
|
6526
|
+
fn srcAntiAlias() -> bool {
|
|
6527
|
+
return uniforms.fileAntiAlias != 0u;
|
|
6528
|
+
}
|
|
6529
|
+
|
|
6467
6530
|
// the file stores three components and the omitted axis; the engine's getRotation
|
|
6468
6531
|
fn srcRotation() -> vec4f {
|
|
6469
6532
|
let qb = vec4u((packedG.y >> 16u) & 0xffu, packedG.y >> 24u, packedG.z & 0xffu, (packedG.z >> 8u) & 0xffu);
|
|
@@ -7015,6 +7078,11 @@ fn srcOpacity() -> f32 {
|
|
|
7015
7078
|
return srcColorCache.a;
|
|
7016
7079
|
}
|
|
7017
7080
|
|
|
7081
|
+
// the file's training mode: one file per dispatch, so the renderer sets it per dispatch
|
|
7082
|
+
fn srcAntiAlias() -> bool {
|
|
7083
|
+
return uniforms.fileAntiAlias != 0u;
|
|
7084
|
+
}
|
|
7085
|
+
|
|
7018
7086
|
// the format returns (w, x, y, z); world = model * source
|
|
7019
7087
|
fn srcRotation() -> vec4f {
|
|
7020
7088
|
let q = quatMulF(uniforms.modelRotation, getRotation().yzwx);
|
|
@@ -7209,6 +7277,8 @@ fn srcOpacity() -> f32 { return getOpacity(); }
|
|
|
7209
7277
|
fn srcRotation() -> vec4f { return getRotation(); }
|
|
7210
7278
|
fn srcScale() -> vec3f { return getScale(); }
|
|
7211
7279
|
fn srcColor() -> vec3f { return getColor(); }
|
|
7280
|
+
// the training mode the engine stamps on each splat it copies (the low bit of its centre)
|
|
7281
|
+
fn srcAntiAlias() -> bool { return getAntiAlias(); }
|
|
7212
7282
|
`;
|
|
7213
7283
|
}
|
|
7214
7284
|
bindFormats() {
|
|
@@ -8863,12 +8933,13 @@ class StochasticSplatRenderer {
|
|
|
8863
8933
|
Math.abs(otherProjection.data[0]) * width * 0.5,
|
|
8864
8934
|
Math.abs(otherProjection.data[5]) * height * 0.5
|
|
8865
8935
|
];
|
|
8936
|
+
const antiAlias = this.antiAliasMode(set);
|
|
8866
8937
|
const groups = this.source.dispatchPlan(set, this.numChunks);
|
|
8867
8938
|
for (const group of groups) {
|
|
8868
8939
|
// a file with no node in the frustum has nothing to dispatch
|
|
8869
8940
|
if (group.fileIndex >= 0 && !this.anyNodeVisible(view, set.files[group.fileIndex].nodes))
|
|
8870
8941
|
continue;
|
|
8871
|
-
const projector = this.ensureProjector(view, culling, coverage, warped, !!eye1, group);
|
|
8942
|
+
const projector = this.ensureProjector(view, culling, coverage, warped, !!eye1, antiAlias, group);
|
|
8872
8943
|
this.source.bind(projector, group, set);
|
|
8873
8944
|
projector.setParameter('chunks', this.chunkBuffer);
|
|
8874
8945
|
projector.setParameter('nodeVisible', view.nodeVisibleBuffer);
|
|
@@ -8917,6 +8988,9 @@ class StochasticSplatRenderer {
|
|
|
8917
8988
|
projector.setParameter('occL2Base', view.occBlocks.x1 * view.occBlocks.y1);
|
|
8918
8989
|
projector.setParameter('stereoBase', view.cacheSlots * CACHE_WORDS);
|
|
8919
8990
|
projector.setParameter('warpBaseEye1', view.warpTable?.length ?? 0);
|
|
8991
|
+
projector.setParameter('antiAliasFilterSize', gsplat.antiAliasFilterSize);
|
|
8992
|
+
// the per-file sources' training mode (the work buffer's splats carry their own)
|
|
8993
|
+
projector.setParameter('fileAntiAlias', group.fileIndex >= 0 && set.files[group.fileIndex].resource.antiAlias ? 1 : 0);
|
|
8920
8994
|
Compute.calcDispatchSize(group.chunkCount, tmpVec2);
|
|
8921
8995
|
projector.setupDispatch(tmpVec2.x, tmpVec2.y, 1);
|
|
8922
8996
|
device.computeDispatch([projector], 'sse-splat-project');
|
|
@@ -9315,19 +9389,29 @@ class StochasticSplatRenderer {
|
|
|
9315
9389
|
const bits = view.nodeVisibleData;
|
|
9316
9390
|
return nodes.some((node) => (bits[node.nodeIndex >> 5] >>> (node.nodeIndex & 31)) & 1);
|
|
9317
9391
|
}
|
|
9318
|
-
|
|
9392
|
+
// The anti-aliasing compensation, resolved as the engine's manager resolves it for its own
|
|
9393
|
+
// renderer: the scene's GSplatParams#antiAlias when set, else each file's training mode,
|
|
9394
|
+
// compiled out when no file needs it and read per splat when only some do
|
|
9395
|
+
antiAliasMode(set) {
|
|
9396
|
+
const { antiAlias } = this.app.scene.gsplat;
|
|
9397
|
+
if (antiAlias !== undefined)
|
|
9398
|
+
return antiAlias ? 'on' : 'off';
|
|
9399
|
+
const flagged = set.files.filter((file) => file.resource.antiAlias).length;
|
|
9400
|
+
return flagged === 0 ? 'off' : flagged === set.files.length ? 'on' : 'mixed';
|
|
9401
|
+
}
|
|
9402
|
+
ensureProjector(view, occlusion, coverage, warp, stereo, antiAlias, group) {
|
|
9319
9403
|
const sourceKey = this.source.shaderKey();
|
|
9320
9404
|
if (this.projectorSourceKey !== sourceKey) {
|
|
9321
9405
|
// a different source: every specialisation and the bind group format go
|
|
9322
9406
|
this.destroyProjector();
|
|
9323
9407
|
this.projectorSourceKey = sourceKey;
|
|
9324
9408
|
}
|
|
9325
|
-
const key = `${occlusion ? 'occlusion' : 'plain'}-${coverage}${warp ? '-warp' : ''}${stereo ? '-stereo' : ''}`;
|
|
9409
|
+
const key = `${occlusion ? 'occlusion' : 'plain'}-${coverage}${warp ? '-warp' : ''}${stereo ? '-stereo' : ''}${antiAlias === 'off' ? '' : `-aa-${antiAlias}`}`;
|
|
9326
9410
|
const computeKey = `${key}:${group.fileIndex}`;
|
|
9327
9411
|
const existing = view.projectorComputes.get(computeKey);
|
|
9328
9412
|
if (existing)
|
|
9329
9413
|
return existing;
|
|
9330
|
-
const shader = this.ensureProjectorShader(key, occlusion, coverage, warp, stereo);
|
|
9414
|
+
const shader = this.ensureProjectorShader(key, occlusion, coverage, warp, stereo, antiAlias);
|
|
9331
9415
|
const compute = new Compute(this.device, shader, 'sse-splat-project');
|
|
9332
9416
|
view.projectorComputes.set(computeKey, compute);
|
|
9333
9417
|
return compute;
|
|
@@ -9344,7 +9428,7 @@ class StochasticSplatRenderer {
|
|
|
9344
9428
|
}
|
|
9345
9429
|
}
|
|
9346
9430
|
}
|
|
9347
|
-
ensureProjectorShader(key, occlusion, coverage, warp, stereo) {
|
|
9431
|
+
ensureProjectorShader(key, occlusion, coverage, warp, stereo, antiAlias) {
|
|
9348
9432
|
const existing = this.projectorShaders.get(key);
|
|
9349
9433
|
if (existing)
|
|
9350
9434
|
return existing;
|
|
@@ -9369,7 +9453,7 @@ class StochasticSplatRenderer {
|
|
|
9369
9453
|
const shader = new Shader(device, {
|
|
9370
9454
|
name: `sse-splat-project-${key}`,
|
|
9371
9455
|
shaderLanguage: SHADERLANGUAGE_WGSL,
|
|
9372
|
-
cshader: projectorWGSL(this.source.readChunk(fixed.length), occlusion, coverage, warp, stereo),
|
|
9456
|
+
cshader: projectorWGSL(this.source.readChunk(fixed.length), occlusion, coverage, warp, stereo, antiAlias),
|
|
9373
9457
|
cincludes: this.source.shaderIncludes(),
|
|
9374
9458
|
cdefines: this.source.shaderDefines(),
|
|
9375
9459
|
computeUniformBufferFormats: {
|
|
@@ -9416,7 +9500,9 @@ class StochasticSplatRenderer {
|
|
|
9416
9500
|
new UniformFormat('prevFocalEye1', UNIFORMTYPE_VEC2),
|
|
9417
9501
|
new UniformFormat('occL2Base', UNIFORMTYPE_UINT),
|
|
9418
9502
|
new UniformFormat('stereoBase', UNIFORMTYPE_UINT),
|
|
9419
|
-
new UniformFormat('warpBaseEye1', UNIFORMTYPE_UINT)
|
|
9503
|
+
new UniformFormat('warpBaseEye1', UNIFORMTYPE_UINT),
|
|
9504
|
+
new UniformFormat('antiAliasFilterSize', UNIFORMTYPE_FLOAT),
|
|
9505
|
+
new UniformFormat('fileAntiAlias', UNIFORMTYPE_UINT)
|
|
9420
9506
|
])
|
|
9421
9507
|
},
|
|
9422
9508
|
computeBindGroupFormat: this.projectorBindGroupFormat
|
|
@@ -10023,7 +10109,7 @@ const importSettings = (settings) => {
|
|
|
10023
10109
|
return result;
|
|
10024
10110
|
};
|
|
10025
10111
|
|
|
10026
|
-
var version = "1.
|
|
10112
|
+
var version = "1.43.0";
|
|
10027
10113
|
|
|
10028
10114
|
class Tooltip {
|
|
10029
10115
|
register;
|
|
@@ -20497,8 +20583,13 @@ class FrameGate {
|
|
|
20497
20583
|
}
|
|
20498
20584
|
// a rendered frame's work is all submitted by its end
|
|
20499
20585
|
frameEnd() {
|
|
20500
|
-
if (!this.rendered)
|
|
20586
|
+
if (!this.rendered) {
|
|
20587
|
+
// Firefox resolves onSubmittedWorkDone only when its gpu process polls the device, on a
|
|
20588
|
+
// submit or a ~100 ms timer, so an empty submit each tick a request waits makes it poll
|
|
20589
|
+
if (this.owed && this.queue)
|
|
20590
|
+
this.queue.submit([]);
|
|
20501
20591
|
return;
|
|
20592
|
+
}
|
|
20502
20593
|
this.rendered = false;
|
|
20503
20594
|
if (this.queue) {
|
|
20504
20595
|
this.pending++;
|
|
@@ -23589,7 +23680,11 @@ class Viewer {
|
|
|
23589
23680
|
vec.sub2(sceneBound.center, camera.position);
|
|
23590
23681
|
const dist = vec.dot(cameraEntity.forward);
|
|
23591
23682
|
const far = Math.max(dist + boundRadius, 1e-2);
|
|
23592
|
-
|
|
23683
|
+
// the near plane's floor is capped at the orbit's closest zoom: a few stray splats far
|
|
23684
|
+
// outside a scene stretch its bound, and a floor of far / 16k would then cull the
|
|
23685
|
+
// streamed nodes just in front of the camera, and flatten the stochastic renderer's
|
|
23686
|
+
// depths there
|
|
23687
|
+
const near = Math.max(dist - boundRadius, Math.min(far / (1024 * 16), 0.01));
|
|
23593
23688
|
cameraEntity.camera.farClip = far;
|
|
23594
23689
|
cameraEntity.camera.nearClip = Math.min(1.0, near);
|
|
23595
23690
|
};
|
|
@@ -24296,29 +24391,73 @@ class Viewer {
|
|
|
24296
24391
|
}
|
|
24297
24392
|
}
|
|
24298
24393
|
|
|
24394
|
+
var glueSource = "// Glue script for the ZSTD decompression WebAssembly module (decompression only).\n//\n// The wasm binary (zstd.wasm.wasm) is the single-file zstd decoder (zstddeclib) from the\n// Zstandard project (https://github.com/facebook/zstd, BSD-3-Clause), compiled to WebAssembly\n// by the zstddec project (https://github.com/donmccurdy/zstddec, MIT).\n//\n// This script conforms to the WasmModule contract: it exposes a global factory function\n// which is passed a config object with locateFile() and returns a promise of the module\n// instance. Register it like this:\n//\n// import { WasmModule } from 'playcanvas';\n//\n// WasmModule.setConfig('ZstdDecoderModule', {\n// glueUrl: 'zstd.wasm.js',\n// wasmUrl: 'zstd.wasm.wasm'\n// });\n//\n// The resolved instance exposes:\n//\n// decompress(src: Uint8Array, decompressedSize: number): Uint8Array\n(function () {\n function ZstdDecoderModule(config) {\n config = config || {};\n\n var instance = null;\n var heap = null;\n\n var refreshHeap = function () {\n heap = new Uint8Array(instance.exports.memory.buffer);\n };\n\n // the only import the wasm module needs - notification of memory growth\n var imports = {\n env: {\n emscripten_notify_memory_growth: function () {\n refreshHeap();\n }\n }\n };\n\n var wasmUrl = config.locateFile ? config.locateFile('zstd.wasm.wasm') : 'zstd.wasm.wasm';\n\n return fetch(wasmUrl)\n .then(function (response) {\n return response.arrayBuffer();\n })\n .then(function (bytes) {\n return WebAssembly.instantiate(bytes, imports);\n })\n .then(function (result) {\n instance = result.instance;\n refreshHeap();\n\n return {\n decompress: function (src, decompressedSize) {\n var exports = instance.exports;\n\n // copy compressed data into wasm memory\n var srcPtr = exports.malloc(src.byteLength);\n heap.set(src, srcPtr);\n\n // decompress\n var dstPtr = exports.malloc(decompressedSize);\n var size = exports.ZSTD_decompress(dstPtr, decompressedSize, srcPtr, src.byteLength);\n var error = exports.ZSTD_isError(size);\n var data = error ? null : heap.slice(dstPtr, dstPtr + size);\n\n exports.free(srcPtr);\n exports.free(dstPtr);\n\n if (error) {\n throw new Error('ZstdDecoderModule: failed to decompress data');\n }\n return data;\n }\n };\n })\n .catch(function (err) {\n if (config.onAbort) {\n config.onAbort(err);\n }\n throw err;\n });\n }\n\n window.ZstdDecoderModule = ZstdDecoderModule;\n})();\n";
|
|
24395
|
+
|
|
24396
|
+
// the glue's blob url, made once a page: every viewer on it shares the engine's module registry
|
|
24397
|
+
let glueUrl = null;
|
|
24398
|
+
/**
|
|
24399
|
+
* Registers the engine's ZSTD decoder, which the spz parser needs for version 4 files. Only the
|
|
24400
|
+
* urls are recorded here: the engine loads the glue and the wasm on the first version 4 file.
|
|
24401
|
+
*
|
|
24402
|
+
* @param wasmUrl - The decoder's wasm; by default the file shipped beside the bundle.
|
|
24403
|
+
*/
|
|
24404
|
+
const registerZstdDecoder = (wasmUrl) => {
|
|
24405
|
+
glueUrl ??= URL.createObjectURL(new Blob([glueSource], { type: 'text/javascript' }));
|
|
24406
|
+
WasmModule.setConfig('ZstdDecoderModule', {
|
|
24407
|
+
glueUrl,
|
|
24408
|
+
// a literal `new URL(..., import.meta.url)`, so a host's bundler emits the file with its own
|
|
24409
|
+
wasmUrl: wasmUrl ?? new URL('./zstd-decoder.wasm', import.meta.url).href
|
|
24410
|
+
});
|
|
24411
|
+
};
|
|
24412
|
+
|
|
24299
24413
|
// The filename's extension selects the gsplat parser, so a url with no usable name (a data:
|
|
24300
24414
|
// uri) needs the config to name its content instead; falsy (an empty name) falls back to the
|
|
24301
24415
|
// url-derived name.
|
|
24302
24416
|
const contentName = (contentUrl, contentFilename) => contentFilename || new URL(contentUrl, location.href).pathname.split('/').pop();
|
|
24303
|
-
// Whether a prefetched response for this content is worth starting. The engine's octree
|
|
24304
|
-
//
|
|
24305
|
-
// the metadata twice — a quarter of a megabyte on a real scene,
|
|
24306
|
-
// header, so the second request is not a cache hit.
|
|
24307
|
-
//
|
|
24308
|
-
//
|
|
24309
|
-
//
|
|
24310
|
-
|
|
24417
|
+
// Whether a prefetched response for this content is worth starting. The engine's octree and lcc2
|
|
24418
|
+
// parsers fetch lod-meta.json and .lcc2 files themselves and ignore `asset.file.contents`, so
|
|
24419
|
+
// prefetching them downloads the metadata twice — a quarter of a megabyte on a real scene,
|
|
24420
|
+
// served with no cache-control header, so the second request is not a cache hit. The spz parser
|
|
24421
|
+
// takes `asset.file.contents` only as an ArrayBuffer, not the prefetched response, so it fetches
|
|
24422
|
+
// its file itself too, which keeps the download progress (`loadGsplat` reads a response the
|
|
24423
|
+
// caller passes to an ArrayBuffer). Every other splat parser consumes the prefetched response, so they keep
|
|
24424
|
+
// the head start. `src/index.html` applies the same rule when it starts its own prefetch, and
|
|
24425
|
+
// docs/streaming-progress.md covers the engine fix that would let the octree path reuse the
|
|
24426
|
+
// response instead of opting out of it.
|
|
24427
|
+
const isPrefetchable = (contentUrl, contentFilename) => {
|
|
24428
|
+
const name = contentName(contentUrl, contentFilename)?.toLowerCase();
|
|
24429
|
+
return name !== 'lod-meta.json' && !name?.endsWith('.lcc2') && !name?.endsWith('.spz');
|
|
24430
|
+
};
|
|
24311
24431
|
// gsaf is an animated splat sequence, which the viewer decodes and plays itself rather than
|
|
24312
24432
|
// through an engine parser
|
|
24313
24433
|
const isGsaf = (contentUrl, contentFilename) => contentName(contentUrl, contentFilename)?.toLowerCase().endsWith('.gsaf');
|
|
24434
|
+
// TEMPORARY, until a Quest Browser release accepts a WebGPU device for WebXR again: then delete
|
|
24435
|
+
// this and its use in resolveConfig. Quest Browser 156 refuses every WebGPU device for an
|
|
24436
|
+
// immersive session, even one from an adapter requested with xrCompatible (XRGPUBinding throws
|
|
24437
|
+
// "WebGPU device must be created by an XR compatible adapter"), so VR and AR show black. The
|
|
24438
|
+
// headsets already run the sorted renderer (quality.ts keeps the stochastic one off them), so
|
|
24439
|
+
// WebGL costs them only the gpu sort. It overrides even an explicit renderer: 'webgpu', since
|
|
24440
|
+
// hosts pass one by default (superspl.at's viewer-options.ts does). A ?webgpu in the page url
|
|
24441
|
+
// opts back in, to check a new browser release for the fix. It is read here rather than in
|
|
24442
|
+
// index.html, against the rule that only the document reads url params, because hosts parse the
|
|
24443
|
+
// url themselves (superspl.at forwards its scene page's params to the viewer's document but does
|
|
24444
|
+
// not pass this one on)
|
|
24445
|
+
const questBrowser = /OculusBrowser/.test(globalThis.navigator?.userAgent ?? '') &&
|
|
24446
|
+
!new URLSearchParams(globalThis.location?.search ?? '').has('webgpu');
|
|
24314
24447
|
const loadGsplat = async (app, config, progressCallback, cancelled) => {
|
|
24315
24448
|
const { contents, contentUrl, contentFilename } = config;
|
|
24316
|
-
const c = contents;
|
|
24317
24449
|
const filename = contentName(contentUrl, contentFilename);
|
|
24318
|
-
const
|
|
24319
|
-
|
|
24320
|
-
//
|
|
24321
|
-
//
|
|
24450
|
+
const name = filename.toLowerCase();
|
|
24451
|
+
const data = name === 'meta.json' ? await (await contents).json() : undefined;
|
|
24452
|
+
// The spz parser reads `asset.file.contents` only as an ArrayBuffer, so a fetch the caller
|
|
24453
|
+
// started is read to one here (the viewer starts none for spz, see `isPrefetchable`)
|
|
24454
|
+
const c = (name.endsWith('.spz') && contents
|
|
24455
|
+
? await (await contents).arrayBuffer()
|
|
24456
|
+
: contents);
|
|
24457
|
+
// Reading that metadata or those bytes spans a network round trip, so a destroy can land in
|
|
24458
|
+
// the middle of it. `app.destroy()` nulls the asset registry, so registering the asset now
|
|
24459
|
+
// would throw from the engine's internals; reject instead, which the viewer's load chains
|
|
24460
|
+
// expect.
|
|
24322
24461
|
if (cancelled()) {
|
|
24323
24462
|
throw new Error('loadGsplat: the viewer was destroyed while loading');
|
|
24324
24463
|
}
|
|
@@ -24328,7 +24467,13 @@ const loadGsplat = async (app, config, progressCallback, cancelled) => {
|
|
|
24328
24467
|
// always name the app: the engine's default is the most recently created one,
|
|
24329
24468
|
// which is another viewer's when two share a page
|
|
24330
24469
|
const entity = new Entity('gsplat', app);
|
|
24331
|
-
|
|
24470
|
+
// LCC2 scenes are stored +Z up, spz files +Y up, the other formats -Y up
|
|
24471
|
+
if (name.endsWith('.lcc2')) {
|
|
24472
|
+
entity.setLocalEulerAngles(270, 0, 0);
|
|
24473
|
+
}
|
|
24474
|
+
else if (!name.endsWith('.spz')) {
|
|
24475
|
+
entity.setLocalEulerAngles(0, 0, 180);
|
|
24476
|
+
}
|
|
24332
24477
|
entity.addComponent('gsplat', {
|
|
24333
24478
|
unified: true,
|
|
24334
24479
|
asset
|
|
@@ -24400,6 +24545,7 @@ const createApp = async (canvas, config) => {
|
|
|
24400
24545
|
touch: new TouchDevice$1(canvas),
|
|
24401
24546
|
keyboard: new Keyboard(window)
|
|
24402
24547
|
});
|
|
24548
|
+
registerZstdDecoder(config.zstdDecoderUrl);
|
|
24403
24549
|
// The per-splat centres the engine reads back for its cpu sort (12 bytes each, plus a gpu
|
|
24404
24550
|
// readback per file) serve only that sort and non-unified rendering. On WebGPU the viewer
|
|
24405
24551
|
// renders unified, and neither renderer sorts on the cpu (the engine's sorts on the gpu, the
|
|
@@ -24496,10 +24642,11 @@ const resolveConfig = (options) => ({
|
|
|
24496
24642
|
skyboxUrl: options.skyboxUrl,
|
|
24497
24643
|
collisionUrl: options.collisionUrl,
|
|
24498
24644
|
gsafDecoderUrl: options.gsafDecoderUrl,
|
|
24645
|
+
zstdDecoderUrl: options.zstdDecoderUrl,
|
|
24499
24646
|
poster: options.poster ?? (options.posterUrl ? createImage(options.posterUrl) : undefined),
|
|
24500
24647
|
contents: options.contents ??
|
|
24501
24648
|
(isPrefetchable(options.contentUrl, options.contentFilename) ? fetch(options.contentUrl) : undefined),
|
|
24502
|
-
renderer: options.renderer ?? 'webgpu',
|
|
24649
|
+
renderer: questBrowser ? 'webgl' : (options.renderer ?? 'webgpu'),
|
|
24503
24650
|
ui: options.ui ?? true,
|
|
24504
24651
|
reticle: options.reticle ?? false,
|
|
24505
24652
|
noanim: options.noanim ?? false,
|
|
@@ -24509,7 +24656,7 @@ const resolveConfig = (options) => ({
|
|
|
24509
24656
|
colorize: options.colorize ?? false,
|
|
24510
24657
|
fullload: options.fullload ?? false,
|
|
24511
24658
|
vr: options.vr ?? false,
|
|
24512
|
-
aa: options.aa
|
|
24659
|
+
aa: options.aa,
|
|
24513
24660
|
stochastic: options.stochastic ?? false,
|
|
24514
24661
|
// the direct source reads the engine's own splat files, not the container a gsaf sequence
|
|
24515
24662
|
// plays through; the work buffer source reads whatever the engine copied
|