From 7a4142c62ad008d4f952f669e65b3dd82687ec21 Mon Sep 17 00:00:00 2001 From: Andreas Sundquist Date: Fri, 6 Jun 2025 12:53:19 -0700 Subject: [PATCH] Lower MIN_ALPHA from 0.01 to 0.5/255, the lowest conceivable value that could be encoded in a Uint8, allowing highly transparent objects to render better. (#37) Add "sortRadial" option to Editor to allow toggling between radial and Z-depth sorting. --- examples/editor/index.html | 3 ++- src/shaders/splatDefines.glsl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/editor/index.html b/examples/editor/index.html index e41c41d..304973c 100644 --- a/examples/editor/index.html +++ b/examples/editor/index.html @@ -72,7 +72,7 @@ import { getAssetFileURL } from "/examples/js/get-asset-url.js"; const scene = new THREE.Scene(); - const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); + const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.01, 1000); camera.position.set(0, 0, 1); const canvas = document.getElementById("canvas"); @@ -463,6 +463,7 @@ gui.add(guiOptions, "stats").name("Show frame stats").onChange((value) => { stats.dom.style.display = value ? "block" : "none"; }); + gui.add(forge.defaultView, "sortRadial").name("Radial sort").listen(); gui.add(grid, "opacity", 0, 1, 0.01).name("Grid opacity").listen(); const normalColor = dyno.dynoBool(false); diff --git a/src/shaders/splatDefines.glsl b/src/shaders/splatDefines.glsl index 035993a..b56f6a4 100644 --- a/src/shaders/splatDefines.glsl +++ b/src/shaders/splatDefines.glsl @@ -22,7 +22,7 @@ const float INFINITY = 1.0 / 0.0; const float NEG_INFINITY = -INFINITY; const float MAX_PIXEL_RADIUS = 512.0; -const float MIN_ALPHA = 0.01; +const float MIN_ALPHA = 0.5 * (1.0 / 255.0); // 0.00196 const float MAX_STDDEV = sqrt(8.0); float sqr(float x) {