threejs-procedural-creatures

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Procedural Creatures

程序化生物

Build a creature as a compiler: a dimensioned spec produces stable body, rig, pose, and population identities; runtime work advances only selected state. The canonical path uses Three.js r185
WebGPURenderer
, TSL,
NodeMaterial
, and workload-selected storage. Imported skinned animation assets are a separate pipeline rather than an extension of this skill.
将生物构建为编译器:维度化的规范会生成稳定的身体、骨骼绑定、姿态和种群标识;运行时仅处理选定的状态更新。标准流程使用Three.js r185版本的
WebGPURenderer
、TSL、
NodeMaterial
以及根据工作负载选择的存储方案。导入的蒙皮动画资源属于独立流水线,并非本技能的扩展部分。

1. Define the body contract

1. 定义身体契约

Name the requested observable, closest/farthest projected extent, morphology envelope, pose/topology update frequency, visible population, target adapter, world units/frame, final-output owner, and any habitat/support/water/weather providers.
Classify the request into one or more branches:
BranchCreature owns
generated bodyspec, field or segment compiler, shipping surface, materials
rig/locomotionsemantic slots, local pose, fixed-step or analytic motion, support-relative targets
repeated populationcompatible geometry/material identities, pose pages, bounds, culling, LOD
This step is complete when every requested observable has one owner, every external input names its producer and sampling contract, and the topology, pose, and population change regimes are explicit.
明确所需可观测项、最远/最近投影范围、形态包络、姿态/拓扑更新频率、可见种群数量、目标适配器、世界单位/帧、最终输出归属方,以及任何栖息地/支撑物/水体/天气提供者。
将需求归类到一个或多个分支:
分支生物负责内容
生成式身体规范、场或分段编译器、交付表面、材质
骨骼绑定/运动系统语义插槽、局部姿态、固定步长或解析运动、相对支撑物的目标
重复种群兼容的几何/材质标识、姿态页面、边界、剔除、LOD
当所有所需可观测项都有明确归属方、所有外部输入都指定了生产者和采样契约、且拓扑结构、姿态和种群的变更规则清晰时,此步骤完成。

2. Select the shipping representation

2. 选择交付表示形式

Choose from connectivity, deformation, reuse, and projected error:
WorkloadRepresentationRequired proof
fixed connectivity with changing poseone extracted reference mesh plus validated skinningtopology, weights, deformation, bidirectional surface error
fixed connectivity with bounded morphology changereference mesh, skinning, optional bounded local field correctionfull-envelope Jacobian, inversion, correction and surface error
components may merge, split, open, or closebudgeted dynamic extraction or explicit unsupported resulttopology events, cadence, transition and complete mesh validity
body is visibly separate rigid plates/linksclosed articulated segment hierarchyclosed geometry, joint gaps/limits, transform parity
many bodies share topologyshared geometry/material plus fixed pose pagescompatible identity, dirty traffic, bounds and visible submission
small projected bodysimplified mesh or orientation-aware impostorview-cone silhouette error and transition hysteresis
A concatenated capsule/primitive shell is a field diagnostic, not proof of a manifold body. Choose one primary representation per range and state which features or topology changes it cannot represent.
This step is complete when each range has one shipping representation, its geometry/cache identity is defined, and every transition has a physical-pixel error gate, hysteresis/dwell, simultaneous-memory budget, and reset action.
根据连接性、变形、复用性和投影误差选择:
工作负载表示形式必要验证依据
固定连接性+姿态变化提取的参考网格+验证后的蒙皮拓扑结构、权重、变形、双向表面误差
固定连接性+有限形态变化参考网格、蒙皮、可选的有限局部场修正全包络雅可比矩阵、反转、修正及表面误差
组件可合并、拆分、开合预算内的动态提取或明确的不支持结果拓扑事件、节奏、过渡及完整网格有效性
身体为独立刚性板/连杆闭合的铰接分段层级闭合几何、关节间隙/限制、变换一致性
多体共享拓扑共享几何/材质+固定姿态页面兼容标识、脏数据传输量、边界及可见提交
小投影身体简化网格或方向感知 impostor视锥轮廓误差及过渡滞后
拼接的胶囊/原始外壳仅作为场诊断工具,不能作为流形身体的验证依据。为每个范围选择一种主表示形式,并说明其无法支持的特性或拓扑变化。
当每个范围都有对应的交付表示形式、其几何/缓存标识已定义、且每个过渡都有物理像素误差阈值、滞后/停留机制、同步内存预算和重置操作时,此步骤完成。

