Skip to content

Gaussian Splat SPZ Support #12582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 201 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
0103673
initial vertex calcs for splats
keyboardspecialist Jun 7, 2024
ea53962
removed early returns. we seem to hit them all the time
keyboardspecialist Jun 8, 2024
60022f4
covariance fixes
keyboardspecialist Jun 12, 2024
ba77e31
hack to switch primitive type points to triangle_strips
keyboardspecialist Jun 13, 2024
8d67853
refactor, use inverse matrices
keyboardspecialist Jun 17, 2024
9aaf292
final point primitive experiment. moving to quads
keyboardspecialist Jun 18, 2024
8c3aea4
quad drawing.
keyboardspecialist Jun 19, 2024
7a3f472
new splat pipeline files
keyboardspecialist Jun 21, 2024
4f9c886
shader org
keyboardspecialist Jun 21, 2024
b235c09
switched rendering to not need vertex buffer attr
keyboardspecialist Jun 21, 2024
df28196
tweaks
keyboardspecialist Jun 21, 2024
bdf4eb5
detect KHR_gaussian_splatting extension and set props and prime for p…
keyboardspecialist Jun 26, 2024
7a4c864
Buffer rework. inject attribute buffer for screen space quad at gltf …
keyboardspecialist Jun 28, 2024
c6b8d25
splats but bad projection
keyboardspecialist Jul 1, 2024
a03abdd
shader cleanup, simplification
keyboardspecialist Jul 1, 2024
7d5b09a
minor tweaks
keyboardspecialist Jul 1, 2024
0620dca
tweaks
keyboardspecialist Jul 1, 2024
fe340a4
Fixed position and color buffers
keyboardspecialist Jul 1, 2024
e352ca2
scaling?
keyboardspecialist Jul 1, 2024
3e74c74
added new GAUSSIAN_SPLAT pass
keyboardspecialist Jul 2, 2024
d5f4069
pipeline execution for splats
keyboardspecialist Jul 2, 2024
13dfa78
splats sorted via countSort
keyboardspecialist Jul 2, 2024
31e8d13
invalidates splat commands when camera moves
keyboardspecialist Jul 3, 2024
947d9e0
gaurded splat vertex setup in builddrawcommand
keyboardspecialist Jul 3, 2024
9862eeb
command rebuild under control
keyboardspecialist Jul 3, 2024
0069114
guard gaussian pipeline stage
keyboardspecialist Jul 3, 2024
427d490
sorting fixes
keyboardspecialist Jul 4, 2024
fcfc3df
cleanup
keyboardspecialist Jul 8, 2024
f4657c6
opacity fix
keyboardspecialist Jul 9, 2024
2270dae
small tweak to re-enable instanceDivisor check on attr 0
keyboardspecialist Jul 12, 2024
fb180f6
splat scale now adjustable with 3DTile style
keyboardspecialist Jul 12, 2024
43c08cf
toggle between points and splats at runtime
keyboardspecialist Jul 12, 2024
2b1e72a
Merge branch 'main' into splat-shader
keyboardspecialist Oct 9, 2024
52b3d61
fixes from latest merge
keyboardspecialist Oct 22, 2024
f207786
shader updates improves performance and visual quality
keyboardspecialist Oct 25, 2024
18d75d2
staging for demo
keyboardspecialist Nov 4, 2024
ddceea8
Add unsigned int pixel datatype
keyboardspecialist Nov 13, 2024
d2441cf
guassian texture pipeline
keyboardspecialist Nov 14, 2024
3c7bae6
splat index attr
keyboardspecialist Nov 15, 2024
6061b17
splatting texture pipeline updates and improvements
keyboardspecialist Nov 20, 2024
b2f5aa2
Lots of pipeline changes.
keyboardspecialist Nov 22, 2024
361312b
temporary wasm package integration for CI and sandcastle until NPM
keyboardspecialist Nov 22, 2024
1991389
missing files
keyboardspecialist Nov 22, 2024
baf322d
Rendering fixes and tweaks
keyboardspecialist Dec 6, 2024
bf4ab9d
lets try and clean up this branch with the new prettier changes
keyboardspecialist Dec 10, 2024
de96ac6
sorting fixes in texture mode
keyboardspecialist Dec 11, 2024
276a410
support scaling in texture mode
keyboardspecialist Dec 11, 2024
fb0559b
add myself
keyboardspecialist Dec 11, 2024
6874e72
more sensible dequant positions
keyboardspecialist Dec 11, 2024
2ed9de4
force a command rebuild if the sorter isnt ready
keyboardspecialist Dec 11, 2024
62116b5
wrap await
keyboardspecialist Dec 11, 2024
f0237a7
back up bad change
keyboardspecialist Dec 11, 2024
c858f03
Merge branch 'main' into splatting-prettier-fixup
keyboardspecialist Jan 6, 2025
7142df3
remove unneeded deps
keyboardspecialist Jan 7, 2025
eb1db94
Added a sandcastle example for 3D Tiles Gaussian Splatting
weegeekps Jan 8, 2025
811338a
Merge branch 'main' into splatting-prettier-fixup
weegeekps Jan 10, 2025
ce0976f
Renamed the splatting wasm module
weegeekps Jan 10, 2025
635659e
Committing the wasm package temporarily
weegeekps Jan 10, 2025
edca8a8
Add orientedBoundingBox to gsplat commands
keyboardspecialist Jan 15, 2025
a327c88
typo on final sort calc
keyboardspecialist Jan 16, 2025
b0bde10
Merge branch 'main' into splat-shader
ggetz Jan 16, 2025
ef2ec34
add weighted distance from center to sort
keyboardspecialist Jan 16, 2025
e749c92
Formatting
keyboardspecialist Jan 17, 2025
afcc22a
move copyFileSync for gaussian splat utilities
keyboardspecialist Jan 17, 2025
78ea71a
merge scripts/build.js from main
keyboardspecialist Jan 17, 2025
36fd99e
revert unneeded default value change
keyboardspecialist Jan 17, 2025
0fa8fe4
remove unneeded error checking
keyboardspecialist Jan 17, 2025
703da40
dead code cleanup
keyboardspecialist Jan 17, 2025
ede218f
dead code removal
keyboardspecialist Jan 17, 2025
40c5271
descriptive naming
keyboardspecialist Jan 17, 2025
95fa1ff
remove unused imports
keyboardspecialist Jan 17, 2025
fbf6e82
legibility
keyboardspecialist Jan 17, 2025
b6af598
added TILE_GLTF check for gaussian splatting validity check
keyboardspecialist Jan 17, 2025
1c52cd0
logic cleanup on enableShowGaussianSplatting
keyboardspecialist Jan 17, 2025
0bb27f2
scratch matrices for updateGaussianSplatting
keyboardspecialist Jan 17, 2025
84d1890
use defined()
keyboardspecialist Jan 17, 2025
3e0e4cc
remove superfluous ?? false
keyboardspecialist Jan 17, 2025
76364db
remove unused imports
keyboardspecialist Jan 17, 2025
dbf21c2
remove unused imports
keyboardspecialist Jan 17, 2025
76ea60a
update description
keyboardspecialist Jan 17, 2025
f98cbbf
reverting scratch matrices. Async sorting clobbers them across tiles
keyboardspecialist Jan 17, 2025
be481c3
switch to VertexAttributeSemantics
keyboardspecialist Jan 24, 2025
8183132
texture width constant
keyboardspecialist Jan 24, 2025
933c3e3
added splat indexes to vertex attributes
keyboardspecialist Jan 24, 2025
6d2b048
removed splat indexes from vertex attribute semantics.. doesn't belon…
keyboardspecialist Jan 24, 2025
e9b04ba
Removed need for transform matrix in primitive load plan dequantizing…
keyboardspecialist Jan 30, 2025
7512ef4
added define for debug volumes
keyboardspecialist Jan 30, 2025
d684417
Gaussian Splat Texture Generator now uses TaskProcessor. Async creati…
keyboardspecialist Jan 30, 2025
a2cefeb
remove unused v_depth
keyboardspecialist Jan 31, 2025
e4cb8e3
better splat sorting using bounding volume center
keyboardspecialist Jan 31, 2025
ecd40fa
Loading splats test
keyboardspecialist Feb 6, 2025
a023aa2
meshopt splat test
keyboardspecialist Feb 6, 2025
f38154b
gaussian splat test data
keyboardspecialist Feb 6, 2025
6aa9471
gaussian splat stages
keyboardspecialist Feb 6, 2025
2ee0a7a
gaussian splat pipeline test
keyboardspecialist Feb 7, 2025
b6843bb
remove 2D projection
keyboardspecialist Feb 7, 2025
c207cd5
splat texture pipeline test
keyboardspecialist Feb 7, 2025
eaabc5a
add gaussian splat attributes
keyboardspecialist Feb 7, 2025
3982c9d
changes summary
keyboardspecialist Feb 7, 2025
76c4e7d
Cleaned up how stuff is exposed via wasm.
weegeekps Feb 18, 2025
8b99a80
proof of concept for loading spz from gltf
keyboardspecialist Feb 19, 2025
3983d5a
Removed temp wasm files and used npm package instead
weegeekps Feb 20, 2025
c0ff137
Merge branch 'splat-shader-wasm' into splat-shader
weegeekps Feb 20, 2025
b6636d6
Merge branch 'splat-shader' into splat-spz-concept
keyboardspecialist Feb 21, 2025
96087c9
remove _SPZ attr
keyboardspecialist Feb 21, 2025
74e9ee5
Activate values after unpacking
keyboardspecialist Feb 21, 2025
18ac557
spz-loader
keyboardspecialist Feb 21, 2025
b51755a
Moved SPZ loading into the gltfLoader. Assuming flat spz buffer for now.
keyboardspecialist Feb 26, 2025
9629ded
kind of important to add files first
keyboardspecialist Feb 26, 2025
7fa692a
spz sandcastle
keyboardspecialist Feb 26, 2025
3b4fdd1
model was still mirrored on X axis.
keyboardspecialist Feb 26, 2025
7534e12
Updated wasm-splats to 0.1.0-alpha.1
weegeekps Feb 26, 2025
68b4139
invert quaternion for meshopt to align with original data
keyboardspecialist Feb 26, 2025
b07fa62
Merge branch 'splat-spz-concept' of github.com:CesiumGS/cesium into s…
keyboardspecialist Feb 26, 2025
0083ab5
gaussian splatting shader improvements. Properly handles scaled model…
keyboardspecialist Feb 27, 2025
7b9271f
we can just use czm_modelView for covariance
keyboardspecialist Feb 27, 2025
a1fba0a
Fixed bug with spz opacity. spz-loader already applies the sigmoid
keyboardspecialist Mar 11, 2025
7d2cd53
wrap test with try/catch for meaningful error
keyboardspecialist Mar 12, 2025
ca7b4ce
Merge branch 'main' into splat-spz-concept
keyboardspecialist Mar 12, 2025
b6ad285
remove quaternion flip. was compensating for bug in tiler
keyboardspecialist Mar 28, 2025
1e531a1
new SPZ loader
keyboardspecialist Apr 16, 2025
6fde4e4
color and splat rotation fixes
keyboardspecialist Apr 16, 2025
8db037f
Fix issue with loading non-spz glTFs
keyboardspecialist Apr 17, 2025
e29eb34
Merge branch 'main' into splat-spz-concept
keyboardspecialist Apr 21, 2025
4189e4d
remove orientation correction. handled in tiler now
keyboardspecialist Apr 25, 2025
cb429c2
Updating splat-spz-concept to use latest version of the radix sort
weegeekps Apr 25, 2025
3944f4c
keep rotation for now
keyboardspecialist Apr 25, 2025
517d508
Correctly oriented asset
keyboardspecialist Apr 25, 2025
7668456
Merge pull request #12583 from CesiumGS/wasm-splat-update
weegeekps Apr 25, 2025
1e3a516
splatting content source
keyboardspecialist Apr 28, 2025
d430522
moving sorting and texture code
keyboardspecialist Apr 29, 2025
57d6f04
shader builder
keyboardspecialist May 5, 2025
8bc47b0
wrap tileset and clean up
keyboardspecialist May 6, 2025
13d901b
Fixes. Add detection of GS primitive in CesiumWidget
keyboardspecialist May 6, 2025
34dc9a1
render resource class for GS Primitive
keyboardspecialist May 6, 2025
a12d583
texture fixes
keyboardspecialist May 6, 2025
f619ad3
separate shaders and fixes
keyboardspecialist May 8, 2025
1e30d3f
child tiles
keyboardspecialist May 8, 2025
4fa3f32
GS primitive tests
keyboardspecialist May 8, 2025
f756f27
tag spz loading
keyboardspecialist May 8, 2025
bc52b56
typo
keyboardspecialist May 8, 2025
d76e141
model matrix correction for primitive
keyboardspecialist May 13, 2025
2212686
GS Primitive support in widget. Formatting
keyboardspecialist May 13, 2025
a9b34ee
comment
keyboardspecialist May 13, 2025
e4e7c78
update sandcastle asset
keyboardspecialist May 13, 2025
fee59e8
projection fix. clean up
keyboardspecialist May 15, 2025
cf8ad41
get color by name and ignore any SH attributes
keyboardspecialist May 15, 2025
b907696
flicker fix
keyboardspecialist May 15, 2025
b37d7a2
remove temp_wasm
keyboardspecialist May 15, 2025
0732535
reverted changes for an unrelated CI issue that is no longer relevant
keyboardspecialist May 15, 2025
e4e4812
remove temp_wasm
keyboardspecialist May 15, 2025
8be8ef0
import extensions
keyboardspecialist May 15, 2025
eaf1f0e
removed old file
keyboardspecialist May 15, 2025
f8972fb
move dependencies to correct workspace
keyboardspecialist May 15, 2025
b80fa36
missing extension
keyboardspecialist May 15, 2025
f9531c8
revert launch.json changes
keyboardspecialist May 15, 2025
304c99d
updated asset and GS prim loading
keyboardspecialist May 15, 2025
1aff10a
spz compression extension compatibility updates
keyboardspecialist May 20, 2025
2c8c004
demo asset update
keyboardspecialist May 20, 2025
914fa68
alphas access fix
keyboardspecialist May 20, 2025
41c8fee
Merge branch 'main' into splat-spz-concept
keyboardspecialist May 20, 2025
bbc553c
Merge branch 'main' into splat-spz-concept
keyboardspecialist May 21, 2025
f434dd7
Merge branch 'splat-spz-concept' of github.com:CesiumGS/cesium into s…
keyboardspecialist May 21, 2025
b091fdf
missing arg
keyboardspecialist May 21, 2025
f9fe6cc
spec fixes
keyboardspecialist May 21, 2025
b426cc4
clean up
keyboardspecialist May 21, 2025
488651c
Merge branch 'splat-spz-concept' of github.com:CesiumGS/cesium into s…
keyboardspecialist May 21, 2025
7fc29f5
Remove non-static fromGltf interface
keyboardspecialist May 21, 2025
b5622e0
remove comment
keyboardspecialist May 21, 2025
85a920e
add pick interface
keyboardspecialist May 21, 2025
ca6565d
remove commented code
keyboardspecialist May 21, 2025
f55ac05
unload after decoding SPZ data.
keyboardspecialist May 21, 2025
8f6cfdd
revert to merge-base 7f57ecddce231afffec77240b30065b99beb5e95
keyboardspecialist May 22, 2025
0f416f2
Removing old GS code and properties
keyboardspecialist May 22, 2025
292309a
old GS pipeline code removal
keyboardspecialist May 22, 2025
e6e2cd3
clean up
keyboardspecialist May 22, 2025
881bf70
removed old GS pipeline shaders
keyboardspecialist May 22, 2025
8c6cb76
Removed old GS stages
keyboardspecialist May 22, 2025
5116b84
remove GS specs
keyboardspecialist May 22, 2025
5bc2a79
remove old test data
keyboardspecialist May 22, 2025
104ad85
GS primitive updated to handle current visible tiles at any LOD depth
keyboardspecialist May 23, 2025
0359cc0
typo
keyboardspecialist May 27, 2025
c496440
removed commented code
keyboardspecialist May 27, 2025
907c31e
unwrap fromIonAssetId call
keyboardspecialist May 28, 2025
0dace8c
update to use Cesium3DTileset interface
keyboardspecialist May 28, 2025
efd436c
Fix case where _rootTransform could be undefined
keyboardspecialist May 28, 2025
e702b21
read debug bounding volume property
keyboardspecialist May 28, 2025
c49b0dd
property clean up and function rename
keyboardspecialist May 28, 2025
a7b8039
remove trace logs
keyboardspecialist May 28, 2025
e07b3a4
GS primitive attaches its update to tileset
keyboardspecialist May 29, 2025
6d92c84
clean up
keyboardspecialist May 29, 2025
77e6f97
Fix for spz/draco/bufferViewId check
keyboardspecialist May 29, 2025
60461f1
rename wpos to worldPosition
keyboardspecialist May 29, 2025
258e5ba
property clean up and private functions renamed
keyboardspecialist May 29, 2025
611570e
Fix loader check on update
keyboardspecialist May 29, 2025
3998413
rename gsplatData
keyboardspecialist May 29, 2025
e6f650b
splatPrimitive doc
keyboardspecialist May 29, 2025
56df6f0
No need to access content and _tile for transform
keyboardspecialist May 29, 2025
b83651a
doc error
keyboardspecialist May 29, 2025
88e9864
transformTile is now static and called from content update. event han…
keyboardspecialist May 29, 2025
b1cb709
simplified splat attribute aggregation
keyboardspecialist May 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions Apps/Sandcastle/gallery/3D Tiles Gaussian Splatting SPZ.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the preferred nomenclature? I think I've seen "Gaussian splats"? Whatever it is, we should make sure to use it everywhere, especially in showcases like Sandcastle examples.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on the context. 3D Gaussian splatting and 3D Gaussian splats are both valid. When talking about the technology itself 3D Gaussian splatting is best. When talking about the output at rest, referring to them as 3D Gaussian splats is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not crucial until this is planned to ship to sandcastle.cesium.com, but we should definitely make sure we take a pass on vocab consistency, at least for user-facing things like the Sandcastle title and ref docs.

Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta
name="description"
content="Load 3D Tiles 1.1 Gaussian Splats SPZ dataset of a cell tower"
/>
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
Cesium.Ion.defaultAccessToken =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, we add any Sandcastle assets to the CesiumJS ion account. That way, the default token will work to access them, and there's no need to manually set the token.

