Skip to content

Commit

Permalink
Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Oct 7, 2023
1 parent 29d7db2 commit 81faa31
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/21_gaussian_splats.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main(splat_path: Path) -> None:
"nij,njk,nlk->nil", Rs, onp.eye(3)[None, :, :] * scales[:, None, :] ** 2, Rs
)

server = viser.ViserServer()
server = viser.ViserServer(share=True)
server.configure_theme(dark_mode=True)
gui_reset_up = server.add_gui_button(
"Reset up direction",
Expand Down
1 change: 1 addition & 0 deletions src/viser/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@react-three/postprocessing": "^2.14.7",
"@reduxjs/toolkit": "^1.9.3",
"@tabler/icons-react": "^2.22.0",
"@types/emscripten": "^1.39.8",
"@types/node": "^18.15.11",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
Expand Down
11 changes: 9 additions & 2 deletions src/viser/client/src/splatting/SplatSortWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ export type GaussianBuffersSplitCov = {
let depthList = new Int32Array();
let sortedIndices: number[] = [];

// Counting sort buffers.
const counts0 = new Uint32Array(256 * 256);
const starts0 = new Uint32Array(256 * 256);

const runSort = (viewProj: number[] | null) => {
if (buffers === null || sortedBuffers === null || viewProj === null) return;

console.time("Start");
const numGaussians = buffers.centers.length / 3;

// Create new buffers.
Expand All @@ -53,14 +58,15 @@ export type GaussianBuffersSplitCov = {

// This is a 16 bit single-pass counting sort.
const depthInv = (256 * 256) / (maxDepth - minDepth);
const counts0 = new Uint32Array(256 * 256);
counts0.fill(0);
for (let i = 0; i < numGaussians; i++) {
depthList[i] = ((depthList[i] - minDepth) * depthInv) | 0;
counts0[depthList[i]]++;
}
const starts0 = new Uint32Array(256 * 256);
for (let i = 1; i < 256 * 256; i++)
starts0[i] = starts0[i - 1] + counts0[i - 1];
console.timeEnd("Start");
console.time("Fill");
for (let i = 0; i < numGaussians; i++)
sortedIndices[starts0[depthList[i]]++] = i;

Expand All @@ -85,6 +91,7 @@ export type GaussianBuffersSplitCov = {
sortedBuffers.covB[i * 3 + 1] = buffers.covB[j * 3 + 1];
sortedBuffers.covB[i * 3 + 2] = buffers.covB[j * 3 + 2];
}
console.timeEnd("Fill");
self.postMessage(sortedBuffers);
};

Expand Down
5 changes: 5 additions & 0 deletions src/viser/client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,11 @@
resolved "https://registry.yarnpkg.com/@types/draco3d/-/draco3d-1.4.2.tgz#7faccb809db2a5e19b9efb97c5f2eb9d64d527ea"
integrity sha512-goh23EGr6CLV6aKPwN1p8kBD/7tT5V/bLpToSbarKrwVejqNrspVrv8DhliteYkkhZYrlq/fwKZRRUzH4XN88w==

"@types/emscripten@^1.39.8":
version "1.39.8"
resolved "https://registry.yarnpkg.com/@types/emscripten/-/emscripten-1.39.8.tgz#5e3e81fb37397345cc7c12d189bd72c7d0095af8"
integrity sha512-Rk0HKcMXFUuqT32k1kXHZWgxiMvsyYsmlnjp0rLKa0MMoqXLE3T9dogDBTRfuc3SAsXu97KD3k4SKR1lHqd57w==

"@types/eslint@^8.4.5":
version "8.44.2"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.2.tgz#0d21c505f98a89b8dd4d37fa162b09da6089199a"
Expand Down

0 comments on commit 81faa31

Please sign in to comment.