3. Compile the generated body

3. 编译生成式身体

When a selected branch needs a field-derived body, extracted skin, skinning, correction, semantic rig, creature locomotion, or repeated pose storage, open only its applicable sections of creature-body-systems.md:
  • every selected branch reads Spaces and state ownership and Spec and compiler;
  • generated-body work reads Field and blend contract and Reference surface and correction;
  • rig or locomotion work reads Pose and locomotion;
  • repeated-population work reads Repeated populations and rendering;
  • verification reads Completion evidence for the selected branches.
When the body is a hierarchy of rigid shells or plates, read articulated-hard-shell-creatures.md. Keep stable semantic segment/joint IDs, closed surfaces, parent-local pivots, and one transform path for visible, shadow/depth, bounds, and motion vectors.
Compile heavy work before visibility: spec validation, topology, reference surface or closed segments, weights, candidates, frames, geometry identities, materials, and fixed page layouts. Spawning validates and writes active slots; it does not construct geometry or compile pipelines.
This step is complete when all graph references and slots resolve, CPU/TSL parity passes where applicable, emitted surfaces are valid over the declared pose/morphology envelope, and every cached artifact resolves the complete identity that affects it.
当所选分支需要场派生身体、提取的蒙皮、蒙皮绑定、修正、语义骨骼绑定、生物运动或重复姿态存储时,仅打开creature-body-systems.md中的对应章节:
  • 所有选中分支需阅读空间与状态归属和规范与编译器;
  • 生成式身体相关工作需阅读场与混合契约和参考表面与修正;
  • 骨骼绑定或运动系统相关工作需阅读姿态与运动;
  • 重复种群相关工作需阅读重复种群与渲染;
  • 验证工作需阅读所选分支的完成依据。
当身体为刚性外壳或板的层级结构时,阅读articulated-hard-shell-creatures.md。保持稳定的语义分段/关节ID、闭合表面、父级局部枢轴,以及用于可见性、阴影/深度、边界和运动向量的单一变换路径。
在可见性处理前完成繁重的编译工作:规范验证、拓扑结构、参考表面或闭合分段、权重、候选对象、帧、几何标识、材质和固定页面布局。生成操作仅验证并写入活跃插槽,不构建几何或编译流水线。
当所有图引用和插槽都已解析、CPU/TSL一致性通过(如适用)、生成的表面在声明的姿态/形态包络内有效、且每个缓存工件都能解析影响它的完整标识时,此步骤完成。

4. Build pose and locomotion only where requested

4. 仅按需构建姿态与运动系统

Pose remains creature-local; root motion is applied exactly once by the instance transform. Use stable seeded variation and injected simulation time. Closed-form motion samples time directly. Gait, springs, ropes, buoyancy, and contact response advance at a fixed step owned locally or by the routed simulation stage, with immutable previous/current states for presentation.
For support-relative limbs:
  1. batch required probes at one sample instant/version;
  2. retain stable support/feature identity and the planted point in support-local coordinates;
  3. form gait homes and swing arcs in the support tangent frame;
  4. predict targets from body velocity relative to represented support-point velocity;
  5. transform targets through the inverse root into body space;
  6. solve IK, write local slots, then update posed bounds.
When support, water, air, gravity, weather, or physical contacts participate, define a handoff with units, frame/origin, interval or sample instant, cadence/sample phase, producer/consumer/version, footprint/filter, validity/staleness/error, and rate-versus-integrated meaning. Water-surface motion and material current are distinct channels; missing represented data is absence rather than a physical zero. Frame-critical decisions use an analytic mirror, deterministic shared field, or batched provider with declared latency/error rather than GPU readback.
One-way visual coupling returns no physical reaction. A two-way route sends source/reaction quantities through the authoritative solver named by the handoff. This skill owns creature pose and structural response, not private terrain, water, wind, gravity, or contact state.
This step is complete when equal seed/tick/inputs reproduce pose, render cadence cannot alter recurrent state, support-relative drift and limb-length residuals pass, required provider channels are present with bounded error, and every pose writer has a deterministic order.
姿态保持在生物局部空间;根变换仅通过实例变换应用一次。使用稳定的种子变体和注入的模拟时间。闭式运动直接采样时间。步态、弹簧、绳索、浮力和接触响应在固定步长下推进,步长由局部或路由模拟阶段控制,且具有用于展示的不可变历史/当前状态。
对于相对支撑物的肢体:
  1. 在同一采样时刻/版本批量执行所需探测;
  2. 保留稳定的支撑物/特征标识,以及支撑物局部坐标下的接触点;
  3. 在支撑物切线坐标系中构建步态原点和摆动弧线;
  4. 根据身体相对于支撑点代表速度的速度预测目标;
  5. 通过根变换的逆将目标转换到身体空间;
  6. 求解IK、写入局部插槽,然后更新姿态边界。