Reach out if you need access or any help getting assets uploaded to that ion account.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggetz, is it alright if we hold off until we've settled on exactly what asset we're going to use as the demo asset before uploading to the CesiumJS account? It could be this tower, or it could be something else. Of course, we won't merge to main without having the sandcastle asset in the correct place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To answer your questions:

  1. The model path was the old pathway. We definitely don't want to support both. This code has since been stripped out from this branch. That implementation highlighted the need for our new approach.
  2. This was simply a misunderstanding on my part. Nothing is preventing it. It does rely on Cesium3DTileset events for handling tile loading. It's wrapping the load calls from Cesium3DTileset which it shouldn't do. I do see rectifying this as high priority for this release as we don't want to incur unnecessary tech debt as we continue to add features and any bug fixes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Got it. Thanks for the cleanup!
  2. Cool, that would definitely be the best move from the user's workflow perspective as well. Happy to help talk through how to best handle this if needed. When you say this release, we expect that to be the June 6th-ish timeframe, correct?

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3ZTA3MDg3OC0xMmVjLTRhYmYtOGFjYy1kNTdhZmVkN2Q2NTgiLCJpZCI6MTQwNTg1LCJpYXQiOjE3NDcxNTI0Nzd9.fUjTRAtTYZHuza3V5vAfXr8Y0Ja_zihC9KQtO9szX_8";
const viewer = new Cesium.Viewer("cesiumContainer");
viewer.scene.debugShowFramesPerSecond = true;

