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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
docs(assets): a rigged model comes in rigged
esengine23115480c117
diff --git a/docs/astro/src/content/docs/assets/models.mdx b/docs/astro/src/content/docs/assets/models.mdxindex 891405f38..807bfcfbd 100644--- a/docs/astro/src/content/docs/assets/models.mdx+++ b/docs/astro/src/content/docs/assets/models.mdx@@ -109,12 +109,21 @@ so a track cannot drive the wrong one; that name is what the prefab shows.`LINEAR`, `STEP` and `CUBICSPLINE` all carry across, tangents included.-<Aside type="caution" title="A skinned character will not deform">-Node animation moves the nodes — which for a rigged model means the joints move and the-mesh bound to them does not follow, because skinning is not implemented. The import says so-when it happens. Models whose parts are separate nodes (machines, doors, props, camera-moves) animate exactly as authored.-</Aside>+## Skinning++A rigged model comes in rigged: the mesh carries its joint indices, weights and bind pose,+and the prefab gives the entity a `MeshSkin` naming the joint entities in the order those+matrices are in. Moving a joint — by hand, or by the animation above — deforms the mesh.++A skinned mesh's **own** transform is ignored, which glTF requires: its joints are already+placed in the world, so moving the mesh entity does nothing. Move the rig's root, or the+joints.++| Limit | Why |+|---|---|+| 64 joints per mesh | The pose is a uniform block, which is 4KB at that size — inside what a WebGL2 block is guaranteed. A mesh wanting more draws undeformed. |+| A material is not applied to a skinned mesh | Its program is compiled for a vertex source that reads a model matrix, and a skinned one does not have one. |+| Joint count must match the bind pose | A mesh whose `MeshSkin` names a different number of joints draws undeformed rather than with vertices resolved against the wrong matrices. |## Compressed geometry@@ -130,7 +139,6 @@ when it runs.| Not imported | Why ||---|---|| `metallicFactor`, `roughnessFactor`, `metallicRoughnessTexture` | Shading metal needs a view direction, and these lights are 2D. A factor nothing reads would be a knob that lies. |-| Skinning (`JOINTS_0`/`WEIGHTS_0`), skins | A rigged model comes in as static geometry, and a clip driving its joints says so. || Morph targets, `weights` animation channels | Blending between shapes needs the targets themselves, which are not carried. || A second UV set (`TEXCOORD_1`), `KHR_texture_transform` | UVs are used as authored. || Non-triangle primitives (`mode` ≠ 4) | The renderer draws triangle lists. |diff --git a/docs/astro/src/content/docs/zh-cn/assets/models.mdx b/docs/astro/src/content/docs/zh-cn/assets/models.mdxindex 48066a3fd..66e404f08 100644--- a/docs/astro/src/content/docs/zh-cn/assets/models.mdx+++ b/docs/astro/src/content/docs/zh-cn/assets/models.mdx@@ -103,11 +103,20 @@ API,它就开始播。`LINEAR`、`STEP`、`CUBICSPLINE` 都会带过来,含切线。-<Aside type="caution" title="蒙皮角色不会变形">-节点动画移动的是**节点** —— 对绑定好的模型来说就是骨骼在动,而绑在骨骼上的 mesh 不会跟着-变形,因为蒙皮还没实现。遇到这种情况导入器会说出来。各部分本来就是独立节点的模型(机械、-门、道具、相机运动)会完全按作者的意思动起来。-</Aside>+## 蒙皮++绑定好的模型会带着绑定进来:mesh 携带它的骨骼索引、权重和绑定姿态,prefab 给实体挂一个+`MeshSkin`,按那些矩阵的顺序列出骨骼实体。移动骨骼 —— 手动,或者由上面的动画驱动 ——+mesh 就会变形。++蒙皮 mesh **自己**的 transform 会被忽略,这是 glTF 的要求:它的骨骼已经摆在世界里了,+所以移动 mesh 实体不会有任何效果。要移动的是骨架的根,或者骨骼本身。++| 限制 | 为什么 |+|---|---|+| 每个 mesh 最多 64 根骨骼 | 姿态走 uniform 块,64 根是 4KB —— 在 WebGL2 对一个块的保证范围内。超过的 mesh 按不变形绘制。 |+| 材质不作用于蒙皮 mesh | 材质的 program 是为「读 model 矩阵」的顶点源编译的,而蒙皮的没有 model 矩阵。 |+| 骨骼数必须与绑定姿态一致 | `MeshSkin` 列出的骨骼数对不上时按不变形绘制,而不是让顶点去解析错误的矩阵。 |## 压缩几何@@ -121,7 +130,6 @@ API,它就开始播。| 不导入 | 为什么 ||---|---|| `metallicFactor`、`roughnessFactor`、`metallicRoughnessTexture` | 算金属高光要 view 方向,而这里的灯光是 2D 的。写进产物却没人读,那就是个会撒谎的旋钮。 |-| 蒙皮(`JOINTS_0`/`WEIGHTS_0`)、skin | 绑定好的模型会以静态几何进来,驱动它骨骼的 clip 会说明这一点。 || morph target、`weights` 动画通道 | 在多个形状之间混合需要那些 target 本身,而它们没有被带过来。 || 第二套 UV(`TEXCOORD_1`)、`KHR_texture_transform` | UV 按作者写的原样使用。 || 非三角形 primitive(`mode` ≠ 4) | 渲染器画的是三角形列表。 |