Difference between revisions of "Eye Position Setup"
m (added link to .QC commands) |
m (Changed Perspective from second to third person) |
||
(19 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{otherlang2 | ||
+ | |jp=Eye_Position_Setup:jp | ||
+ | }} | ||
+ | {{cleanup}} | ||
[[Category:Modeling]] | [[Category:Modeling]] | ||
− | Before compiling your run-time character, | + | Before compiling your run-time character, setting up the proper eye position data is needed. If the model is modified later but the eyes are left in pretty much the same position changing the eye settings shouldn't be needed. |
− | This is what the eye data looks like for one of | + | This is what the eye data looks like for one of the female models: |
<pre> | <pre> | ||
Line 12: | Line 16: | ||
$attachment "mouth" "ValveBiped.Bip01_Head1" 0.10 -5.70 0.00 rotate 0 -80 -90 | $attachment "mouth" "ValveBiped.Bip01_Head1" 0.10 -5.70 0.00 rotate 0 -80 -90 | ||
$attachment "chest" "ValveBiped.Bip01_Spine2" 4.00 4.00 0.00 rotate 0 95 90 | $attachment "chest" "ValveBiped.Bip01_Spine2" 4.00 4.00 0.00 rotate 0 95 90 | ||
+ | // the following attachment (forward) to enable eye movement and facial animations when using sdk models | ||
+ | // as model for generic_actor entity. It may not be needed for hl2mp sdk models | ||
+ | $attachment "forward" "ValveBiped.Bip01_Head1" 0.0 0.0 0.0 0 -80 -90 | ||
$model female_06 "female_06_reference.smd"{ | $model female_06 "female_06_reference.smd"{ | ||
Line 34: | Line 41: | ||
</pre> | </pre> | ||
− | + | the applet QCEyes can be used to format the eye data, or do it manually as described below. | |
− | + | {{note|Before starting move the eye spheres to the appropriate location for your model and make sure to '''Freeze All Transforms'''.}} | |
− | To get the eye position data from the model, do the | + | To get the eye position data from the model, do the following; |
− | + | <ol><li>Get the position of the center point on each eye in all 3 axes (be sure to "Freeze All Transforms" on the eye reference spheres first.) | |
− | {| | + | {| class=standard-table |
|Righteye_center_X<br>Righteye_center_Y || [[Image:eye_XY_R.jpg]] | |Righteye_center_X<br>Righteye_center_Y || [[Image:eye_XY_R.jpg]] | ||
|- | |- | ||
Line 50: | Line 57: | ||
|- | |- | ||
|Lefteye_center_Z || [[Image:eye_Z_L.jpg]] | |Lefteye_center_Z || [[Image:eye_Z_L.jpg]] | ||
− | |} | + | |} |
+ | </li> | ||
+ | <li>Get the position on the Y axis for the center point of each eyelid in its default position, raised position and lowered position (if the character is relatively symmetrical use the positions from one eye for both eyes). | ||
− | + | {| class=standard-table | |
− | |||
− | {| | ||
|Right_upper_def (upper eyelid, frame 0) || [[Image:eye_upper_mid.jpg]] | |Right_upper_def (upper eyelid, frame 0) || [[Image:eye_upper_mid.jpg]] | ||
|- | |- | ||
Line 79: | Line 86: | ||
|Left_lower_hi (lower eyelid, frame 4) || [[Image:eye_lower_hi.jpg]] | |Left_lower_hi (lower eyelid, frame 4) || [[Image:eye_lower_hi.jpg]] | ||
|} | |} | ||
− | + | </li> | |
− | + | <li>Once the position data for the eyeballs and eyelids has been aquired, as listed above, do some simple arithmetic to get the following values: | |
− | {| | + | {| class=standard-table |
| <code>X_avg_pos</code> || The average of Righteye_center_X and Lefteye_center_X | | <code>X_avg_pos</code> || The average of Righteye_center_X and Lefteye_center_X | ||
|- | |- | ||
Line 114: | Line 121: | ||
|} | |} | ||
− | + | {{note|The axes in XSI are rotated 90 degrees CCW about the X axis from the Source Engine axes.<br/>A triplet ['''X''', '''Y''', '''Z'''] in XSI becomes ['''X''', '''-Z''', '''Y'''] in Source.<br/>Please note the change in sign necessary for the '''Z''' value.}}</li> | |
+ | |||
+ | <lI>Now format the eye position data as shown below: | ||
<pre> | <pre> | ||
Line 121: | Line 130: | ||
// head controllers | // head controllers | ||
− | $attachment "eyes" "ValveBiped.Bip01_Head1" X_avg_pos Z_avg_pos Y_avg_pos absolute | + | $attachment "eyes" "ValveBiped.Bip01_Head1" X_avg_pos -Z_avg_pos Y_avg_pos absolute |
$attachment "mouth" "ValveBiped.Bip01_Head1" 0.10 -5.70 0.00 rotate 0 -80 -90 | $attachment "mouth" "ValveBiped.Bip01_Head1" 0.10 -5.70 0.00 rotate 0 -80 -90 | ||
$attachment "chest" "ValveBiped.Bip01_Spine2" 4.00 4.00 0.00 rotate 0 95 90 | $attachment "chest" "ValveBiped.Bip01_Spine2" 4.00 4.00 0.00 rotate 0 95 90 | ||
$model female_06 "female_06_reference.smd" { | $model female_06 "female_06_reference.smd" { | ||
− | eyeball righteye "ValveBiped.Bip01_Head1" Righteye_center_X Righteye_center_Z Righteye_center_Y "eyeball_r" 1 4 "pupil_r" 0.63 | + | eyeball righteye "ValveBiped.Bip01_Head1" Righteye_center_X -Righteye_center_Z Righteye_center_Y "eyeball_r" 1 4 "pupil_r" 0.63 |
− | eyeball lefteye "ValveBiped.Bip01_Head1" Lefteye_center_X Lefteye_center_Z Lefteye_center_Y "eyeball_l" 1 -4 "pupil_l" 0.63 | + | eyeball lefteye "ValveBiped.Bip01_Head1" Lefteye_center_X -Lefteye_center_Z Lefteye_center_Y "eyeball_l" 1 -4 "pupil_l" 0.63 |
eyelid upper_right "female_06_expressions" lowerer 1 R_lid_up_lo neutral 0 R_lid_up_def raiser 2 R_lid_up _hi split 0.1 eyeball righteye | eyelid upper_right "female_06_expressions" lowerer 1 R_lid_up_lo neutral 0 R_lid_up_def raiser 2 R_lid_up _hi split 0.1 eyeball righteye | ||
Line 145: | Line 154: | ||
//end eye/face data | //end eye/face data | ||
</pre> | </pre> | ||
+ | </li></ol> | ||
− | + | ==See also== | |
* [[.QC Commands#New $model Option]] - eyeball, eyelid command details. | * [[.QC Commands#New $model Option]] - eyeball, eyelid command details. | ||
+ | |||
+ | |||
+ | I believe there is an error in Step #3, the instructions state: | ||
+ | |||
+ | Once you've acquired the position data for the eyeballs and eyelids, as listed above, you'll need to do some simple arithmetic to get the following values: | ||
+ | |||
+ | |||
+ | |||
+ | X_avg_pos = The average of Righteye_center_X and Lefteye_center_X | ||
+ | |||
+ | |||
+ | Y_avg_pos = The average of Righteye_center_Y and Lefteye_center_Y | ||
+ | |||
+ | |||
+ | Z_avg_pos = The average of Righteye_center_Z and Lefteye_center_Z | ||
+ | |||
+ | |||
+ | R_lid_up_hi = Right_upper_hi - Righteye_center_Y | ||
+ | |||
+ | |||
+ | |||
+ | R_lid_up_def = Right_upper_def - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_up_lo = Right_upper_lo - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_low_hi = Right_upper_hi - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_low_def = Right_upper_def - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_low_lo = Right_upper_lo - Righteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_up_hi = Left_upper_hi - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_up_def = Left_upper_def - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_up_lo = Left_upper_lo - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_low_hi = Left_upper_hi - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_low_def = Left_upper_def - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_low_lo = Left_upper_lo - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | The averages are fine but you might notice that from the fourth row down, the second column consists of all "upper" lid points (even when the description is for a lower lid) which also means each equation is repeated twice | ||
+ | |||
+ | |||
+ | (ex. R_lid_'''up''' hi = ''Right_'''upper'''_hi - Righteye_center_Y'') | ||
+ | |||
+ | (ex. R_lid_'''low'''_hi = ''Right_'''upper'''_hi - Righteye_center_Y'') | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | This means that you would actually be repeating the point values and they wouldn't give the correct information. So basically, some of the "uppers" need to be changed to "lowers". The correct equations summary should look like this: | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | X_avg_pos = The average of Righteye_center_X and Lefteye_center_X | ||
+ | |||
+ | |||
+ | Y_avg_pos = The average of Righteye_center_Y and Lefteye_center_Y | ||
+ | |||
+ | |||
+ | Z_avg_pos = The average of Righteye_center_Z and Lefteye_center_Z | ||
+ | |||
+ | |||
+ | R_lid_up_hi = Right_upper_hi - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_up_def = Right_upper_def - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_up_lo = Right_upper_lo - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_low_hi = Right_'''lower'''_hi - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_low_def = Right_'''lower'''_def - Righteye_center_Y | ||
+ | |||
+ | |||
+ | R_lid_low_lo = Right_'''lower'''_lo - Righteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_up_hi = Left_upper_hi - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_up_def = Left_upper_def - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_up_lo = Left_upper_lo - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_low_hi = Left_'''lower'''_hi - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_low_def = Left_'''lower'''_def - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | L_lid_low_lo = Left_'''lower'''_lo - Lefteye_center_Y | ||
+ | |||
+ | |||
+ | The bolded words are the ones that were changed. It is a simple error with a simple fix. I caught the error before I actually compiled my character and my fixed outcome was correct so I'm not exactly sure what will happen if you use all "uppers" and repeat points. If anyone else has related information please let me know. Basically, it's important to keep your eyelid points correctly organized so that when it comes time to compile in your eye data you get what you're expecting (not some crazy googly eyes, ha ha). |
Latest revision as of 08:22, 3 November 2011
![]() |
This article needs to be cleaned up to conform to a higher standard of quality.
|
Before compiling your run-time character, setting up the proper eye position data is needed. If the model is modified later but the eyes are left in pretty much the same position changing the eye settings shouldn't be needed.
This is what the eye data looks like for one of the female models:
//start eye/face data $eyeposition 0 0 70 // head controllers $attachment "eyes" "ValveBiped.Bip01_Head1" 0.002 -3.6165 65.0652 absolute $attachment "mouth" "ValveBiped.Bip01_Head1" 0.10 -5.70 0.00 rotate 0 -80 -90 $attachment "chest" "ValveBiped.Bip01_Spine2" 4.00 4.00 0.00 rotate 0 95 90 // the following attachment (forward) to enable eye movement and facial animations when using sdk models // as model for generic_actor entity. It may not be needed for hl2mp sdk models $attachment "forward" "ValveBiped.Bip01_Head1" 0.0 0.0 0.0 0 -80 -90 $model female_06 "female_06_reference.smd"{ eyeball righteye "ValveBiped.Bip01_Head1" -1.2783 -3.6165 65.0663 "eyeball_r" 1 4 "pupil_r" 0.63 eyeball lefteye "ValveBiped.Bip01_Head1" 1.2823 -3.6165 65.0642 "eyeball_l" 1 -4 "pupil_l" 0.63 eyelid upper_right "female_06_expressions" lowerer 1 -0.2275 neutral 0 0.1475 raiser 2 0.2559 split 0.1 eyeball righteye eyelid lower_right "female_06_expressions" lowerer 3 -0.2879 neutral 0 -0.2046 raiser 4 -0.0462 split 0.1 eyeball righteye eyelid upper_left "female_06_expressions" lowerer 1 -0.2275 neutral 0 0.1475 raiser 2 0.2559 split -0.1 eyeball lefteye eyelid lower_left "female_06_expressions" lowerer 3 -0.2879 neutral 0 -0.2046 raiser 4 -0.0462 split -0.1 eyeball lefteye mouth 0 "mouth" "ValveBiped.Bip01_Head1" 0 1 0 // mouth illumination flexfile "Female_06_expressions" { $include "../../standardflex_xsi.qci" } $include "../../facerules_xsi.qci" $include "../../bodyrules_xsi.qci" } //end eye/face data
the applet QCEyes can be used to format the eye data, or do it manually as described below.

To get the eye position data from the model, do the following;
- Get the position of the center point on each eye in all 3 axes (be sure to "Freeze All Transforms" on the eye reference spheres first.)
Righteye_center_X
Righteye_center_YRighteye_center_Z Lefteye_center_X
Lefteye_center_YLefteye_center_Z - Get the position on the Y axis for the center point of each eyelid in its default position, raised position and lowered position (if the character is relatively symmetrical use the positions from one eye for both eyes).
- Once the position data for the eyeballs and eyelids has been aquired, as listed above, do some simple arithmetic to get the following values:
X_avg_pos
The average of Righteye_center_X and Lefteye_center_X Y_avg_pos
The average of Righteye_center_Y and Lefteye_center_Y Z_avg_pos
The average of Righteye_center_Z and Lefteye_center_Z R_lid_up_hi
Right_upper_hi - Righteye_center_Y R_lid_up_def
Right_upper_def - Righteye_center_Y R_lid_up_lo
Right_upper_lo - Righteye_center_Y R_lid_low_hi
Right_upper_hi - Righteye_center_Y R_lid_low_def
Right_upper_def - Righteye_center_Y R_lid_low_lo
Right_upper_lo - Righteye_center_Y L_lid_up_hi
Left_upper_hi - Lefteye_center_Y L_lid_up_def
Left_upper_def - Lefteye_center_Y L_lid_up_lo
Left_upper_lo - Lefteye_center_Y L_lid_low_hi
Left_upper_hi - Lefteye_center_Y L_lid_low_def
Left_upper_def - Lefteye_center_Y L_lid_low_lo
Left_upper_lo - Lefteye_center_Y Note: The axes in XSI are rotated 90 degrees CCW about the X axis from the Source Engine axes.
A triplet [X, Y, Z] in XSI becomes [X, -Z, Y] in Source.
Please note the change in sign necessary for the Z value. - Now format the eye position data as shown below:
//start eye/face data $eyeposition 0 0 70 // head controllers $attachment "eyes" "ValveBiped.Bip01_Head1" X_avg_pos -Z_avg_pos Y_avg_pos absolute $attachment "mouth" "ValveBiped.Bip01_Head1" 0.10 -5.70 0.00 rotate 0 -80 -90 $attachment "chest" "ValveBiped.Bip01_Spine2" 4.00 4.00 0.00 rotate 0 95 90 $model female_06 "female_06_reference.smd" { eyeball righteye "ValveBiped.Bip01_Head1" Righteye_center_X -Righteye_center_Z Righteye_center_Y "eyeball_r" 1 4 "pupil_r" 0.63 eyeball lefteye "ValveBiped.Bip01_Head1" Lefteye_center_X -Lefteye_center_Z Lefteye_center_Y "eyeball_l" 1 -4 "pupil_l" 0.63 eyelid upper_right "female_06_expressions" lowerer 1 R_lid_up_lo neutral 0 R_lid_up_def raiser 2 R_lid_up _hi split 0.1 eyeball righteye eyelid lower_right "female_06_expressions" lowerer 3 R_lid_low_lo neutral 0 R_lid_low_def raiser 4 R_lid_low _hi split 0.1 eyeball righteye eyelid upper_left "female_06_expressions" lowerer 1 L_lid_up_lo neutral 0 L_lid_up_def raiser 2 L_lid_up _hi split -0.1 eyeball lefteye eyelid lower_left "female_06_expressions" lowerer 3 L_lid_low_lo neutral 0 L_lid_low_def raiser 4 L_lid_low split -0.1 eyeball lefteye mouth 0 "mouth" "ValveBiped.Bip01_Head1" 0 1 0 // mouth illumination flexfile "Female_06_expressions" { $include "../../standardflex_xsi.qci" } $include "../../facerules_xsi.qci" $include "../../bodyrules_xsi.qci" } //end eye/face data
See also
- .QC Commands#New $model Option - eyeball, eyelid command details.
I believe there is an error in Step #3, the instructions state:
Once you've acquired the position data for the eyeballs and eyelids, as listed above, you'll need to do some simple arithmetic to get the following values:
X_avg_pos = The average of Righteye_center_X and Lefteye_center_X
Y_avg_pos = The average of Righteye_center_Y and Lefteye_center_Y
Z_avg_pos = The average of Righteye_center_Z and Lefteye_center_Z
R_lid_up_hi = Right_upper_hi - Righteye_center_Y
R_lid_up_def = Right_upper_def - Righteye_center_Y
R_lid_up_lo = Right_upper_lo - Righteye_center_Y
R_lid_low_hi = Right_upper_hi - Righteye_center_Y
R_lid_low_def = Right_upper_def - Righteye_center_Y
R_lid_low_lo = Right_upper_lo - Righteye_center_Y
L_lid_up_hi = Left_upper_hi - Lefteye_center_Y
L_lid_up_def = Left_upper_def - Lefteye_center_Y
L_lid_up_lo = Left_upper_lo - Lefteye_center_Y
L_lid_low_hi = Left_upper_hi - Lefteye_center_Y
L_lid_low_def = Left_upper_def - Lefteye_center_Y
L_lid_low_lo = Left_upper_lo - Lefteye_center_Y
The averages are fine but you might notice that from the fourth row down, the second column consists of all "upper" lid points (even when the description is for a lower lid) which also means each equation is repeated twice
(ex. R_lid_up hi = Right_upper_hi - Righteye_center_Y)
(ex. R_lid_low_hi = Right_upper_hi - Righteye_center_Y)
This means that you would actually be repeating the point values and they wouldn't give the correct information. So basically, some of the "uppers" need to be changed to "lowers". The correct equations summary should look like this:
X_avg_pos = The average of Righteye_center_X and Lefteye_center_X
Y_avg_pos = The average of Righteye_center_Y and Lefteye_center_Y
Z_avg_pos = The average of Righteye_center_Z and Lefteye_center_Z
R_lid_up_hi = Right_upper_hi - Righteye_center_Y
R_lid_up_def = Right_upper_def - Righteye_center_Y
R_lid_up_lo = Right_upper_lo - Righteye_center_Y
R_lid_low_hi = Right_lower_hi - Righteye_center_Y
R_lid_low_def = Right_lower_def - Righteye_center_Y
R_lid_low_lo = Right_lower_lo - Righteye_center_Y
L_lid_up_hi = Left_upper_hi - Lefteye_center_Y
L_lid_up_def = Left_upper_def - Lefteye_center_Y
L_lid_up_lo = Left_upper_lo - Lefteye_center_Y
L_lid_low_hi = Left_lower_hi - Lefteye_center_Y
L_lid_low_def = Left_lower_def - Lefteye_center_Y
L_lid_low_lo = Left_lower_lo - Lefteye_center_Y
The bolded words are the ones that were changed. It is a simple error with a simple fix. I caught the error before I actually compiled my character and my fixed outcome was correct so I'm not exactly sure what will happen if you use all "uppers" and repeat points. If anyone else has related information please let me know. Basically, it's important to keep your eyelid points correctly organized so that when it comes time to compile in your eye data you get what you're expecting (not some crazy googly eyes, ha ha).