@d5techs/3dgs-lib 1.4.63 → 1.4.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3dgs-lib.cjs +6 -15
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +6 -15
- package/dist/3dgs-lib.js.map +1 -1
- package/package.json +1 -1
package/dist/3dgs-lib.js
CHANGED
|
@@ -2241,37 +2241,28 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
|
|
|
2241
2241
|
let cz = u.cam.z;
|
|
2242
2242
|
let R = u.cam.w;
|
|
2243
2243
|
|
|
2244
|
-
// --- sky
|
|
2245
|
-
let
|
|
2244
|
+
// --- sky: clamp to upper hemisphere so HDR's own ground doesn't show ---
|
|
2245
|
+
let skyDir = normalize(vec3(d.x, max(d.y, 0.001), d.z));
|
|
2246
|
+
let skyUv = dirToUv(skyDir);
|
|
2246
2247
|
|
|
2247
|
-
// --- ground: ray from camera hits
|
|
2248
|
+
// --- ground: ray from camera hits ground plane ---
|
|
2248
2249
|
let dyClamped = min(d.y, -0.0001);
|
|
2249
2250
|
let t = -cy / dyClamped;
|
|
2250
|
-
// Hit point in WORLD space (not camera-relative)
|
|
2251
2251
|
let wx = cx + t * d.x;
|
|
2252
2252
|
let wz = cz + t * d.z;
|
|
2253
2253
|
let wDist = sqrt(wx * wx + wz * wz);
|
|
2254
2254
|
|
|
2255
|
-
//
|
|
2255
|
+
// Bowl projection centered at world origin
|
|
2256
2256
|
let s = min(1.0, R * 0.999 / max(wDist, 0.001));
|
|
2257
2257
|
let bx = wx * s;
|
|
2258
2258
|
let bz = wz * s;
|
|
2259
|
-
// Inverted bowl: y = -sqrt(R² - x² - z²)
|
|
2260
2259
|
let bowlY = -sqrt(max(R * R - bx * bx - bz * bz, 0.0));
|
|
2261
2260
|
let groundDir = normalize(vec3(bx, bowlY, bz));
|
|
2262
2261
|
let groundUv = dirToUv(groundDir);
|
|
2263
2262
|
|
|
2264
2263
|
// --- sample both (uniform control flow) ---
|
|
2265
2264
|
let skyColor = textureSample(envTexture, envSampler, skyUv).rgb;
|
|
2266
|
-
let
|
|
2267
|
-
|
|
2268
|
-
// Debug checkerboard to verify ground position
|
|
2269
|
-
let cx2 = floor(wx * 2.0);
|
|
2270
|
-
let cz2 = floor(wz * 2.0);
|
|
2271
|
-
let checker = ((cx2 + cz2) % 2.0 + 2.0) % 2.0;
|
|
2272
|
-
let checkerColor = mix(vec3(0.15, 0.15, 0.15), vec3(0.4, 0.4, 0.4), checker);
|
|
2273
|
-
// Mix HDR ground with subtle checker for position reference
|
|
2274
|
-
let groundColor = hdrGround * 0.8 + checkerColor * 0.2;
|
|
2265
|
+
let groundColor = textureSample(envTexture, envSampler, groundUv).rgb;
|
|
2275
2266
|
|
|
2276
2267
|
// Blend: horizon transition + fade at bowl edge
|
|
2277
2268
|
let horizonBlend = smoothstep(0.0, -0.05, d.y);
|