@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 +4 -0
- package/build/impostor-runtime.js +17 -3
- package/build/impostor-runtime.js.map +2 -2
- package/build/internal/impostor/impostor-node-material.js +17 -3
- package/build/internal/impostor/impostor-node-material.js.map +2 -2
- package/package.json +1 -1
- package/src/impostor/impostor-node-material.js +15 -3
|
@@ -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
|
-
|
|
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;
|