mirror of
https://github.com/storytold/spark.git
synced 2026-10-17 00:12:59 +00:00
Expand internal splat scale encoding to e^[-12,9]. Lower zero cut-off to e^-30. Fix background color selection in editor. (#110)
This commit is contained in:
committed by
GitHub
parent
c8394665ec
commit
dc07e02a33
+13
-12
@@ -6,6 +6,7 @@ import * as THREE from "three";
|
||||
import {
|
||||
LN_RESCALE,
|
||||
LN_SCALE_MIN,
|
||||
SCALE_ZERO,
|
||||
SPLAT_TEX_HEIGHT,
|
||||
SPLAT_TEX_MIN_HEIGHT,
|
||||
SPLAT_TEX_WIDTH,
|
||||
@@ -370,32 +371,32 @@ export function setPackedSplat(
|
||||
|
||||
// Allow scales below LN_SCALE_MIN to be encoded as 0, which signifies a 2DGS
|
||||
const uScaleX =
|
||||
scaleX === 0.0
|
||||
scaleX < SCALE_ZERO
|
||||
? 0
|
||||
: Math.min(
|
||||
255,
|
||||
Math.max(
|
||||
0,
|
||||
1,
|
||||
Math.round((Math.log(scaleX) - LN_SCALE_MIN) / LN_RESCALE) + 1,
|
||||
),
|
||||
);
|
||||
const uScaleY =
|
||||
scaleY === 0.0
|
||||
scaleY < SCALE_ZERO
|
||||
? 0
|
||||
: Math.min(
|
||||
255,
|
||||
Math.max(
|
||||
0,
|
||||
1,
|
||||
Math.round((Math.log(scaleY) - LN_SCALE_MIN) / LN_RESCALE) + 1,
|
||||
),
|
||||
);
|
||||
const uScaleZ =
|
||||
scaleZ === 0.0
|
||||
scaleZ < SCALE_ZERO
|
||||
? 0
|
||||
: Math.min(
|
||||
255,
|
||||
Math.max(
|
||||
0,
|
||||
1,
|
||||
Math.round((Math.log(scaleZ) - LN_SCALE_MIN) / LN_RESCALE) + 1,
|
||||
),
|
||||
);
|
||||
@@ -441,32 +442,32 @@ export function setPackedSplatScales(
|
||||
) {
|
||||
// Allow scales below LN_SCALE_MIN to be encoded as 0, which signifies a 2DGS
|
||||
const uScaleX =
|
||||
scaleX === 0.0
|
||||
scaleX < SCALE_ZERO
|
||||
? 0
|
||||
: Math.min(
|
||||
255,
|
||||
Math.max(
|
||||
0,
|
||||
1,
|
||||
Math.round((Math.log(scaleX) - LN_SCALE_MIN) / LN_RESCALE) + 1,
|
||||
),
|
||||
);
|
||||
const uScaleY =
|
||||
scaleY === 0.0
|
||||
scaleY < SCALE_ZERO
|
||||
? 0
|
||||
: Math.min(
|
||||
255,
|
||||
Math.max(
|
||||
0,
|
||||
1,
|
||||
Math.round((Math.log(scaleY) - LN_SCALE_MIN) / LN_RESCALE) + 1,
|
||||
),
|
||||
);
|
||||
const uScaleZ =
|
||||
scaleZ === 0.0
|
||||
scaleZ < SCALE_ZERO
|
||||
? 0
|
||||
: Math.min(
|
||||
255,
|
||||
Math.max(
|
||||
0,
|
||||
1,
|
||||
Math.round((Math.log(scaleZ) - LN_SCALE_MIN) / LN_RESCALE) + 1,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user