@needle-tools/three-mesh-effects 0.3.2 → 0.3.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.3 - 2026-11-16
4
+
5
+ - Reduce first-use shader compilation stalls for octahedral impostors.
6
+
3
7
  ## 0.3.2 - 2026-11-13
4
8
 
5
9
  - Support Three.js r186 and load box and card impostors automatically with WebGLRenderer.
@@ -962,12 +962,11 @@ function createPbrImpostorNodeMaterial(descriptor, maps, inputFeatures = {}, ren
962
962
  const displayBillboardPosition = cameraRightLocal.mul(positionGeometry.x).add(cameraUpLocal.mul(positionGeometry.y));
963
963
  const planeLocal = samplingBillboardPosition.toVarying("vImpostorPlaneLocal");
964
964
  const createFrameSampler = (withReprojection) => {
965
- const buildFrameSample = ([frame, planePosition, rayDirection]) => {
965
+ const buildFrameSample = ([frame, planePosition, rayDirection, bounds]) => {
966
966
  const frameDirection = singleView ? singleCaptureDirection : gridToDirection(frame.div(frames.sub(1)));
967
967
  const basis = frameBasis(frameDirection);
968
968
  const right = basisMember(basis, "right");
969
969
  const up = basisMember(basis, "up");
970
- const bounds = viewBounds.element(int(frame.y.mul(frames).add(frame.x)));
971
970
  const rayPlaneDenominator = dot(rayDirection, frameDirection);
972
971
  const safeRayPlaneDenominator = nonZeroSign(rayPlaneDenominator).mul(max(abs(rayPlaneDenominator), 0.05));
973
972
  const framePlanePosition = planePosition.sub(rayDirection.mul(
@@ -1255,7 +1254,22 @@ function createPbrImpostorNodeMaterial(descriptor, maps, inputFeatures = {}, ren
1255
1254
  footprint
1256
1255
  );
1257
1256
  };
1258
- return Fn2(buildFrameSample);
1257
+ const sampleFrame = Fn2(buildFrameSample).setLayout({
1258
+ name: withReprojection ? "sampleReprojectedImpostorFrame" : "samplePlanarImpostorFrame",
1259
+ type: "ImpostorFrameSample",
1260
+ inputs: [
1261
+ { name: "frame", type: "vec2" },
1262
+ { name: "planePosition", type: "vec3" },
1263
+ { name: "rayDirection", type: "vec3" },
1264
+ { name: "bounds", type: "vec4" }
1265
+ ]
1266
+ });
1267
+ return (frame, planePosition, rayDirection) => sampleFrame(
1268
+ frame,
1269
+ planePosition,
1270
+ rayDirection,
1271
+ viewBounds.element(int(frame.y.mul(frames).add(frame.x)))
1272
+ );
1259
1273
  };
1260
1274
  const samplePlanarFrame = createFrameSampler(false);
1261
1275
  const sampleReprojectedFrame = features.reprojection ? createFrameSampler(true) : null;