-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Splat shader #12364
base: main
Are you sure you want to change the base?
Splat shader #12364
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
3983d5a
c0ff137
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/node_modules | ||
/ThirdParty | ||
/Tools/** | ||
temp_wasm/* | ||
|
||
LICENSE.md |
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(); | ||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||
Comment on lines
+39
to
+45
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. Going forward, we prefer async/await syntax over promise chains:
Suggested change
To make eslint happy, you may also need to move the call to |
||||||||||||||||||||||||||
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()) { | ||||||||||||||||||||||||||
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. When would this return false? |
||||||||||||||||||||||||||
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> |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"asset": { | ||
"extras": { | ||
"ion": { | ||
"georeferenced": false, | ||
"movable": true | ||
} | ||
}, | ||
"version": "1.1" | ||
}, | ||
"geometricError": 1.686462689047787, | ||
"root": { | ||
"boundingVolume": { | ||
"box": [ | ||
0.13612890243530273, | ||
0.3700018525123596, | ||
0.0054874420166015625, | ||
0.48683984375, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.48683984375, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.48683984375 | ||
] | ||
}, | ||
"content": { | ||
"uri": "0/0.gltf" | ||
}, | ||
"geometricError": 0.0, | ||
"refine": "REPLACE" | ||
} | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"asset": { | ||
"extras": { | ||
"ion": { | ||
"georeferenced": false, | ||
"movable": true | ||
} | ||
}, | ||
"version": "1.1" | ||
}, | ||
"geometricError": 1.686462689047787, | ||
"root": { | ||
"boundingVolume": { | ||
"box": [ | ||
0.13612890243530273, | ||
0.3700018525123596, | ||
0.0054874420166015625, | ||
0.48683984375, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.48683984375, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.48683984375 | ||
] | ||
}, | ||
"content": { | ||
"uri": "0/0.gltf" | ||
}, | ||
"geometricError": 0.0, | ||
"refine": "REPLACE" | ||
} | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"asset": { | ||
"extras": { | ||
"ion": { | ||
"georeferenced": false, | ||
"movable": true | ||
} | ||
}, | ||
"version": "1.1" | ||
}, | ||
"geometricError": 1.686462689047787, | ||
"root": { | ||
"boundingVolume": { | ||
"box": [ | ||
0.13612890243530273, | ||
0.3700018525123596, | ||
0.0054874420166015625, | ||
0.48683984375, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.48683984375, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.48683984375 | ||
] | ||
}, | ||
"content": { | ||
"uri": "0/0.gltf" | ||
}, | ||
"geometricError": 0.0, | ||
"refine": "REPLACE" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"extensionsUsed": ["KHR_materials_unlit", "KHR_gaussian_splatting"], | ||
"accessors": [{ | ||
"bufferView": 0, | ||
"componentType": 5126, | ||
"count": 5, | ||
"type": "VEC4" | ||
}, { | ||
"bufferView": 1, | ||
"componentType": 5126, | ||
"count": 5, | ||
"type": "VEC3" | ||
}, { | ||
"bufferView": 2, | ||
"componentType": 5126, | ||
"count": 5, | ||
"type": "VEC3", | ||
"max": [2.0, 2.0, 2.0], | ||
"min": [-2.0, -2.0, -2.0] | ||
}, { | ||
"bufferView": 3, | ||
"componentType": 5121, | ||
"normalized": true, | ||
"count": 5, | ||
"type": "VEC4" | ||
}], | ||
"asset": { | ||
"version": "2.0" | ||
}, | ||
"buffers": [{ | ||
"uri": "data:application/octet-stream;base64,AAAAwAAAAMAAAADAAACAvwAAgL8AAIC/AAAApgAAgCYAAACnAACAPwAAgD8AAIA/AAAAQAAAAEAAAABAf8f/jIbO/5iN1f+kld3/r5zk/7pU+C1AVPgtQFT4LUBCREBAQkRAQEJEQEDMfFRAzHxUQMx8VEDB1WpAwdVqQMHVakAzxIFAM8SBQDPEgUAAAAAAAAAAAAAAAAAAAIA/E9C/PRPQPz4O3I8+F8RvP6P4Iz6j+KM+9PT1Psv2TD+uWEw+rljMPoJCGT/mSSo/OI5jPjiO4z6qqio/4zgOPw==", | ||
"byteLength": 220 | ||
}], | ||
"bufferViews": [{ | ||
"buffer": 0, | ||
"byteOffset": 140, | ||
"byteLength": 80 | ||
}, { | ||
"buffer": 0, | ||
"byteOffset": 80, | ||
"byteLength": 60 | ||
}, { | ||
"buffer": 0, | ||
"byteLength": 60 | ||
}, { | ||
"buffer": 0, | ||
"byteOffset": 60, | ||
"byteLength": 20 | ||
}], | ||
"materials": [{ | ||
"extensions": { | ||
"KHR_materials_unlit": {} | ||
} | ||
}], | ||
"meshes": [{ | ||
"primitives": [{ | ||
"attributes": { | ||
"COLOR_0": 3, | ||
"POSITION": 2, | ||
"_SCALE": 1, | ||
"_ROTATION": 0 | ||
}, | ||
"material": 0, | ||
"mode": 0, | ||
"extensions": { | ||
"KHR_gaussian_splatting": {} | ||
} | ||
}] | ||
}], | ||
"nodes": [{ | ||
"matrix": [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 2.0000000000000004, 12.000000000000002, -6.999999999999999, 1.0], | ||
"mesh": 0 | ||
}], | ||
"scene": 0, | ||
"scenes": [{ | ||
"nodes": [0] | ||
}] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"asset": { | ||
"extras": { | ||
"ion": { | ||
"georeferenced": false, | ||
"movable": true | ||
} | ||
}, | ||
"version": "1.1" | ||
}, | ||
"geometricError": 6.931667678300809, | ||
"root": { | ||
"boundingVolume": { | ||
"box": [ | ||
2.0, | ||
6.999999999999999, | ||
12.000000000000002, | ||
2.0010001, | ||
0.0, | ||
0.0, | ||
0.0, | ||
2.0010000999999997, | ||
0.0, | ||
0.0, | ||
0.0, | ||
2.0010001000000006 | ||
] | ||
}, | ||
"content": { | ||
"uri": "0/0.gltf" | ||
}, | ||
"geometricError": 0.0, | ||
"refine": "REPLACE" | ||
} | ||
} |
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.
Why is
maximumScreenSpaceError: 1
needed? Does that indicate a need for us to change something in the source code to minimize any configuration for the end user?