Skip to content

Commit

Permalink
Merge pull request #173 from mkkellogg/dev
Browse files Browse the repository at this point in the history
Release v0.3.6
  • Loading branch information
mkkellogg authored Mar 25, 2024
2 parents bdf7b1c + c455784 commit 13d4407
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 55 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ const viewer = new GaussianSplats3D.Viewer({
'dynamicScene': false,
'webXRMode': GaussianSplats3D.WebXRMode.None,
'renderMode': GaussianSplats3D.RenderMode.OnChange,
'sceneRevealMode': GaussianSplats3D.SceneRevealMode.Instant
'sceneRevealMode': GaussianSplats3D.SceneRevealMode.Instant,
`antialiased`: false,
`focalAdjustment`: 1.0
});
viewer.addSplatScene('<path to .ply, .ksplat, or .splat file>')
.then(() => {
Expand All @@ -286,13 +288,15 @@ Advanced `Viewer` parameters
| `camera` | Pass an instance of a Three.js `Camera` to the viewer, otherwise it will create its own. Defaults to `undefined`.
| `ignoreDevicePixelRatio` | Tells the viewer to pretend the device pixel ratio is 1, which can boost performance on devices where it is larger, at a small cost to visual quality. Defaults to `false`.
| `gpuAcceleratedSort` | Tells the viewer to use a partially GPU-accelerated approach to sorting splats. Currently this means pre-computation of splat distances from the camera is performed on the GPU. It is recommended that this only be set to `true` when `sharedMemoryForWorkers` is also `true`. Defaults to `false` on mobile devices, `true` otherwise.
| `halfPrecisionCovariancesOnGPU` | Tells the viewer to use 16-bit floating point values when storing splat covariance data in textures, instead of 32-bit. Defaults to `true`.
| `halfPrecisionCovariancesOnGPU` | Tells the viewer to use 16-bit floating point values when storing splat covariance data in textures, instead of 32-bit. Defaults to `false`.
| `sharedMemoryForWorkers` | Tells the viewer to use shared memory via a `SharedArrayBuffer` to transfer data to and from the sorting web worker. If set to `false`, it is recommended that `gpuAcceleratedSort` be set to `false` as well. Defaults to `true`.
| `integerBasedSort` | Tells the sorting web worker to use the integer versions of relevant data to compute the distance of splats from the camera. Since integer arithmetic is faster than floating point, this reduces sort time. However it can result in integer overflows in larger scenes so it should only be used for small scenes. Defaults to `true`.
| `dynamicScene` | Tells the viewer to not make any optimizations that depend on the scene being static. Additionally all splat data retrieved from the viewer's splat mesh will not have their respective scene transform applied to them by default.
| `webXRMode` | Tells the viewer whether or not to enable built-in Web VR or Web AR. Valid values are defined in the `WebXRMode` enum: `None`, `VR`, and `AR`. Defaults to `None`.
| `renderMode` | Controls when the viewer renders the scene. Valid values are defined in the `RenderMode` enum: `Always`, `OnChange`, and `Never`. Defaults to `Always`.
| `sceneRevealMode` | Controls the fade-in effect used when the scene is loaded. Valid values are defined in the `SceneRevealMode` enum: `Default`, `Gradual`, and `Instant`. `Default` results in a nice, slow fade-in effect for progressively loaded scenes, and a fast fade-in for non progressively loaded scenes. `Gradual` will force a slow fade-in for all scenes. `Instant` will force all loaded scene data to be immediately visible.
| `antialiased` | When true, will perform additional steps during rendering to address artifacts caused by the rendering of gaussians at substantially different resolutions than that at which they were rendered during training. This will only work correctly for models that were trained using a process that utilizes this compensation calculation. For more details: https://github.com/nerfstudio-project/gsplat/pull/117, https://github.com/graphdeco-inria/gaussian-splatting/issues/294#issuecomment-1772688093
| `focalAdjustment` | Hacky, non-scientific parameter for tweaking focal length related calculations. For scenes with very small gaussians & small details, increasing this value can help improve visual quality. Default value is 1.0.
<br>

### Creating KSPLAT files
Expand Down
26 changes: 21 additions & 5 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
let currentCameraUpArray;
let currentCameraPositionArray;
let currentCameraLookAtArray;
let currentAntialiased;
</script>
<script type="module">
import * as GaussianSplats3D from 'gaussian-splats-3d';
Expand Down Expand Up @@ -425,6 +426,7 @@
let cameraUpArray = document.getElementById("cameraUp").value;
let cameraPositionArray = document.getElementById("cameraPosition").value;
let cameraLookAtArray = document.getElementById("cameraLookAt").value;
let antialiased = document.getElementById("antialiased").checked;

cameraUpArray = cameraUpArray.split(',');
cameraPositionArray = cameraPositionArray.split(',');
Expand Down Expand Up @@ -481,11 +483,13 @@
currentCameraUpArray = cameraUpArray;
currentCameraPositionArray = cameraPositionArray;
currentCameraLookAtArray = cameraLookAtArray;
currentAntialiased = antialiased;

try {
const fileReader = new FileReader();
fileReader.onload = function(){
try {
runViewer(fileReader.result, format, alphaRemovalThreshold, cameraUpArray, cameraPositionArray, cameraLookAtArray);
runViewer(fileReader.result, format, alphaRemovalThreshold, cameraUpArray, cameraPositionArray, cameraLookAtArray, antialiased);
} catch (e) {
console.error(e);
setViewError("Could not view scene.");
Expand Down Expand Up @@ -517,18 +521,19 @@

window.addEventListener("popstate", (event) => {
if (currentAlphaRemovalThreshold !== undefined) {
window.location = 'index.html?art=' + currentAlphaRemovalThreshold + '&cu=' + currentCameraUpArray + "&cp=" + currentCameraPositionArray + "&cla=" + currentCameraLookAtArray;
window.location = 'index.html?art=' + currentAlphaRemovalThreshold + '&cu=' + currentCameraUpArray + "&cp=" + currentCameraPositionArray + "&cla=" + currentCameraLookAtArray + "&aa=" + currentAntialiased;
} else {
window.location = 'index.html';
}
});

function runViewer(splatBufferData, format, alphaRemovalThreshold, cameraUpArray, cameraPositionArray, cameraLookAtArray) {
function runViewer(splatBufferData, format, alphaRemovalThreshold, cameraUpArray, cameraPositionArray, cameraLookAtArray, antialiased) {
const viewerOptions = {
'cameraUp': cameraUpArray,
'initialCameraPosition': cameraPositionArray,
'initialCameraLookAt': cameraLookAtArray,
'halfPrecisionCovariancesOnGPU': true,
'halfPrecisionCovariancesOnGPU': false,
'antialiased': antialiased || false
};
const splatBufferOptions = {
'splatAlphaRemovalThreshold': alphaRemovalThreshold
Expand Down Expand Up @@ -612,7 +617,7 @@
<br>
<div class="header-content-container">
<div class="content-row">
<div id ="view-panel" class="splat-panel" style="height:310px;">
<div id ="view-panel" class="splat-panel" style="height:330px;">
<br>
<div class="small-title">View a <span class="file-ext">.ply</span>, <span class="file-ext">.ksplat</span>, or <span class="file-ext-small">.splat</span> file</div>
<br>
Expand All @@ -637,6 +642,14 @@
<span class="valid-value-label">(1 - 255)</span>
</td>
</tr>
<tr>
<td>
Anti-aliased
</td>
<td style="text-align:lefts;">
<input type="checkbox" id="antialiased" class="checkbox-input"/>
</td>
</tr>
<tr>
<td>
Camera up:&nbsp;
Expand Down Expand Up @@ -845,6 +858,9 @@
} else if (varName == "cla") {
currentCameraLookAtArray = component[1];
document.getElementById('cameraLookAt').value = currentCameraLookAtArray;
} else if (varName == "aa") {
currentAntialiased = component[1];
document.getElementById('antialiased').checked = currentAntialiased;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "https://github.com/mkkellogg/GaussianSplats3D"
},
"version": "0.3.5",
"version": "0.3.6",
"description": "Three.js-based 3D Gaussian splat viewer",
"module": "build/gaussian-splats-3d.module.js",
"main": "build/gaussian-splats-3d.umd.cjs",
Expand Down
Loading

0 comments on commit 13d4407

Please sign in to comment.