const ORBIT_RANGE_FACTOR = 3;
const ORBIT_PITCH_DIVIDEND = 8;

const cellTowerTileset = await Cesium.Cesium3DTileset.fromIonAssetId(3395431, {
maximumScreenSpaceError: 1,
loadGltfWithGaussianSplatContent: true,
});

viewer.scene.primitives.add(cellTowerTileset);
setupCamera();

let startTime;
let isRunning = false;

function setupCamera() {
const boundingSphere = cellTowerTileset.boundingSphere;
const heading = 0;
const range = boundingSphere.radius * ORBIT_RANGE_FACTOR;
const pitch = -Math.PI / ORBIT_PITCH_DIVIDEND;

viewer.camera.lookAt(
boundingSphere.center,
new Cesium.HeadingPitchRange(heading, pitch, range),
);

return true;
}

function startCameraOrbit() {
if (!setupCamera()) {
return;
}
startTime = performance.now();
isRunning = true;
requestAnimationFrame(cameraOrbitTickCallback);
}

function cameraOrbitTickCallback(timestamp) {
if (!isRunning) {
return;
}

const boundingSphere = cellTowerTileset.boundingSphere;
const elapsedSeconds = (timestamp - startTime) / 1000;
const heading = (elapsedSeconds / 15) * Math.PI * 2;

const range = boundingSphere.radius * ORBIT_RANGE_FACTOR;
const pitch = -Math.PI / ORBIT_PITCH_DIVIDEND;

viewer.camera.lookAt(
boundingSphere.center,
new Cesium.HeadingPitchRange(heading, pitch, range),
);

requestAnimationFrame(cameraOrbitTickCallback);
}

