@d5techs/3dgs-lib 1.4.64 → 1.4.65

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
@@ -2243,9 +2243,8 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
2243
2243
  let cz = u.cam.z;
2244
2244
  let R = u.cam.w;
2245
2245
 
2246
- // --- sky: clamp to upper hemisphere so HDR's own ground doesn't show ---
2247
- let skyDir = normalize(vec3(d.x, max(d.y, 0.001), d.z));
2248
- let skyUv = dirToUv(skyDir);
2246
+ // --- sky: sample HDR with original direction ---
2247
+ let skyUv = dirToUv(d);
2249
2248
 
2250
2249
  // --- ground: ray from camera hits ground plane ---
2251
2250
  let dyClamped = min(d.y, -0.0001);
@@ -2266,10 +2265,10 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
2266
2265
  let skyColor = textureSample(envTexture, envSampler, skyUv).rgb;
2267
2266
  let groundColor = textureSample(envTexture, envSampler, groundUv).rgb;
2268
2267
 
2269
- // Blend: horizon transition + fade at bowl edge
2270
- let horizonBlend = smoothstep(0.0, -0.05, d.y);
2268
+ // Sharp blend right at the horizon (d.y = 0)
2269
+ let horizonBlend = smoothstep(0.002, -0.002, d.y);
2271
2270
  let aboveGround = step(0.01, cy);
2272
- let edgeFade = 1.0 - smoothstep(R * 0.7, R, wDist);
2271
+ let edgeFade = 1.0 - smoothstep(R * 0.85, R, wDist);
2273
2272
  let finalBlend = horizonBlend * aboveGround * edgeFade;
2274
2273
  let c = mix(skyColor, groundColor, finalBlend);
2275
2274
 
@@ -19095,10 +19094,12 @@ class App {
19095
19094
  [cam[0].toFixed(2), cam[1].toFixed(2), cam[2].toFixed(2)]
19096
19095
  );
19097
19096
  }
19097
+ const camH = cam[1] - groundLevel;
19098
+ this.skyboxRenderer.groundRadius = Math.max(200, camH * 3);
19098
19099
  this.skyboxRenderer.prepareFrame(
19099
19100
  this.camera.viewMatrix,
19100
19101
  this.camera.projectionMatrix,
19101
- [cam[0], cam[1] - groundLevel, cam[2]]
19102
+ [cam[0], camH, cam[2]]
19102
19103
  );
19103
19104
  }
19104
19105
  const pass = this.renderer.beginFrame();