@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 +8 -7
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +8 -7
- package/dist/3dgs-lib.js.map +1 -1
- package/package.json +1 -1
package/dist/3dgs-lib.js
CHANGED
|
@@ -2241,9 +2241,8 @@ 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
|
|
2246
|
-
let skyUv = dirToUv(skyDir);
|
|
2244
|
+
// --- sky: sample HDR with original direction ---
|
|
2245
|
+
let skyUv = dirToUv(d);
|
|
2247
2246
|
|
|
2248
2247
|
// --- ground: ray from camera hits ground plane ---
|
|
2249
2248
|
let dyClamped = min(d.y, -0.0001);
|
|
@@ -2264,10 +2263,10 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
|
|
|
2264
2263
|
let skyColor = textureSample(envTexture, envSampler, skyUv).rgb;
|
|
2265
2264
|
let groundColor = textureSample(envTexture, envSampler, groundUv).rgb;
|
|
2266
2265
|
|
|
2267
|
-
//
|
|
2268
|
-
let horizonBlend = smoothstep(0.
|
|
2266
|
+
// Sharp blend right at the horizon (d.y = 0)
|
|
2267
|
+
let horizonBlend = smoothstep(0.002, -0.002, d.y);
|
|
2269
2268
|
let aboveGround = step(0.01, cy);
|
|
2270
|
-
let edgeFade = 1.0 - smoothstep(R * 0.
|
|
2269
|
+
let edgeFade = 1.0 - smoothstep(R * 0.85, R, wDist);
|
|
2271
2270
|
let finalBlend = horizonBlend * aboveGround * edgeFade;
|
|
2272
2271
|
let c = mix(skyColor, groundColor, finalBlend);
|
|
2273
2272
|
|
|
@@ -19093,10 +19092,12 @@ class App {
|
|
|
19093
19092
|
[cam[0].toFixed(2), cam[1].toFixed(2), cam[2].toFixed(2)]
|
|
19094
19093
|
);
|
|
19095
19094
|
}
|
|
19095
|
+
const camH = cam[1] - groundLevel;
|
|
19096
|
+
this.skyboxRenderer.groundRadius = Math.max(200, camH * 3);
|
|
19096
19097
|
this.skyboxRenderer.prepareFrame(
|
|
19097
19098
|
this.camera.viewMatrix,
|
|
19098
19099
|
this.camera.projectionMatrix,
|
|
19099
|
-
[cam[0],
|
|
19100
|
+
[cam[0], camH, cam[2]]
|
|
19100
19101
|
);
|
|
19101
19102
|
}
|
|
19102
19103
|
const pass = this.renderer.beginFrame();
|