Sandcastle.addToolbarButton("Start Orbit", startCameraOrbit);
Sandcastle.addToolbarButton("Stop Orbit", () => {
isRunning = false;
});
//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
}
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions Apps/Sandcastle/gallery/3D Tiles Gaussian Splatting.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta
name="description"
content="Load 3D Tiles 1.1 Gaussian Splats dataset of a cell tower"
/>
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
Cesium.Ion.defaultAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2MWEyNWI4NS02ZWVmLTQyZTEtOTRjZi02NjljOWNhOWViNGEiLCJpZCI6MTQwNTg1LCJpYXQiOjE3MzYzNjg4OTR9.rIAEC387JLBYOPt3w1fliKTWZgTGCQYJlG8o5HJsTwY";
const viewer = new Cesium.Viewer("cesiumContainer");
viewer.scene.debugShowFramesPerSecond = true;

const ORBIT_RANGE_FACTOR = 3;
const ORBIT_PITCH_DIVIDEND = 8;

let cellTowerTileset;
Cesium.Cesium3DTileset.fromIonAssetId(2917325, {
maximumScreenSpaceError: 1,
}).then((tileset) => {
cellTowerTileset = tileset;
viewer.scene.primitives.add(cellTowerTileset);
setupCamera();
});
let startTime;
let isRunning = false;

