BML Gaze Element
From smartbody
Contents |
BML <gaze> Element
The following BML behavior extends standard attributes and is only implemented in SmartBody BML.
SBM is currently transitioning from a early implementation of gaze to a new gaze control model. The following sections describe the shared high-level attributes, the current implementation, and a rough specification of the new attributes.
The Logical Spine
The gaze controller uses an abstracted spine model (a.k.a., a logical spine) of the joints and spine, and allows most modifier to be set for each of these 'key' positions. The key names are:
| EYES or OPTICAL | Both eyeball joints |
| HEAD or CRANIAL | The skull joint at the top of the spine |
| NECK or CERVICAL | The lowest vertebra of the neck (approximately C7) |
| CHEST or THORAX | The lowest vertebra of the ribcage (approximately T12) |
| BACK or LUMBAR | The lowest vertebra of the spine |
It is worth noting the keys are named after the joint closest to the pelvis within the anatomy they are named after. For the usual case, where the skeleton is supported at or below the pelvis, the key position has influence on the joints above it in the body part it is named. For example, a leftward turn of a single joint implicitly imposes a leftward shift in all joint above it by the parenting hierarchy of the skeleton / scene graph.
As modifiers are applied to the four key spine positions (i.e., not including the eyes), the modifier value is interpolated across the spine joints between the key positions. SBM uses spline interpolation, using the the four spine keys as the four spline knots. Modifiers are assign directly to each eyeball joint of the gaze controller.
Gaze Target
[Standard BML]
Every gaze behavior requires a target= attribute. Currently, the target must reference another character or pawn managed by the same SBM process. There are some early example implementations of pawns that track WSP locations, allowing characters to gaze at remotely controlled positions.
Example: Gaze command for doctor to look at elder.
<?xml version="1.0" encoding="UTF-8"?>
<act>
<bml>
<!-- Look at elder. -->
<gaze target="elder" />
</bml>
</act>
The gaze behavior, by default, will follow another character's left eyeball joint or the pawn's world_offset joint. The gaze behavior can track a different joint by following the target id with a colon (':') and the joint name.
Example: Gaze command to look at elder's right index fingertip. The joint name r_index4 can be found in the doctor's skeleton file.
<?xml version="1.0" encoding="UTF-8"?>
<act>
<bml>
<!-- Look at elder's right index fingertip -->
<gaze target="elder:r_index4" />
</bml>
</act>
Target Offset Attributes
[Standand BML]
Attribute direction is the direction of the gaze offset from the target. It can be one of:
| UP |
| DOWN |
| LEFT |
| RIGHT |
| UPLEFT |
| UPRIGHT |
| DOWNLEFT |
| DOWNRIGHT |
| POLAR <degrees> |
All relative directions are from the character's view. That is, DOWNRIGHT should offset the gaze 45 degrees between down and the character's right side.
POLAR is unique to SmartBody. In POLAR, <degrees> is a numerical angle, where zero is UP and positive is clockwise (so RIGHT is equivalent to POLAR 90). (This actually doesn't fit standard polar coordinates, where 0 aligns to the x-axis. This needs to be revisted.) All of these attributes are in the frame of reference of the character's waist. While the head frame might be more intuitive, the controls influence the head's location, resulting in the possibility of a feedback loop.
Attribute angle describes the amount of gaze offset in degrees, defaulting to 45. angle should always be positive.
I (Andrew) just noticed this default angle conflicts with standard BML's assumption of zero. That would mean, in standard BML, you could not define an offset without an angle. In contrast, Smartbody ignores angle if there is no direction, but assumes 45 degree angle if direction is specified without an angle.
Offset described with these attributes will distribute the offset across the whole spine (or at least the components activated by sbm:joint-range). In contrast, per-key attributes allow the author more control of the offset.
Roll via sbm:roll
[SmartBody Specific BML]
Attribute sbm:roll is a number in degrees clockwise for the final head roll angle. This attribute is distributed over the entire joint range. That is, in a default full spine gaze, a roll will affect the shoulders as well as the head.
The current implementation does not work well.
Joints Range
[SmartBody Specific BML]
The gaze behavior can be limited to a partial range of the eyes and spine. This is specified using the sbm:joints attributes. The value is an ordered list (back to eyes, or vice versa) of the key positions the gaze behavior will influence.
Example: Gaze command for the neck up, where HEAD is implied.
<?xml version="1.0" encoding="UTF-8"?>
<act>
<bml>
<!-- Look at elder; use only neck to eyes -->
<gaze target="elder" sbm:joint-range="NECK EYES" />
</bml>
</act>
In addition to defining a subset of the body for the gaze behavior, the sbm:joints attribute defines the key positions for which gaze modifiers can be applied to. The order of the declared keys is also the order of the values in the modifier attributes. This allows the gaze behavior element to describe nuances such as a roll in the neck and head, or a gradual blending of the underlying posture below the shoulders.
If not defined, the sbm:joint-range is assumed to be "BACK NECK EYES", thus involving the whole body, same as the joint speed and speed smoothing ordering.
Speed and Smoothing
[SmartBody Specific BML]
The attributes sbm:joint-speed and sbm:joint-smoothing adjust the maximum joint speed and joint speed smoothing, respectively. These can change the precieved urgency of a gaze change. The notation for each attribute is three numbers, one each for LUMBAR, CERVICAL, and EYES (respectively).
The defaults are:
sbm:joint-speed="0 360 2000" sbm:speed-smoothing="0.8 0.8 0.1"
Defaults can be adjusted via the commands set bp gaze speed and set bp gaze smoothing, each taking the same triplet of values.
For speed, larger numbers are faster (think of it as degrees-pre-second for the specific joint). Higher smoothing dampens this speed at onset and offset, such that more smoothing (closer to 1.0) may appear slower. Intermediate joints recieve values based on a linear interpolation of the bounding values (e.g., values for CHEST joints will be bound by the first and second values, LUMBAR and CERVICAL). Change: To more directly control the head speed, the LUMBAR and CERVICAL values will be summed and treated as a single value distributed across the entire spine. In the future, we will support single value (head speed only) and double value (head speed and eyeball speed) values.
Recommendations for a more intuitive model at the BML level are strongly appreciated.
Per-Key Offset Attributes
[SmartBody Specific BML]
Our controller currently supports target offsets for each joint key, allowing the character to assume different postures for the same target. These are two examples of its usage.
Example: Simple form using namespaced sub-elements
<gaze target="you">
<sbm:head pitch="10" heading="30"/>
<!-- other joints assume default zero offset -->
</gaze>
Example: Form compliant with proposed BML description levels
<gaze target="you">
<description level="1" type="ISI.SBM">
<head pitch="10" heading="30"/>
<!-- other joints assume default zero offset -->
</description>
</gaze>

