@d5techs/3dgs-lib 1.4.61 → 1.4.63

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
@@ -2265,10 +2265,18 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
2265
2265
 
2266
2266
  // --- sample both (uniform control flow) ---
2267
2267
  let skyColor = textureSample(envTexture, envSampler, skyUv).rgb;
2268
- let groundColor = textureSample(envTexture, envSampler, groundUv).rgb;
2268
+ let hdrGround = textureSample(envTexture, envSampler, groundUv).rgb;
2269
+
2270
+ // Debug checkerboard to verify ground position
2271
+ let cx2 = floor(wx * 2.0);
2272
+ let cz2 = floor(wz * 2.0);
2273
+ let checker = ((cx2 + cz2) % 2.0 + 2.0) % 2.0;
2274
+ let checkerColor = mix(vec3(0.15, 0.15, 0.15), vec3(0.4, 0.4, 0.4), checker);
2275
+ // Mix HDR ground with subtle checker for position reference
2276
+ let groundColor = hdrGround * 0.8 + checkerColor * 0.2;
2269
2277
 
2270
2278
  // Blend: horizon transition + fade at bowl edge
2271
- let horizonBlend = smoothstep(0.0, -0.08, d.y);
2279
+ let horizonBlend = smoothstep(0.0, -0.05, d.y);
2272
2280
  let aboveGround = step(0.01, cy);
2273
2281
  let edgeFade = 1.0 - smoothstep(R * 0.7, R, wDist);
2274
2282
  let finalBlend = horizonBlend * aboveGround * edgeFade;
@@ -2295,7 +2303,7 @@ class SkyboxRenderer {
2295
2303
  __publicField(this, "frameReady", false);
2296
2304
  __publicField(this, "mode", "none");
2297
2305
  /** Ground projection sphere radius (world units). Larger = ground extends further, flatter. */
2298
- __publicField(this, "groundRadius", 100);
2306
+ __publicField(this, "groundRadius", 50);
2299
2307
  this.device = device;
2300
2308
  const depthStencil = {
2301
2309
  format: depthFormat,
@@ -19073,10 +19081,33 @@ class App {
19073
19081
  this.hotspotManager.updateBillboards();
19074
19082
  if ((_a2 = this.skyboxRenderer) == null ? void 0 : _a2.isActive) {
19075
19083
  const cam = this.camera.position;
19084
+ let groundLevel = 0;
19085
+ const gsRendererForGround = this.sceneManager.getGSRenderer();
19086
+ const bbox = (gsRendererForGround == null ? void 0 : gsRendererForGround.getBoundingBox()) ?? null;
19087
+ if (bbox) {
19088
+ const m = gsRendererForGround.getModelMatrix();
19089
+ groundLevel = m[5] * bbox.min[1] + m[13];
19090
+ }
19091
+ if (!this._hdrDebugLogged) {
19092
+ this._hdrDebugLogged = true;
19093
+ console.log(
19094
+ "[HDR Ground Debug]",
19095
+ "hasGsRenderer:",
19096
+ !!gsRendererForGround,
19097
+ "hasBbox:",
19098
+ !!bbox,
19099
+ "bbox:",
19100
+ bbox ? { min: [...bbox.min], max: [...bbox.max], center: [...bbox.center] } : null,
19101
+ "groundLevel:",
19102
+ groundLevel,
19103
+ "cam:",
19104
+ [cam[0].toFixed(2), cam[1].toFixed(2), cam[2].toFixed(2)]
19105
+ );
19106
+ }
19076
19107
  this.skyboxRenderer.prepareFrame(
19077
19108
  this.camera.viewMatrix,
19078
19109
  this.camera.projectionMatrix,
19079
- [cam[0], cam[1], cam[2]]
19110
+ [cam[0], cam[1] - groundLevel, cam[2]]
19080
19111
  );
19081
19112
  }
19082
19113
  const pass = this.renderer.beginFrame();