function setupCamera() {
const boundingSphere = cellTowerTileset.boundingSphere;
const heading = 0;
const range = boundingSphere.radius * ORBIT_RANGE_FACTOR;
const pitch = -Math.PI / ORBIT_PITCH_DIVIDEND;

viewer.camera.lookAt(
boundingSphere.center,
new Cesium.HeadingPitchRange(heading, pitch, range),
);

return true;
}

function startCameraOrbit() {
if (!setupCamera()) {
return;
}
startTime = performance.now();
isRunning = true;
requestAnimationFrame(cameraOrbitTickCallback);
}

function cameraOrbitTickCallback(timestamp) {
if (!isRunning) {
return;
}

const boundingSphere = cellTowerTileset.boundingSphere;
const elapsedSeconds = (timestamp - startTime) / 1000;
const heading = (elapsedSeconds / 15) * Math.PI * 2;

const range = boundingSphere.radius * ORBIT_RANGE_FACTOR;
const pitch = -Math.PI / ORBIT_PITCH_DIVIDEND;

viewer.camera.lookAt(
boundingSphere.center,
new Cesium.HeadingPitchRange(heading, pitch, range),
);

requestAnimationFrame(cameraOrbitTickCallback);
}

Sandcastle.addToolbarButton("Start Orbit", startCameraOrbit);
Sandcastle.addToolbarButton("Stop Orbit", () => {
isRunning = false;
});
//Sandcastle_End
Sandcastle.finishedLoading();
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
}
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Adam Morris](https://github.com/weegeekps)
- [Luke McKinstry](https://github.com/lukemckinstry)
- [Ryan Veenstra](https://github.com/r-veenstra)
- [Jason Sobotka](https://github.com/keyboardspecialist)
- [Northrop Grumman](http://www.northropgrumman.com)
- [Joseph Stein](https://github.com/nahgrin)
- [EOX IT Services GmbH](https://eox.at)
Expand Down
19 changes: 9 additions & 10 deletions Specs/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import assert from "node:assert";
// NodeJS smoke screen test

async function test() {
const provider = await createWorldTerrainAsync();
const results = await sampleTerrain(provider, 11, [
Cartographic.fromDegrees(86.925145, 27.988257),
Cartographic.fromDegrees(87.0, 28.0),
]);
assert(results[0].height > 5000);
assert(results[0].height < 10000);
assert(results[1].height > 5000);
assert(results[1].height < 10000);
const provider = await createWorldTerrainAsync();
const results = await sampleTerrain(provider, 11, [
Cartographic.fromDegrees(86.925145, 27.988257),
Cartographic.fromDegrees(87.0, 28.0),
]);
assert(results[0].height > 5000);
assert(results[0].height < 10000);
assert(results[1].height > 5000);
assert(results[1].height < 10000);
}

test()

6 changes: 5 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,11 @@ export async function prepare() {
"node_modules/draco3d/draco_decoder.wasm",
"packages/engine/Source/ThirdParty/draco_decoder.wasm",
);

// Copy Gaussian Splatting utilities into Source
copyFileSync(
"node_modules/@cesium/wasm-splats/wasm_splats_bg.wasm",
"packages/engine/Source/ThirdParty/wasm_splats_bg.wasm",
);
// Copy pako and zip.js worker files to Source/ThirdParty
copyFileSync(
"node_modules/pako/dist/pako_inflate.min.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/engine/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Specs/SpecList.js
Source/Shaders/**/*.js
Source/ThirdParty/Shaders/**/*.js
Source/ThirdParty/_commonjsHelpers*
Source/ThirdParty/wasm_splats_bg.wasm
Source/ThirdParty/draco_decoder.wasm
Source/ThirdParty/Workers/draco_decoder_nodejs.js
Source/ThirdParty/Workers/pako_inflate.min.js
Source/ThirdParty/Workers/pako_deflate.min.js
Source/ThirdParty/Workers/z-worker-pako.js
Source/ThirdParty/Workers/z-worker-pako.js
43 changes: 43 additions & 0 deletions packages/engine/Source/Core/PixelFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ const PixelFormat = {
*/
RGBA: WebGLConstants.RGBA,

/**
* Integral versions of above types. Required if using integral textures.
*/

RED_INTEGER: WebGLConstants.RED_INTEGER,
RG_INTEGER: WebGLConstants.RG_INTEGER,
RGB_INTEGER: WebGLConstants.RGB_INTEGER,
RGBA_INTEGER: WebGLConstants.RGBA_INTEGER,
Comment on lines +70 to +73
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all need their own JSDoc comments.


/**
* A pixel format containing a luminance (intensity) channel.
*
Expand Down Expand Up @@ -190,14 +199,18 @@ const PixelFormat = {
PixelFormat.componentsLength = function (pixelFormat) {
switch (pixelFormat) {
case PixelFormat.RGB:
case PixelFormat.RGB_INTEGER:
return 3;
case PixelFormat.RGBA:
case PixelFormat.RGBA_INTEGER:
return 4;
case PixelFormat.LUMINANCE_ALPHA:
case PixelFormat.RG:
case PixelFormat.RG_INTEGER:
return 2;
case PixelFormat.ALPHA:
case PixelFormat.RED:
case PixelFormat.RED_INTEGER:
case PixelFormat.LUMINANCE:
return 1;
default:
Expand All @@ -217,6 +230,10 @@ PixelFormat.validate = function (pixelFormat) {
pixelFormat === PixelFormat.RG ||
pixelFormat === PixelFormat.RGB ||
pixelFormat === PixelFormat.RGBA ||
pixelFormat === PixelFormat.RED_INTEGER ||
pixelFormat === PixelFormat.RG_INTEGER ||
pixelFormat === PixelFormat.RGB_INTEGER ||
pixelFormat === PixelFormat.RGBA_INTEGER ||
pixelFormat === PixelFormat.LUMINANCE ||
pixelFormat === PixelFormat.LUMINANCE_ALPHA ||
pixelFormat === PixelFormat.RGB_DXT1 ||
Expand Down Expand Up @@ -499,6 +516,32 @@ PixelFormat.toInternalFormat = function (pixelFormat, pixelDatatype, context) {
}
}

if (pixelDatatype === PixelDatatype.INT) {
switch (pixelFormat) {
case PixelFormat.RGBA_INTEGER:
return WebGLConstants.RGBA32I;
case PixelFormat.RGB_INTEGER:
return WebGLConstants.RGB32I;
case PixelFormat.RG_INTEGER:
return WebGLConstants.RG32I;
case PixelFormat.RED_INTEGER:
return WebGLConstants.R32I;
}
}

if (pixelDatatype === PixelDatatype.UNSIGNED_INT) {
switch (pixelFormat) {
case PixelFormat.RGBA_INTEGER:
return WebGLConstants.RGBA32UI;
case PixelFormat.RGB_INTEGER:
return WebGLConstants.RGB32UI;
case PixelFormat.RG_INTEGER:
return WebGLConstants.RG32UI;
case PixelFormat.RED_INTEGER:
return WebGLConstants.R32UI;
}
}

return pixelFormat;
};

Expand Down
2 changes: 2 additions & 0 deletions packages/engine/Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ function beginDraw(
bindFramebuffer(context, framebuffer);
applyRenderState(context, renderState, passState, false);
shaderProgram._bind();

context._maxFrameTextureUnitIndex = Math.max(
context._maxFrameTextureUnitIndex,
shaderProgram.maximumTextureUnitIndex,
Expand Down Expand Up @@ -1376,6 +1377,7 @@ function continueDraw(context, drawCommand, shaderProgram, uniformMap) {
} else {
count = va.numberOfVertices;
}

if (instanceCount === 0) {
context._gl.drawArrays(primitiveType, offset, count);
} else {
Expand Down
5 changes: 3 additions & 2 deletions packages/engine/Source/Renderer/Pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const Pass = {
OPAQUE: 7,
TRANSLUCENT: 8,
VOXELS: 9,
OVERLAY: 10,
NUMBER_OF_PASSES: 11,
GAUSSIAN_SPLATS: 10,
OVERLAY: 11,
NUMBER_OF_PASSES: 12,
};
export default Object.freeze(Pass);
1 change: 1 addition & 0 deletions packages/engine/Source/Renderer/Texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ function loadBufferSource(texture, source) {
pixelDatatype,
width,
);

gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
Expand Down
Loading