当支撑物、水体、空气、重力、天气或物理接触参与时,定义包含单位、帧/原点、间隔或采样时刻、节奏/采样相位、生产者/消费者/版本、覆盖范围/过滤器、有效性/过期/误差,以及速率与积分含义的交接规则。水面运动和材质流是不同的通道;缺失的代表数据视为不存在而非物理零值。帧关键决策使用解析镜像、确定性共享场或声明了延迟/误差的批量提供者,而非GPU回读。
单向视觉耦合不返回物理反应。双向路由通过交接指定的权威求解器传递源/反应量。本技能负责生物姿态和结构响应,不负责私有地形、水体、风、重力或接触状态。
当相同种子/时钟/输入可复现姿态、渲染节奏无法改变循环状态、相对支撑物的漂移和肢体长度残差达标、所需提供者通道存在且误差有限、且每个姿态写入器都有确定顺序时,此步骤完成。

5. Scale the population and present once

5. 扩展种群并完成一次渲染

Initialize the canonical renderer before allocating resources:
js
import { WebGPURenderer } from 'three/webgpu';

const renderer = new WebGPURenderer({ antialias: false });
await renderer.init();
if (renderer.backend.isWebGPUBackend !== true) {
  throw new Error('WebGPU backend unavailable for the canonical creature path.');
}
  • Share geometry only across compatible compiler/topology/geometry/tier identities. A species label alone is not a batch key.
  • Store creature-local pose, root transform, bound, stable identity, representation, and history generation in fixed-capacity pages. Upload only coalesced dirty ranges.
  • Use posed primitive/segment bounds or a proven conservative animation envelope. Cull pages and instances before submission.
  • Bound shader loops by actual part/candidate count. Candidate evaluation keeps the authored blend ancestry and its omission certificates.
  • Use one population ID/normal/depth edge pass for repeated outlines; reserve a duplicate iso-offset body for a measured hero branch.
  • Reuse the same deformed local position in visible and cast-shadow paths; derive received-shadow lookup in world space.
  • Decode authored sRGB once before linear uniform/storage use. One scene pipeline owns tone mapping and output conversion.
  • Precompile every shipping display, depth/shadow, outline, and configured output variant before first visibility.
This step is complete when population pages have bounded capacity/lifetime, static or unchanged poses cause no redundant recurrent work, bounds cull correctly, visible/depth/shadow/motion consume one accepted pose generation, and exactly one component owns final output conversion.
在分配资源前初始化标准渲染器:
js
import { WebGPURenderer } from 'three/webgpu';

const renderer = new WebGPURenderer({ antialias: false });
await renderer.init();
if (renderer.backend.isWebGPUBackend !== true) {
  throw new Error('WebGPU backend unavailable for the canonical creature path.');
}
  • 仅在兼容的编译器/拓扑/几何/层级标识间共享几何。仅物种标签不能作为批处理键。
  • 在固定容量页面中存储生物局部姿态、根变换、边界、稳定标识、表示形式和历史版本。仅上传合并后的脏数据范围。
  • 使用姿态化原始/分段边界或经过验证的保守动画包络。在提交前剔除页面和实例。
  • 按实际部件/候选数量限制着色器循环。候选评估保留创作的混合祖先及其省略证明。
  • 为重复轮廓使用一次种群ID/法线/深度边缘通道;为指定的主角分支保留一个重复的等值偏移身体。
  • 在可见性和阴影投射路径中复用相同的变形局部位置;在世界空间中派生接收阴影的查找。
  • 在转换为线性统一/存储使用前仅解码一次创作的sRGB。单个场景流水线负责色调映射和输出转换。
  • 在首次可见前预编译所有交付用的显示、深度/阴影、轮廓和配置好的输出变体。
