UNFINISHEDCurrently OA3 is not released, but the code is out there!
FACTS:- OA3 eyes are not sphere meshes that rotate and turn. They are polygons with UVmaps calculated dynamically.
- Q3 mods can't use this since the method currently uses cgame to give the eye source target vectors to the engine.
You'll need:- Compiled
OpenArena/Engine binary
- Compiled
OpenArena/leixperimental QVMs
- Some creative experience with a [insert 3d modeling suite that can export MDR/MD3 here] because i'm not going to hold your hand on making a complete character
1. Create your eye polysYour eyes should be done in a new 'special' head mesh that should be exported with a different name, like headhi.md3 (NOTE: loading headhi.* is not implemented in cgame yet, but would be to retain compatibility with mods that don't support eyes)
You don't have to alter the uvmaps of your eyes, but just keep each eye with their own material/surface so the special eye shaders can work.
2. Creating the eye textureIf your character needs to have a unique eyeball texture you can create an eye texture. OA3's eye textures are stored in
gfx/fx/eyes/
where they'll be isolated from the player models into a common place where eyes can go.
The iris and pupil must be located in the center of the image, and the rest of the texture should be the sclera.
Suggested resolution is 128x128
Unlike Source engine, you can use one eye texture for both eyes and it will work.
3. Write the configOA3 reads eyes.cfg from your models/players/modelname directory. This is an eyes configuration file
// Eyes positions, loaded separately to not muck with animations on mods that don't recognize this key.
eyes 2.10298 1.45542 3.39689
The values following the word 'eyes' are X, Y, Z coordinates for the right eye. X is flipped for the other eye and uses the same Y and Z coordinates automatically.
You can make these coordinates easily by making a sphere, then moving the sphere in Object Mode into your model's eye socket, and fitting that sphere in place.
You can then use the origin values from its transformed position for your eyes config.
(This method can also apply to Source Engine btw)
4. Write the eyes shadersMake one shader for each eye, but the difference in the two are the tcGens they use
....
tcGen eyeleft
...
tcGen eyeright
For best results you should use clampmap for the texture so there will be no repeating eyes of horror (unless you want that)
5. TESTING ingameYou should use cg_cameramode 1 and cg_thirdPerson 1 to orbit around your character without turning the model. If things are done right, the eyes should now be looking to where you're actually aiming.