Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(golden): morph target joins the census, and a parity failure keeps its frames

esenginec8d96f56c49a
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4d13cc355..ae18ce582 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -669,6 +669,20 @@ jobs:
- name: Launch the golden packages and compare them to the editor (PR tier)
run: node tools/verify-golden.mjs --tier pr
+ # A parity failure is a claim about two PICTURES, and until now neither left
+ # the runner: "the package is not showing what the editor showed" named two
+ # paths that were deleted with the machine. A pixel gate that can only fail
+ # here has to hand over what it compared, or nobody can tell a real
+ # regression from a frame the software rasteriser had not finished.
+ - name: Keep the frames a parity failure compared
+ if: failure()
+ uses: actions/upload-artifact@v7
+ with:
+ name: golden-parity-frames
+ path: .golden/*.png
+ if-no-files-found: warn
+ retention-days: 7
+
# Which places EXIST in that package, and what leaves with them. A camera
# cannot answer this: a cell that is not drawn and a cell that is not there
# look the same, and a body an unload forgot is invisible until someone
diff --git a/build-tools/ufbx/ufbx-load.wasm b/build-tools/ufbx/ufbx-load.wasm
index a9f813f7e..92fb26690 100755
Binary files a/build-tools/ufbx/ufbx-load.wasm and b/build-tools/ufbx/ufbx-load.wasm differ
diff --git a/docs/astro/src/content/docs/assets/models.mdx b/docs/astro/src/content/docs/assets/models.mdx
index 2ae9b0f65..17907bd4d 100644
--- a/docs/astro/src/content/docs/assets/models.mdx
+++ b/docs/astro/src/content/docs/assets/models.mdx
@@ -186,6 +186,7 @@ glTF states none, and pushing past 1 or below 0 is a shape an author may want.
| 8 shapes blended at once | A budget on what is LIVE, not on what a mesh carries — a face holds a handful of expressions open while its mesh has a hundred. The heaviest weights are taken; the rest read as zero, which is what an untouched weight already means. |
| Normals deform only where the geometry has them | A mesh with no `NORMAL` channel is shaded off a constant normal, which no delta can bend. |
| Tangents are not carried | The tangent frame is derived per pixel, from the surface as deformed. |
+| An FBX's in-between shapes | A channel that passes through shapes on its way to the last one carries only the last; the import says which it dropped. |
## FBX
diff --git a/docs/astro/src/content/docs/zh-cn/assets/models.mdx b/docs/astro/src/content/docs/zh-cn/assets/models.mdx
index c5937c5dc..b000bee17 100644
--- a/docs/astro/src/content/docs/zh-cn/assets/models.mdx
+++ b/docs/astro/src/content/docs/zh-cn/assets/models.mdx
@@ -171,6 +171,7 @@ target 对每个顶点的 delta,prefab 给实体挂一个 `MeshMorph`,它的
| 同时最多混合 8 个形状 | 限制的是**活跃**数量,不是 mesh 能携带的数量——一张脸同时张开的表情就那么几个,而它的 mesh 可以有上百个形状。取权重最大的那些,其余按 0 读,这和作者没动过的权重是同一件事。 |
| 只有几何自带法线时法线才变形 | 没有 `NORMAL` 通道的 mesh 按一个常量法线着色,任何 delta 都弯不动它。 |
| 不带切线 | 切线基是逐像素从变形后的表面推出来的。 |
+| FBX 的 in-between 形状 | 一个通道途经多个形状时只带最后一个;导入时会说明丢掉了哪些。 |
## FBX
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index c198549f3..b0e2a5d3d 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -296,7 +296,7 @@ export const CAPABILITIES = [
'lighting-2d',
'sprite-sorting', 'sprite-mask', 'ui-widgets', 'velocity-motion',
'ssao', 'navigation-3d', 'root-motion', 'animation-events', 'shader-readiness',
- 'animation-layers', 'animation-ik',
+ 'animation-layers', 'animation-ik', 'morph-target',
'tilemap', 'tile-collision',
'touch', 'safe-area', 'pause-resume',
'texture-atlas',
@@ -351,6 +351,10 @@ export const EVIDENCE = {
// The clip the import wrote, referenced by the prefab the scene places.
'model-animation': /\.estimeline\b/,
'model-skinning': /\bMeshSkin\b/,
+ // The COMPONENT, not the mesh: a `.esmesh` carrying shapes nothing is blended
+ // towards is geometry with an unused section, and that is what an import of a
+ // model whose targets nobody authored produces.
+ 'morph-target': /\bMeshMorph\b/,
'physics-3d': /\b(RigidBody3D|CharacterController3D|BoxCollider3D|MeshCollider3D)\b/,
'mesh-shadow': /\bmeshShadows\b/,
'level-of-detail': /\bLODGroup\b/,
@@ -467,7 +471,7 @@ export const GOLDEN = [
},
{
id: 'model-import',
- certifies: ['model-import', 'model-animation'],
+ certifies: ['model-import', 'model-animation', 'morph-target'],
// Desktop too: these claims are about the ENGINE, and the native runtime is
// a second one. Certified only on web, an import that reaches no native
// frame reads as covered right up until a device says otherwise.
diff --git a/tools/ufbx-wasm/bridge.c b/tools/ufbx-wasm/bridge.c
index e8931e1ba..4844e1ac3 100644
--- a/tools/ufbx-wasm/bridge.c
+++ b/tools/ufbx-wasm/bridge.c
@@ -316,8 +316,17 @@ static int build_part(es_writer *w, const ufbx_mesh *mesh, const ufbx_mesh_part
lookups = (int32_t **)calloc(blend->channels.count, sizeof(*lookups));
if (shapes && lookups) {
for (size_t c = 0; c < blend->channels.count; c++) {
- const ufbx_blend_shape *shape = blend->channels.data[c]->target_shape;
+ const ufbx_blend_channel *channel = blend->channels.data[c];
+ const ufbx_blend_shape *shape = channel->target_shape;
if (!shape) continue;
+ // A progressive morph: the channel passes through shapes on its
+ // way to the last one. Only the last is carried, and a shape a
+ // reader drops without saying so is the deformation gone.
+ if (channel->keyframes.count > 1) {
+ warnf(w, "%s: shape \"%s\" passes through %zu in-between target(s);"
+ " only the final one is imported", label, channel->name.data,
+ channel->keyframes.count - 1);
+ }
shapes[out->morph_targets] = shape;
lookups[out->morph_targets] = shape_lookup(shape, mesh->num_vertices);
if (shape->normal_offsets.count > 0) out->morph_normals = 1;