How to Add Eye Posing to a Model

Hello and welcome to my eye posing implementation tutorial!

In this tutorial I will be showing you how to add eye posing to your ragdolls/player models.

To begin, you will need the following:

-QC Eyes (comes with Source SDK, Source Filmmaker, Team Fortress 2 or most Source games made by Valve).
-3D modeling program of your choice (3Ds Max, Maya, Blender, Milkshape 3D, etc.).
-Compiler (Crowbar, GUIStudioMDL, Cannonfodder’s MDL Compiler, etc.).

Note that this tutorial is using 3Ds Max 2011. Some of the tools discussed in this tutorial might be different or non-existant in your 3D modeling program.

If you meet the following requirements then you are ready to start following the tutorial!

To begin, start off by opening your 3D modeling program and loading up your desired model.

http://puu.sh/7kjDK.jpg

**Now that your model is loaded, navigate over to the Modify

http://puu.sh/7kk4J.png

tab.**

http://puu.sh/7kk2r.png

**Select Editable Mesh (or whatever you have there) and select Vertex

http://puu.sh/7kkjG.png

tool.**

http://puu.sh/7kkod.png

Your model should now look like this.

http://puu.sh/7kksp.jpg

Zoom in so you have a better view of the model’s face and select the vertex closest to the center of the eye.
My model doesn’t have any vertexes in the center, but it is a head hack so I can just copy over the coordinates from the original Half-Life 2 model.
Press F3 in order to see wireframe over you model’s mesh.

http://puu.sh/7kkTB.jpg

If you are not able to select the center vert then you must flatten the eye mesh for models with round eyes (most games) and create spheres where you want the eyes to be and grab the vertex data from that.

Once you select the vertex closest to the center of the eye, open up QC Eyes.

http://puu.sh/7kl9t.png

What we need to worry about is this part:

http://puu.sh/7klm2.png

For this, all you need to do this simply copy the coordinates for your model’s vertex (the center of the eye).
You must do this for both eyes or else it won’t work.

http://puu.sh/7klFI.png

COPY EXACTLY WHAT THIS WINDOW SAYS!!!
Do not copy from the picture above, copy from your actual window.

Do the same for the other eye and you are almost done! :dance:

What it should look like now:

http://puu.sh/7klVB.png

These values are made up so don’t copy them.

Last thing before you exit anything. Make sure to tick this box if you’re on 3Ds Max.

http://puu.sh/7km4h.png

http://puu.sh/7km62.png

For the rest of the options listed there, fill them out accordingly to match your model’s .qc file.

Now you’re ready to generate the code required by the Source engine to be able to pose your model’s eyes.

http://puu.sh/7kmtA.png

http://puu.sh/7kmoK.png

Click the button that looks like this to copy the code.

http://puu.sh/7kmpw.png

Paste it into your .qc file and make sure it is under the $model and {.

http://puu.sh/7kmGI.png

You have now added eye posing to your model! Congratulations! :slight_smile:

Video representation created by Mariokart64n for his ragdolling guide but an easier way to explain how eye posing is made.

I’ve also written extensively on this subject, and made a lightweight version of qceyes that just spits out the relevant code, and is fully annotated with tooltips, if you’re looking for more on the subject.

Good work! Very useful.

Will this all work, if model doesn’t have a separate eye texture?

Not sure about you but if you don’t want foggy looking eyes or eyes that don’t track and move
(insert picture reference here)

I’d suggest setting the Y position to something like this

http://puu.sh/7kPcd.png

if the eye sphere doesn’t have a vert there pull back the front vert and grab it’s Y value

I don’t know why you’re getting disagrees because this is exactly the correct way to get the correct position form an existing hemisphere for the shader.

After you do that, you’ll want to replace it with flat-ish planes though.

No. Valve eyes are shader based. You’ll need a left and right eye texture that use eyerefract.

Yeah no idea whats up with that you two?

Also yeah flattening the eyeballs is a must then setting $maxeyedeflection to 30 or 50 alongside the raytrace option in the vmt to 1 fixes that werid double rendering of the iris if you look at it from the side people tend to just turn that thing off

I’ve heard of that method but never used it myself. I might start using it more often.