Pages: [1]
  Print  
Author Topic: [OA3] how to EYES  (Read 11513 times)
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« on: October 04, 2014, 03:40:38 PM »

UNFINISHED

Currently 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 polys

Your 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 texture

If 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 config
OA3 reads eyes.cfg from your models/players/modelname directory.  This is an eyes configuration file
Code:
// 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 shaders

Make 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 ingame

You 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.
« Last Edit: October 04, 2014, 05:49:09 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
andrewj
Member


Cakes 24
Posts: 584



« Reply #1 on: October 04, 2014, 08:02:20 PM »

This is a pretty cool extension for the ol' idtech3 engine.

Did you consider using MD3 tags for the eye positions?
Logged
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #2 on: October 04, 2014, 08:20:55 PM »

Yes, though I prototyped using hard values in cgame first since it was so easy to adjust numbers there.  Having tag eyes would help the compatibility issue and they could have a default looking forward if they don't have an eyelookat vector at all or somehow take the client's angle regardless of head's angle in client rather than cgame. somehow


There's also an annoying bug with where the eyes look during death sequences.  I would have to do a tag on the torso to fix that so it overrides eyelookat in certain animation sequences, like death and taunt (so sarcastic rolling of eyes is supported).
« Last Edit: October 04, 2014, 08:25:17 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
revanic
VIP
Half-Nub


Cakes 4
Posts: 67


« Reply #3 on: October 04, 2014, 08:58:38 PM »

Pretty awesome! however, someone may want to have lopsided eyes. Perhaps add a left eye override that is only used when specified?
Logged
Pages: [1]
  Print  
 
Jump to: