@d5techs/3dgs-lib 1.4.65 → 1.4.66
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 +10 -17
- package/dist/3dgs-lib.cjs.map +1 -1
- package/dist/3dgs-lib.js +10 -17
- package/dist/3dgs-lib.js.map +1 -1
- package/dist/core/SkyboxRenderer.d.ts +1 -1
- package/package.json +1 -1
package/dist/3dgs-lib.cjs
CHANGED
|
@@ -2241,36 +2241,29 @@ fn dirToUv(d: vec3<f32>) -> vec2<f32> {
|
|
|
2241
2241
|
let cx = u.cam.x;
|
|
2242
2242
|
let cy = u.cam.y;
|
|
2243
2243
|
let cz = u.cam.z;
|
|
2244
|
-
let
|
|
2244
|
+
let captureH = u.cam.w;
|
|
2245
2245
|
|
|
2246
2246
|
// --- sky: sample HDR with original direction ---
|
|
2247
2247
|
let skyUv = dirToUv(d);
|
|
2248
2248
|
|
|
2249
|
-
// --- ground: ray
|
|
2249
|
+
// --- ground: ray→plane at Y=0, then map hit point to HDR direction ---
|
|
2250
2250
|
let dyClamped = min(d.y, -0.0001);
|
|
2251
2251
|
let t = -cy / dyClamped;
|
|
2252
|
-
let
|
|
2253
|
-
let
|
|
2254
|
-
let wDist = sqrt(wx * wx + wz * wz);
|
|
2252
|
+
let hitX = cx + t * d.x;
|
|
2253
|
+
let hitZ = cz + t * d.z;
|
|
2255
2254
|
|
|
2256
|
-
//
|
|
2257
|
-
let
|
|
2258
|
-
let bx = wx * s;
|
|
2259
|
-
let bz = wz * s;
|
|
2260
|
-
let bowlY = -sqrt(max(R * R - bx * bx - bz * bz, 0.0));
|
|
2261
|
-
let groundDir = normalize(vec3(bx, bowlY, bz));
|
|
2255
|
+
// Direction from virtual capture point (0, captureH, 0) to ground hit point
|
|
2256
|
+
let groundDir = normalize(vec3(hitX, -captureH, hitZ));
|
|
2262
2257
|
let groundUv = dirToUv(groundDir);
|
|
2263
2258
|
|
|
2264
2259
|
// --- sample both (uniform control flow) ---
|
|
2265
2260
|
let skyColor = textureSample(envTexture, envSampler, skyUv).rgb;
|
|
2266
2261
|
let groundColor = textureSample(envTexture, envSampler, groundUv).rgb;
|
|
2267
2262
|
|
|
2268
|
-
// Sharp blend
|
|
2263
|
+
// Sharp blend at horizon, no edge fade needed
|
|
2269
2264
|
let horizonBlend = smoothstep(0.002, -0.002, d.y);
|
|
2270
2265
|
let aboveGround = step(0.01, cy);
|
|
2271
|
-
let
|
|
2272
|
-
let finalBlend = horizonBlend * aboveGround * edgeFade;
|
|
2273
|
-
let c = mix(skyColor, groundColor, finalBlend);
|
|
2266
|
+
let c = mix(skyColor, groundColor, horizonBlend * aboveGround);
|
|
2274
2267
|
|
|
2275
2268
|
// Reinhard tone mapping + gamma
|
|
2276
2269
|
let mapped = c / (c + vec3(1.));
|
|
@@ -2292,7 +2285,7 @@ class SkyboxRenderer {
|
|
|
2292
2285
|
__publicField(this, "bindGroup", null);
|
|
2293
2286
|
__publicField(this, "frameReady", false);
|
|
2294
2287
|
__publicField(this, "mode", "none");
|
|
2295
|
-
/**
|
|
2288
|
+
/** Virtual HDR capture height (world units). Controls ground texture spread. */
|
|
2296
2289
|
__publicField(this, "groundRadius", 50);
|
|
2297
2290
|
this.device = device;
|
|
2298
2291
|
const depthStencil = {
|
|
@@ -19095,7 +19088,7 @@ class App {
|
|
|
19095
19088
|
);
|
|
19096
19089
|
}
|
|
19097
19090
|
const camH = cam[1] - groundLevel;
|
|
19098
|
-
this.skyboxRenderer.groundRadius =
|
|
19091
|
+
this.skyboxRenderer.groundRadius = 50;
|
|
19099
19092
|
this.skyboxRenderer.prepareFrame(
|
|
19100
19093
|
this.camera.viewMatrix,
|
|
19101
19094
|
this.camera.projectionMatrix,
|