Skip to content

Draft: VRMC_springBone_limit - #496

Draft
0b5vr wants to merge 25 commits into
vrm-c:masterfrom
0b5vr:springBone-limit
Draft

Draft: VRMC_springBone_limit#496
0b5vr wants to merge 25 commits into
vrm-c:masterfrom
0b5vr:springBone-limit

Conversation

@0b5vr

@0b5vr 0b5vr commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

This is the first draft of VRMC_springBone_limit.

Added the Japanese spec and the schema, English spec is just a placeholder.

Added the Japanese spec and the schema, English spec is just a placeholder
@0b5vr 0b5vr added the enhancement New feature or request label Feb 27, 2025
@0b5vr 0b5vr self-assigned this Feb 27, 2025
ousttrue
ousttrue previously approved these changes Feb 28, 2025
phi ranges from -PI to PI, theta ranges from -PI/2 to PI/2
@0b5vr
0b5vr force-pushed the springBone-limit branch 3 times, most recently from 658ceed to 2eacd64 Compare April 18, 2025 06:22
@0b5vr
0b5vr force-pushed the springBone-limit branch from 2eacd64 to 97fdf66 Compare April 18, 2025 06:23
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Apr 18, 2025
The implementation of the cone limit and its helper

TODOs:

- implement hinge limit
- implement polar limit
- implement loader plugin support for the limits

See: vrm-c/vrm-specification#496
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Apr 18, 2025
The implementation of the hinge limit and its helper

I believe the current `calculateLimit` implementation has the improvement window

TODOs:

- implement polar limit
- implement loader plugin support for the limits

See: vrm-c/vrm-specification#496
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Apr 18, 2025
The implementation of the spherical limit and its helper

TODOs:

- implement loader plugin support for the limits

See: vrm-c/vrm-specification#496
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Apr 18, 2025
set `useLimits` to `false` if you want to check the fallback behavior

See: vrm-c/vrm-specification#496
ousttrue
ousttrue previously approved these changes Apr 22, 2025

@ousttrue ousttrue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


以下に、本拡張で定義する各リミットの参考実装を示します。

以下の参考実装において `tailDir` は、制限するjointの向きです。 `tailDir` は正規化されているものとします。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tailDir が突然出てくる感じがします。
node.rotation もしくは node.localRotation から話が始まるべきと思います。
もしくは既存の springBone 計算の中間値を使っているなら
それが出てくる過程も書いておく方がよいと思います。
要するに、コピペしてから使うところまでが遠いです。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確かに。それでいうと後者で、SpringBoneの計算過程で利用している (nextTail - worldPosition).normalizedtailDir になると思います。
VRMC_springBone 仕様側の擬似コードにも (nextTail - worldPosition).normalized には登場するので、これを言及する形に書き換えますね。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下のコミットで書き換えてみましたが、いかがでしょうか?
9e98e83