当种群页面有容量/生命周期限制、静态或未变更姿态不会产生冗余循环工作、边界剔除正确、可见性/深度/阴影/运动仅使用一个已接受的姿态版本、且恰好有一个组件负责最终输出转换时,此步骤完成。

6. Verify representation, state, and lifecycle

6. 验证表示形式、状态和生命周期

Inspect final/no-post output plus the selected diagnostics:
text
body: field/normal/candidate views, topology, skin weights, segment IDs,
      correction residual, inversions/intersections, silhouette
rig: slot/parent IDs, joint limits, radial frames, planted support and IK,
     previous/current pose and history generation
population: page occupancy, dirty ranges, posed bounds, culling, LOD/impostor,
            visible/shadow/depth/motion parity
Exercise fixed-seed replay; tick seek versus stepping; complete pose and morphology envelopes; render hitches; sloped/moving support; missing, stale, or discontinuous provider data; spawn/death/teleport/reparent/slot reuse; topology/LOD change; resize; and disposal.
Report compiler/surface counts, field parity and surface error, locomotion drift and convergence, visible/submitted pages and instances, dirty upload bytes, field/correction evaluations, CPU fixed-step cost, whole-frame and paired- marginal CPU/GPU p50/p95, peak live bytes, first-visible pipeline events, and sustained target behaviour.
Failure signatures include primitive sheets shipped as a manifold body, renaming parts changing a blend field, skin weights crossing touching limbs, helper-axis frame flips, root transforms applied twice, render-dt gait, support drift, water channels conflated, one mutable global population buffer, unbounded shader loops, disabled culling, pose generations disagreeing across passes, and resources/state surviving disposal.
Verification is complete when every selected representation, rig/locomotion, population, output, reset, budget, and disposal gate passes; unselected branches carry no required payload or evidence.
检查最终/无后期处理的输出以及选定的诊断项:
text
身体:场/法线/候选视图、拓扑结构、蒙皮权重、分段ID、
      修正残差、反转/相交、轮廓
骨骼绑定:插槽/父级ID、关节限制、径向帧、接触支撑物与IK、
         历史/当前姿态及版本
种群:页面占用率、脏数据范围、姿态化边界、剔除、LOD/ impostor、
      可见性/阴影/深度/运动一致性
测试固定种子重放;时钟跳转与步进;完整姿态和形态包络;渲染卡顿;倾斜/移动支撑物;缺失、过期或不连续的提供者数据;生成/死亡/传送/重父化/插槽复用;拓扑/LOD变化;窗口调整;以及资源销毁。
报告编译器/表面数量、场一致性和表面误差、运动漂移与收敛、可见/提交的页面和实例数量、脏数据上传字节数、场/修正评估次数、CPU固定步长开销、整帧及成对边际CPU/GPU的p50/p95值、峰值内存占用、首次可见流水线事件,以及持续的目标行为。
失败特征包括:将原始面片作为流形身体交付、重命名部件改变混合场、蒙皮权重跨接触肢体、辅助轴帧翻转、根变换应用两次、基于渲染时长的步态、支撑物漂移、水体通道混淆、单一可变全局种群缓冲区、无界着色器循环、剔除禁用、不同通道姿态版本不一致、资源/状态在销毁后残留。
当所有选定的表示形式、骨骼绑定/运动系统、种群、输出、重置、预算和销毁检查都通过,且未选中分支无必要负载或验证依据时,验证完成。

Routing boundary

路由边界

Use
$threejs-procedural-motion-systems
for general transform timelines and springs,
$threejs-procedural-geometry
for generic mesh writers,
$threejs-procedural-fields
for reusable fields/material coordinates,
$threejs-procedural-vegetation
for plants, and
$threejs-visual-validation
for target-scene visual contracts. This skill owns procedural creature bodies, semantic rigs, creature locomotion, pose storage, and repeated-population representation. Imported glTF clips, retargeting, and VAT animation belong to an imported-asset character pipeline.
通用变换时间线和弹簧使用
$threejs-procedural-motion-systems
,通用网格写入器使用
$threejs-procedural-geometry
,可复用场/材质坐标使用
$threejs-procedural-fields
,植物相关使用
$threejs-procedural-vegetation
,目标场景视觉契约使用
$threejs-visual-validation
。本技能负责程序化生物身体、语义骨骼绑定、生物运动、姿态存储和重复种群表示。导入的glTF片段、重定向和VAT动画属于导入资源角色流水线。