-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
base: main
Are you sure you want to change the base?
Gaussian Splat SPZ Support #12582
Changes from all commits
0103673
ea53962
60022f4
ba77e31
8d67853
9aaf292
8c3aea4
7a3f472
4f9c886
b235c09
df28196
bdf4eb5
7a4c864
c6b8d25
a03abdd
7d5b09a
0620dca
fe340a4
e352ca2
3e74c74
d5f4069
13dfa78
31e8d13
947d9e0
9862eeb
0069114
427d490
fcfc3df
f4657c6
2270dae
fb180f6
43c08cf
2b1e72a
52b3d61
f207786
18d75d2
ddceea8
d2441cf
3c7bae6
6061b17
b2f5aa2
361312b
1991389
baf322d
bf4ab9d
de96ac6
276a410
fb0559b
6874e72
2ed9de4
62116b5
f0237a7
c858f03
7142df3
eb1db94
811338a
ce0976f
635659e
edca8a8
a327c88
b0bde10
ef2ec34
e749c92
afcc22a
78ea71a
36fd99e
0fa8fe4
703da40
ede218f
40c5271
95fa1ff
fbf6e82
b6af598
1c52cd0
0bb27f2
84d1890
3e0e4cc
76364db
dbf21c2
76ea60a
f98cbbf
be481c3
8183132
933c3e3
6d2b048
e9b04ba
7512ef4
d684417
a2cefeb
e4cb8e3
ecd40fa
a023aa2
f38154b
6aa9471
2ee0a7a
b6843bb
c207cd5
eaabc5a
3982c9d
76c4e7d
8b99a80
3983d5a
c0ff137
b6636d6
96087c9
74e9ee5
18ac557
b51755a
9629ded
7fa692a
3b4fdd1
7534e12
68b4139
b07fa62
0083ab5
7b9271f
a1fba0a
7d2cd53
ca7b4ce
b6ad285
1e531a1
6fde4e4
8db037f
e29eb34
4189e4d
cb429c2
3944f4c
517d508
7668456
1e3a516
d430522
57d6f04
8bc47b0
13d901b
34dc9a1
a12d583
f619ad3
1e30d3f
4fa3f32
f756f27
bc52b56
d76e141
2212686
a9b34ee
e4e7c78
fee59e8
cf8ad41
b907696
b37d7a2
0732535
e4e4812
8be8ef0
eaf1f0e
f8972fb
b80fa36
f9531c8
304c99d
1aff10a
2c8c004
914fa68
41c8fee
bbc553c
f434dd7
b091fdf
f9fe6cc
b426cc4
488651c
7fc29f5
b5622e0
85a920e
ca6565d
f55ac05
8f6cfdd
0f416f2
292309a
e6e2cd3
881bf70
8c6cb76
5116b84
5bc2a79
104ad85
0359cc0
c496440
907c31e
0dace8c
efd436c
e702b21
c49b0dd
a7b8039
e07b3a4
6d92c84
77e6f97
60461f1
258e5ba
611570e
3998413
e6f650b
56df6f0
b83651a
88e9864
b1cb709
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typically, we add any Sandcastle assets to the Reach out if you need access or any help getting assets uploaded to that ion account. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To answer your questions:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"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> |
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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
* | ||
|
@@ -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: | ||
|
@@ -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 || | ||
|
@@ -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; | ||
}; | ||
|
||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.