```ts
// Y+方向からjointのheadからtailに向かうベクトルへの最小回転
let axisRotation = fromToQuaternion(vec3(0, 1, 0), boneAxis);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boneAxis の意味を類推する必要があって、
難解になっているような。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

フィードバックありがとうございます。 boneAxis については、 VRMC_springBone 側の擬似コードでも定義されている「そのJointが対象とする子Nodeの、ローカル空間におけるレスト状態の伸びる方向」ですが、改めてこちらの文書でも説明することとします。

@0b5vr 0b5vr Jul 16, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

04b0db9 で対応しました。


### ConeLimit

以下は、擬似コードによるコーンリミットの参考実装です。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

tailDir の導出が済んでいれば、異なるシステムでもコピペと微修正で使えそうです。
tailDir の導出は作業中(後でやる)です。

tailDir = tailDir.normalized;

// tailDirのy要素をjointに設定されたangleの余弦と比較する
let cosAngle = cos(joint.angle);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

joint => limitParam など limit の設定値であることが見た目に分かる名前の方がわかりやすいと思われます。後続も同様です。

@0b5vr 0b5vr Jul 16, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確かに、これは limit.angle のほうがより適切ですね。修正します。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1a14366 で対応しました。

@ousttrue

Copy link
Copy Markdown
Contributor

実装してみたところ、各ロジックについて Json に記述された角度を 0.5 して適用すると Gizmo とぴったりになるようです。
設定 UI では扇形の両端の角度を設定して Json に記述しますが、計算上は tangent するので半分しか要らないという解釈問題が
ありそうです。

@ousttrue

Copy link
Copy Markdown
Contributor

仕様誤解判明。
limit.angle は中心線からの傾き角度を指している(結果的に錐の0.5倍の角度)

…s of spherical limit

While cone limit and hinge limit explicitly define that the parameter angles are the maximum angles allowed from the reference direction, spherical limit were vague about it
…al limit angles to pitch-yaw instead of phi-theta

phi-theta can be confusing since there are multiple conventions; we instead simply follow the well-used notation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 limit 空間の x軸回転が pitch

ousttrue
ousttrue previously approved these changes Sep 26, 2025

@ousttrue ousttrue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

… 180deg around x axis when the boneAxis is exactly (0, -1, 0) since the minimal rotation is indeterminate

also update the pseudocode to more primitive way and that reflects the spec update
the cross production was incorrect
(0, 1, 0) × (x, y, z) = (z, 0, -x)
Clamp cone and hinge angles to [0, pi], spherical pitch to [0, pi],
and spherical yaw to [0, pi/2] before applying the limits.

This keeps the reference implementation consistent with the documented
lower and upper bounds.
…k directions for singular cases

Limit projections can be indeterminate when the tail points along axes
that lose the directional component required by a limit.

Define deterministic local-space fallback directions for cone, hinge,
and spherical limits, and update the reference pseudocode to avoid zero
divisions and undefined angles.

Keep the pseudocode mathematically exact while recommending that
implementations apply precision-appropriate floating-point safeguards.
Limit evaluation may be reduced or disabled depending on the target
platform, runtime settings, or LOD requirements.

Clarify that the recommended application timings apply when limit
evaluation is enabled, and note that the final tail direction is not
guaranteed to remain within the limit when evaluation is reduced or
disabled.
…on terminal joints

The terminal joint in a spring chain acts only as the tail, so a limit
attached to it cannot affect the simulation.

Require implementations to ignore the extension on terminal joints and
exporters to omit it from those joints.
The specVersion and exactly-one limit requirements were already
expressed in the property descriptions and JSON Schema, but their
normative strength was not explicit in the text.

Mark both requirements as MUST to make conformance expectations
unambiguous without changing the schema.
…e constraints

Normative requirements were not consistently emphasized, and the angle
constraints did not state their RFC 2119 strength explicitly.

Bold all RFC 2119 keywords and mark the non-negative angle requirements
and upper-bound interpretation rules as MUST for cone, hinge, and
spherical limits.
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Aug 5, 2026
The implementation of the cone limit and its helper

TODOs:

- implement hinge limit
- implement polar limit
- implement loader plugin support for the limits

See: vrm-c/vrm-specification#496
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Aug 5, 2026
The implementation of the hinge limit and its helper

I believe the current `calculateLimit` implementation has the improvement window

TODOs:

- implement polar limit
- implement loader plugin support for the limits

See: vrm-c/vrm-specification#496
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Aug 5, 2026
The implementation of the spherical limit and its helper

TODOs:

- implement loader plugin support for the limits

See: vrm-c/vrm-specification#496
0b5vr added a commit to pixiv/three-vrm that referenced this pull request Aug 5, 2026
set `useLimits` to `false` if you want to check the fallback behavior

See: vrm-c/vrm-specification#496
0b5vr added 3 commits August 21, 2026 14:35
Translation produced by GPT-5.6 Sol as-is. The wording and technical terminology may be reviewed and adjusted in follow-up commits
Improve the English and Japanese documentation without changing any normative requirements or behavior.

- Restructure the descriptions to separate each limit's local shape from the common rotation procedure
- Clarify the explanation of the default orientation and `rotation` application order
- Clarify the descriptions of `nextTail`, `tailDir`, and the cone pseudocode
- Remove the duplicated inline root schema
- Fix schema links to match the actual filenames
@0b5vr

0b5vr commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

英訳の追加 #514 ならびに文意の改善を行いました。Normative changesは含まれません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: To do

Development

Successfully merging this pull request may close these issues.

2 participants