vrm-c / vrm-specification

vrm specification
235 stars 37 forks source link

LookAt cannot be implemented #384

Closed avaer closed 1 year ago

avaer commented 2 years ago

As far as I can tell, there is no way to cleanroom implement lookAt part of this specification because it doesn't fully specify the details.

For example, the types in https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0-beta/lookAt.md#lookat are not known (could be Array or float or {x, y, z}).

I found a schema elsewhere: https://github.com/vrm-c/vrm-specification/blob/43cfae56a0a1ba570e088bfe217f1c96a6a05ce0/specification/VRMC_vrm-1.0-beta/schema/VRMC_vrm.lookAt.schema.json but it should probably be inline with the explanations.

I also find the algorithm specification to be too vague to implement correctly: https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0-beta/lookAt.md#lookat-algorithm

Lines like:

have multiple reasonable geometric interpretations, but probably only one of them is correct and it's not clear which. Euler angles are used but the Euler order doesn't seem to be specified.

I suspect that two developers with two engines would implement this math quite differently, which is not a desirable property. This could be corrected with full pseudocode of the algorithm that is not tied to any engine.

ousttrue commented 2 years ago

Thank you for your advice.

I will organize and rewrite it from now on. The following chapters are planned.

  1. LookAt space definition. The LookAt space is defined from the head bone and the initial posture. Evaluate the gaze point relatively in this space. Convert the gaze point to yaw, pitch. pseudocode EulerAngle definition, rotation orientation as rightHanded.

  2. Apply Yaw, Pitch. a. bone type pseudocode => EulerAngle definition b. morph target type pseudocode c. uv offset type pseudocode

  3. Range adjustment.

    • Maximum input value (yaw, ptich). When the input value reaches this value, the eyes reach the edge and do not move any further.
    • Maximum applicable value. Maximum rotation value of the model's eyes(bone, morph target weight, uv offset).
ousttrue commented 2 years ago

fixed description automatically closes github

ousttrue commented 2 years ago

The lookat documentation has been updated.

If you have any questions, please point them out.

@avaer

lalalune commented 1 year ago

You can close this, we have this implemented in Webaverse :)