@d5techs/3dgs-lib 1.4.58 → 1.4.59

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 CHANGED
@@ -2253,9 +2253,10 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
2253
2253
  let hitZ = t * d.z;
2254
2254
  let hitDist = sqrt(hitX * hitX + hitZ * hitZ);
2255
2255
 
2256
- // Reconstruct a sampling direction as if looking from HDR capture
2257
- // height (1.7m) straight down at the hit point → FLAT ground
2258
- let captureH = 1.7;
2256
+ // Re-map to a direction on the HDR sphere from a virtual capture
2257
+ // height above ground. Larger = more ground texture visible,
2258
+ // smaller = more horizon. 15 matches Three.js GroundProjectedEnv default.
2259
+ let captureH = 15.0;
2259
2260
  let groundDir = normalize(vec3(hitX, -captureH, hitZ));
2260
2261
  let groundUv = dirToUv(groundDir);
2261
2262
 
@@ -2291,7 +2292,7 @@ class SkyboxRenderer {
2291
2292
  __publicField(this, "frameReady", false);
2292
2293
  __publicField(this, "mode", "none");
2293
2294
  /** Ground projection sphere radius (world units). Larger = ground extends further, flatter. */
2294
- __publicField(this, "groundRadius", 500);
2295
+ __publicField(this, "groundRadius", 1e3);
2295
2296
  this.device = device;
2296
2297
  const depthStencil = {
2297
2298
  format: depthFormat,
@@ -2410,7 +2411,7 @@ class SkyboxRenderer {
2410
2411
  this.mode = "equirect";
2411
2412
  }
2412
2413
  // ---- common ----
2413
- prepareFrame(viewMatrix, projectionMatrix, cameraPosition, groundY) {
2414
+ prepareFrame(viewMatrix, projectionMatrix, cameraPosition) {
2414
2415
  if (!this.isActive) {
2415
2416
  this.frameReady = false;
2416
2417
  return;
@@ -2428,9 +2429,7 @@ class SkyboxRenderer {
2428
2429
  ud[9] = viewMatrix[9];
2429
2430
  ud[10] = viewMatrix[10];
2430
2431
  ud[11] = 0;
2431
- const camWorldY = cameraPosition ? cameraPosition[1] : 0;
2432
- const gndY = groundY ?? 0;
2433
- ud[12] = camWorldY - gndY;
2432
+ ud[12] = cameraPosition ? cameraPosition[1] : 0;
2434
2433
  ud[13] = this.groundRadius;
2435
2434
  ud[14] = 0;
2436
2435
  ud[15] = 0;
@@ -19071,20 +19070,10 @@ class App {
19071
19070
  this.hotspotManager.updateBillboards();
19072
19071
  if ((_a2 = this.skyboxRenderer) == null ? void 0 : _a2.isActive) {
19073
19072
  const cam = this.camera.position;
19074
- let groundY = 0;
19075
- const gsRenderer2 = this.sceneManager.getGSRenderer();
19076
- if (gsRenderer2) {
19077
- const bbox = gsRenderer2.getBoundingBox();
19078
- if (bbox) {
19079
- const m = gsRenderer2.getModelMatrix();
19080
- groundY = m[5] * bbox.min[1] + m[13];
19081
- }
19082
- }
19083
19073
  this.skyboxRenderer.prepareFrame(
19084
19074
  this.camera.viewMatrix,
19085
19075
  this.camera.projectionMatrix,
19086
- [cam[0], cam[1], cam[2]],
19087
- groundY
19076
+ [cam[0], cam[1], cam[2]]
19088
19077
  );
19089
19078
  }
19090
19079
  const pass = this.renderer.beginFrame();