Sponsored By

Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs.

The Science of Eyeballs in Y2K

Cross-posted dev blog on the complexities of creating a character model, and the surprising intricacies of developing eyeballs.

Cassandra Khaw, Blogger

November 24, 2014

11 Min Read

Y2k is an upcoming third-person JRPG inspired by Final Fantasy, Earthbound, and Haruki Murakami. It follows the misadventures of bearded college graduate named Alex Eggleston as he hunts through a '90s message board for information on the mysterious "Death Cab." Y2K also contains weaponized panda plushies and killer alpacas. This is the dev blog you are looking for. 

Crossposted from Ackkstudios' devlog. 

Today I am taking a break from battle programming to update Vella’s character model (no drastic changes, just some cleanup/small changes really).

While I was doing this, the topic for today’s post came to me:

 Yes! Eyes!

Eyes can be done in many different ways in a 3D game.

In the old days they were usually textured on to the face (in many mobile games they still are), but eyes that are modeled onto the character are more common lately.

Whichever way an artist chooses she/he will have to ask themselves a question:

How do I make the eyes look good from the side?”

The problem with eyes is that they are not flat, nor are they simply spheres:

They are “see-through-almost-spheres”.

image taken from www.nei.nih.gov)

See the pupil? See how deep inside the eye it is? to actually do that in 3D software a shader with refraction/reflection would be required. The problem is, that kind of shader is not really possible in games (although approximations can be made, it is costly in performance).

I have one big rule when working in 3D: If you can, cheat.

Although in Y2K I modeled the eyes, I want to show off the old Ps1 era textured face approach:

(*Note that Y2K does not use this technique).

(Face texture added to cube geometry, with slight modifications )

When working on a low poly model, it is helpful to “curve” the face of a head, by pulling the front edges of the face back a bit. Failure to do this will result in a flat face and invisible eyes when viewed from the side:

(Top block has been modified to show profile. Middle cube is a simple cube. Bottom cube has a slight bend at the center).

If you curve the planes of the face where the eye texture sits, the eyes can be seen from the side.

(Top eyes can still be seen, while middle eyes completely disappeared.)

Using bent geometry with simple textured-on eyes is the simplest approach to the problem, but it isn’t entirely realistic.

(Example Geometry)

 

This is fine, but for Y2K I wanted more volume in my eyes.

Simply modeling bulges for the eyes won’t work because the pupil would sit on top.

I wanted my pupils to sit inside the eye, and I wanted the Iris inside the lense.

The trick I used is completely-no- literally backwards:

Flipped Normals.

Quick rundown in case you didn’t know about normals:

  • Polygons are one sided.

  • the direction of a polygon is determined by the “normal vector”.

  • if you turn a polygon around it disappears. (If it doesn’t disappear, turn backface culling on and never turn it off again!)

Imagine this: You are holding a golf ball in your hand.

Unlike most golf balls in the real world, this one is made out of polygons.

You can see the golf ball because all of its normals are pointed outward from the center of the ball.

As you hold the ball someone comes along and flips the golf ball’s “normals” on you.

You are amazed because, while you can still see the golf ball, the side of the ball you are looking at is not the one closest to you, but on the other side of the ball!

The side closest to you doesn’t seem to exist.

You turn the ball around and you see the other side exists, but you no longer see the previous side. you are looking through the golf ball.

From left to right: Sphere, Sphere with flipped normals, Sphere with flipped normals-but with another sphere embedded inside. Notice that the shading looks reversed.

The eyes on the characters in Y2K behave the same way:

(Flipped normals allow the iris to sit inside the lens of the eye)

Due to the cartoony shape of the eye I opted not to use a sphere.

Instead I have a deep cavity in the eye socket where I place the iris.

Then lens geometry is placed over the eye socket. The normals on the lenses are flipped allowing them to only be seen from the side. the white material inside of the eye socket is what you see when viewing the characters from the front.

The lense geometry in flipped, while the highlight shape [orange] floats in front of the iris. both shapes rest inside the eye socket.

(Notice when I take the lense off of the eyes, how odd it looks.)

Wee see right through to the back of the lens, but because the material is flat, we cannot tell that it is reversed.

With the old textured approach, if I wanted the eyes to blink, or look around, I would need to load a different texture, or manipulate uv space. But using this approach I only need to animate the parts that make up the eye.

 During gameplay a script is used to move the eye to look in the desired direction. the eyes can also change shape and size as needed

AckkStudios is the collective name for the genius minds behind GBA love letter Two Brothers/Chromophone. They're current working on Y2K, the JRPG hipsters everywhere are waiting for.

We're Ysbryd Games, the plucky publishing outfit with a big heart and the name that makes you go, "Gesundheit!" Based in Southeast Asia, we're a tiny operation looking to bring more narrative-driven goodness to the big, beautiful world. Our website is still under construction, damn it. 

 

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like