Skip to content

Commit

Permalink
Add pixelRatio and xrPixelRatio parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
quadjr committed Oct 20, 2023
1 parent 6778176 commit fe131e6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Needs few seconds to load splats.
| -------- | ----------- | ------------- |
| src | url of splat or ply file | train.splat |
| cutoutEntity | selector to a box primitive that uses scale and position to define the bounds of splat points to render | |
| pixelRatio | Pixel ratio for rendering. Reducing the value decreases the resolution and improves performance. If a negative value is set, the device's native value will be applied. | 1.0 |
| xrPixelRatio | Same as pixelRatio. Applied to XR devices. | 0.5 |

### Example custom scan to gaussian splat workflow
* Use a service such as https://lumalabs.ai/ to process a scan into splat (an alternative is https://poly.cam/)
Expand Down
4 changes: 2 additions & 2 deletions dist/aframe-gaussian-splatting-component.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/aframe-gaussian-splatting-component.min.js.map

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
AFRAME.registerComponent("gaussian_splatting", {
schema: {
src: {type: 'string', default: "train.splat"},
cutoutEntity: {type: 'selector'}
cutoutEntity: {type: 'selector'},
pixelRatio: {type: 'number', default: 1},
xrPixelRatio: {type: 'number', default: 0.5}
},
init: function () {
// aframe-specific data
this.el.sceneEl.renderer.setPixelRatio(1);
this.el.sceneEl.renderer.xr.setFramebufferScaleFactor(0.5);
if(this.data.pixelRatio > 0){
this.el.sceneEl.renderer.setPixelRatio(this.data.pixelRatio);
}
if(this.data.xrPixelRatio > 0){
this.el.sceneEl.renderer.xr.setFramebufferScaleFactor(this.data.xrPixelRatio);
}
this.loadData(this.el.sceneEl.camera.el.components.camera.camera, this.el.object3D, this.el.sceneEl.renderer, this.data.src);
if (!!this.data.cutoutEntity) {
this.cutout = this.data.cutoutEntity.object3D;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aframe-gaussian-splatting-component",
"version": "0.0.21",
"version": "0.0.22",
"description": "This component is an A-Frame implementation of real-time rendering for '3D Gaussian Splatting for Real-Time Radiance Field Rendering'",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit fe131e6

Please sign in to comment.