Eye rendering

Started by
3 comments, last by vonsatan 20 years, 9 months ago
Whats the best technique for rendering realistic eyes on GF4 level cards??
Blah....
Advertisement
It really depends on whether you are drawing them from far away or up close. I assume we''re talking about up close, and only the eyeballs.

I haven''t done much with shaders, but here''s my thoughts for drawing nearby eyes.

Eyes are reasonably simple objects graphically: They are damn-near spherical, and have a reasonably uniform coating providing reasonably uniform reflectivity.

I would guess that the reflectivity is highly specular, low diffuse, and medium-high ambient.

I would just use a sphere-primitive with an eye texture, and basic reflectivities. No special features necessary.

If you''re really needing detail, you may want to have the iris/pupil expand and contract. Maybe you want multiple textures here.

Also, if you''re after detail, set the textured sphere a bit behind the reflection sphere, and flatten the textured sphere a little near the pupil.

Of course you want to make sure the eyes point towards something. This can easily be accomplished by a matrix rotation, no special features neccessary.
sphere with a really really nice texture, I''d suggest taking a picture of your own eye. Then apply a highly transparent, barely visable environment map over the eye.

I''m sure there are other better ways to do it but this is fairly simple.
~Wave
Take a look around for some of the HL2 interviews. The eyes in the HL2 characters are particulalrly impressive, IMHO, and I seem to recall an interview with Gabe Newell or another of the Valve crew where he gives a few details on the eye modelling/rendering. Can''t recall where it was at unfortunately, but it shouldn''t be too hard to find.
vonsatan: How detailed do you want? - if the camera is up close you could go into extreme detail. If it''s a far away shot, the eyes could be as simple as just being drawn into textures. Simple spheres might do for medium/lower detail level shots.

To go into detail, the best thing to do is find a resource giving details of how an eye is made up (i.e. a biology or optics website/book). A simple one would be http://www.yorku.ca/eye/eye1.htm


1) The overall shape isn''t just a sphere. There are two main parts to the shape:

a. The Sclera: the white of your eye, the main shape.

b. The Cornea: a small hemisphere stuck to the front of the Sclera.


2. The eye is also made up from multiple layers, some important parts:

a. A thin film (conjunctiva) that makes the eyeball shiny.

b. The cornea and sclera.

c. The anterior chamber (gap formed by the shape of the cornea.

d. The iris. The coloured shutter like part. This is at the back of the anterior chamber and the size of the hemisphere of the cornea. This is like a disc with a hole in the middle. The pupil (the black bit) is actually the hole in the middle of the iris and the blackness is just a shadow (which is part of the reason for "red-eye" with flash photography). The lower the light level, the wider the hole in the iris becomes. [Certain drugs affect that size]

e. The lens. Just like a glass lens - magnifies light rays.


3) Some thoughts on rendering that.

a. The film and outer layers are what you environment map, and like glass etc would be affected by stuff like refraction, Fresnel effects etc.

b. The shape of the cornea could be accounted for cheaply using the EMBM/indirect texturing style rendering (like the BumpLens sample in the DirectX SDK)

c. The stuff inside the sclera varies in thickness the further into the eye you get - so would exhibit some translucency/light scattering. Milk/pearl/marble shaders would probably be a nice approximation to that. The lines in procedurally generated white marble could be coloured red and made thin for blood vessel simulation.

d. Due to the shape of the cornea, lens etc, specular style highlight dots on the eye aren''t necessarily where you''d expect them to be. You could probably still screw around with a traditional N.H style thing to get that right.

e. If you had something such as EMBM accounting for the refraction of the outside of the cornea/anterior chamber, the iris could be modelled as a plain textured disc.

f. The pupil could just be another textured disc on top of the pupil disc - though since in real life it''s really a hole, stuff like highlights should actually behave slightly differently when they fall on that.


ISTR there was a paper from SIGGRAPH 2002 or 2001 about modelling the *motion* of what eyes are looking at.

For eyelids you''d probably just use weighted morphing so that the skin stretches correctly over the cornea rather than chopping it off (as it would if you just stretched the eyelid over the sclera.


This is a good idea for an interesting project - see how realistic you can get an eyeball using shaders with only minimal stuff done with texturing (probably just iris). Tempting.

[I''m no expert on this stuff though - just going off what I''ve read in a few books when learning about things like optics]

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement