inspect-glb

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Inspect GLBs

检查GLB资产

Resolve
scripts/inspect.mjs
relative to this skill directory and run it before choosing entity transforms or animation names:
sh
node <skill-directory>/scripts/inspect.mjs public/models/Character.glb
node <skill-directory>/scripts/inspect.mjs public/models/{Ship,Enemy}_*.glb
The output provides:
  • dims
    for calculating a uniform scale;
  • groundOffset
    for the model wrapper's local Y position;
  • center
    for the pivot offset from the geometry centre: a non-zero X or Z means the root's position is not where the model appears, and Y feeds grounding;
  • boundsSource
    and
    boundsPose
    for proving how and at which pose the bounds were measured;
  • requiresRuntimeCheck
    for animated morphs, skins, and incomplete decoding;
  • nodePaths
    ,
    clips
    ,
    joints
    , and
    animationTargets
    for animation setup and rig comparison;
  • morphed
    ,
    morphAnimated
    , and
    skinned
    for pose-sensitive assets.
在选择实体变换或动画名称之前,找到相对于此技能目录的
scripts/inspect.mjs
并运行它:
sh
node <skill-directory>/scripts/inspect.mjs public/models/Character.glb
node <skill-directory>/scripts/inspect.mjs public/models/{Ship,Enemy}_*.glb
输出内容包括:
  • dims
    :用于计算统一缩放比例;
  • groundOffset
    :模型包装器的本地Y轴位置;
  • center
    :从几何体中心到枢轴的偏移量:X或Z值非零表示根节点位置与模型视觉位置不符,Y值用于接地设置;
  • boundsSource
    boundsPose
    :说明边界的测量方式及测量时的姿态;
  • requiresRuntimeCheck
    :针对带动画的变形目标、蒙皮及解码不完整的情况;
  • nodePaths
    clips
    joints
    animationTargets
    :用于动画设置和骨骼绑定对比;
  • morphed
    morphAnimated
    skinned
    :用于标记对姿态敏感的资产。

Bounds precision

边界精度

aabb
,
dims
,
center
, and
groundOffset
are decoded from actual vertex positions, default morph weights, and each node's world matrix. Confirm both source and pose before relying on them:
  • vertices
    means every primitive was decoded and the bounds are exact for
    boundsPose
    .
  • accessor-minmax
    means at least one primitive could not be decoded, so its bounds fall back to the node-transformed local box. That over-estimates a mesh which does not fill its own box on a node rotated off-axis, by up to 41 percent for a 45-degree yaw.
    boundsNotes
    gives the cause.
  • incomplete
    means some visible default-pose geometry could not be measured; do not calibrate from the reported bounds.
  • null
    means no usable bounds could be recovered.
static
and
default-morph
bounds describe visible geometry at its authored default pose.
bind
describes skinned vertices before animation. When
requiresRuntimeCheck
is true, confirm grounding and maximum animated extent in the running application even if
boundsSource
is
vertices
.
Carry
boundsSource
,
aabb
,
dims
,
center
, and
groundOffset
into the asset tuning record.
groundOffset
seats the base in Y;
center.x
and
center.z
are the horizontal pivot offset that
calibrate-model
must compensate, so a placed root sits where the mesh appears, not where the authored pivot happens to be. Running the inspector alone is not placement evidence. Its global AABB supports plane grounding and broad-phase spacing, but cannot locate a non-planar support surface or attachment point. Use an authored mount point or confirm the support in the running application before placing another model.
aabb
dims
center
groundOffset
是从实际顶点位置、默认变形权重及每个节点的世界矩阵解码而来。在依赖这些值之前,请确认其来源和姿态:
  • vertices
    表示所有图元已解码,且
    boundsPose
    对应的边界是精确的;
  • accessor-minmax
    表示至少有一个图元无法解码,因此其边界退化为经节点变换后的本地包围盒。对于节点绕轴旋转(如偏航45度)且未填满自身包围盒的网格,该值会高估边界,最多偏差41%。
    boundsNotes
    会给出具体原因;
  • incomplete
    表示部分可见的默认姿态几何体无法测量,请不要根据报告的边界进行校准;
  • null
    表示无法恢复可用的边界。
static
default-morph
边界描述的是默认创作姿态下的可见几何体。
bind
描述的是蒙皮顶点在动画前的状态。当
requiresRuntimeCheck
为true时,即使
boundsSource
vertices
,也需在运行的应用中确认接地位置和动画的最大范围。
boundsSource
aabb
dims
center
groundOffset
记录到资产调优档案中。
groundOffset
用于设置Y轴方向的底座位置;
center.x
center.z
是水平枢轴偏移量,
calibrate-model
必须对此进行补偿,才能使放置的根节点与网格视觉位置一致,而非创作时的枢轴位置。仅运行检查器不能作为放置依据。其全局AABB支持平面接地和宽阶段间距,但无法定位非平面支撑面或附着点。在放置其他模型之前,请使用创作的挂载点或在运行的应用中确认支撑面。

Extract from compressed containers

从压缩容器中提取

The bundled inspector decodes plain, interleaved, quantized, and sparse vertex buffers. For Draco, Meshopt, or external buffers,
boundsNotes
names the cause. Parse and rewrite a scratch copy with glTF Transform's lossless
copy
command, then inspect that copy rather than shipping it:
sh
npx --yes @gltf-transform/cli@4.4.2 copy in.glb scratch.glb
node <skill-directory>/scripts/inspect.mjs scratch.glb
copy
preserves decoded vertex values, scenes, nodes, and materials while removing Draco and Meshopt compression. Existing lossy compression may already have quantized the source. Do not substitute
optimize
: it enables additional transforms unless each one is understood and disabled.
The Engine has no
EXT_meshopt_compression
support, so a meshopt asset will not render as shipped. If it must appear in the scene, transcode it to an uncompressed GLB the same way — subject to the project's rules on modifying assets — so it both loads and measures.
These geometry-fit bounds can intentionally disagree with the Engine's runtime culling AABB.
MeshInstance.aabb
transforms the declared local box and expands it conservatively for morph targets, so it can be larger than visible geometry. Place static models from exact inspected bounds; confirm morph and skin extremes at runtime. A skinned mesh node's own transform is ignored here because glTF requires it; the Engine resolves to the same result.
Shortlist files first; do not dump an entire asset pack into context. Bounds cannot prove facing. glTF convention is +Z forward while PlayCanvas entities face -Z, and asset packs vary. Confirm each directional model once in the running app as the
apply-conventions
skill describes, and store its yaw correction with its scale and grounding.
Use
npx @gltf-transform/cli inspect
only when vertex or texture statistics justify extra tooling.
附带的检查器可解码普通、交错、量化和稀疏的顶点缓冲区。对于Draco、Meshopt或外部缓冲区,
boundsNotes
会说明原因。使用glTF Transform的无损
copy
命令解析并重写一个临时副本,然后检查该副本(而非直接使用原文件):
sh
npx --yes @gltf-transform/cli@4.4.2 copy in.glb scratch.glb
node <skill-directory>/scripts/inspect.mjs scratch.glb
copy
命令会保留解码后的顶点值、场景、节点和材质,同时移除Draco和Meshopt压缩。原有的有损压缩可能已对源文件进行了量化。请勿使用
optimize
命令替代,除非了解并禁用其所有额外转换操作。
PlayCanvas引擎不支持
EXT_meshopt_compression
,因此Meshopt压缩的资产无法直接渲染。如果必须在场景中使用,需通过相同方式将其转码为未压缩的GLB(需符合项目修改资产的规则),使其既能加载又能被测量。
这些贴合几何体的边界可能会与引擎运行时的剔除AABB有意不同。
MeshInstance.aabb
会变换声明的本地包围盒,并为变形目标保守地扩大范围,因此可能大于可见几何体。静态模型应根据检查得到的精确边界进行放置;变形和蒙皮的极限范围需在运行时确认。此处忽略蒙皮网格节点自身的变换,因为glTF要求如此,引擎也会得到相同结果。
先筛选文件;不要将整个资产包全部导入。边界无法证明朝向。glTF的惯例是+Z向前,而PlayCanvas实体是-Z向前,不同资产包可能存在差异。按照
apply-conventions
技能的描述,在运行的应用中确认每个定向模型一次,并将其偏航校正值与缩放和接地设置一起存储。
仅当需要获取顶点或纹理统计信息时,才使用
npx @gltf-transform/cli inspect
工具。