Cman2k's eyeShader

Hi guys!

I’ve been trying to learn how to write my own shaders. It’s been a great learning experience for me.

I’m posting this here in particular because I’d love to hear any feedback you guys might have on the existing features, how I’ve implemented things, or any of my planned features. Any feedback would be great!

much respect to RobG, his eye shader was a big inspiration for me to tackle this one!

Features:
[ul]
[li]Diffuse maps: Separated Cornea and Iris Diffuse and Normal maps with seperate texture coordinates[/li][li]Normal maps: Separate Cornea and Iris Specular controls[/li][li]Parallax Offset Mapping (POM): used to simulate Iris Indentation and Cornea Refraction. Hard to ‘see’ in still image.[/li][li]Pupil Dilation: Similar in concept to Valve’s pupil dilation, this is done entirely through UV math![/li][li]Cubemap Reflections: Cubemap-based reflections with Strength, Contrast and Fresnel Falloff controls[/li][li]Image-based Ambient: Cubemap-based Ambient lighting[/li][li]Hemispherical Ambient: Hemispherical ambient lighting in UV-space.[/li][li]Shadow Map: Shadow map used to simulate eyelid-shadowing.[/li][li]3-Light support![/li][/ul]

Possible Future Features:
[ul]
[li]“bounced” specular for iris interior[/li][li]Specular “Shape” mask? What if we can mask specular to a shape, to fake a light source?[/li][li]“negative” fresnel strength support (for flipped fresnel calculation) per Pior’s suggestions[/li][li]“hemisphere shadowing”, as an alternative to shadow-mapping. might be more flexible and overall better.[/li][li]Investigate adding fake chromatic abberation to pupil specular, maybe with a texture?[/li][li]optional second cubemap for ambient[/li][li]Tint masking: 3 color mask texture (Iris outer, iris inner, pupil)?[/li][li]1D tint masking?: what if we just map a black&white iris to a 1D ramp? more color range and control? harder to author?[/li][/ul]

DOWNLOAD HERE!

Looks nice!

You’re missing something though,

The iris has 2 speculars, one where you have it, which is where the light is hitting and the cosine power is really tight, and then one directly opposite to it, on the other side of the eye, where the cosine power is looser.

When drawing eyes you usually draw the tight spec in one side, and then the eye is darker right around that spec, and then it lights up on the other side of the iris.

it’s basically the light comming in through the raised bits of the eye, and then finally landing on the iris on the other side.

This image should illustrate what I’m saying

That’s how I did for Tiger 08, this screenshot doesnt show it, but there’s actually pupil dilation going on too. (I was young and not working on Tiger fulltime, they took some prototype shaders… I don’t pull that shit anymore =) )

Hey thanks man that is some really useful insight.

I’ve never really noticed this phenomena. Just so we are on the same page, you are talking about this right?

My favorite illustration of that effect is in Fellowship of the Ring, Gollum’s head is just over this cliff, or branch, or something, and that highlight moves across his eyes… I don’t think it is particularly great, but it shows it off to the extreme.

Yeap, that’s the one =)

Spent quite a while working on an eye shader, then realised in my case 99% of the time none of it was seen. It could be very pretty on close ups though, probably something to revisit for a more cinematic project. Keep us updated of your progress as it looks promising.