Unity Eye Shader

I’m making a unity eye shader inspired by Valves eye shader and the CryEngine eye shader.

Features

  • Separate shading passes that represent the inner iris and outer cornia bump
  • Parallax effect
  • Animated pupil dilation(looks really good)
  • “Lookat” script that prevents crosseyedness when the target gets too close

It’s kind of hard to see all the effects with a still image, so I will upload a video to Youtube soon. :smile:

Thats a nice looking shader. Good work! Eyes Look great.

Thanks! Next thing to do- make a whole bunch of eye textures!

Very cool!

This is very cool :smile: It would be awesome to have a feature where the eye samples the current light amount hitting the shader, and automatically dilates the pupil accordingly. I look forward to seeing what types of eye variations can be done with this, great work.

I am indeed working on an auto dilation script, essentially by implementing the lighting model on a per model basis. I’m not sure how accurate that be, as it only takes into account direct light entering the eye, and ambient. it should be possible to detect if a light is obscured(eye in shadow) :slight_smile:

If I recall, the Crytek people did pupil dilation right in the shader. Whatever texture coordinate math they had for changing the dilation, they tied directly into N dot L. Something to think about :).

You recall correctly…

This is very interesting, keep up the good work jRocket.

Yeah, crossing NdotL with the current pupil pixels should give an accurate enough approximation :slight_smile:

Sorry to be boring on your thread but I’m looking for a mobile-friendly eye shader and was wondering if you have something along those lines in the asset store.

I haven’t tested yet but this should work for mobile.(compiles for ogl es 2.0). There’s also a lower quality version of the shader that doesn’t have parallax ray tracing

It is now on the asset store as well. LINK

WOW, nice!

Eyes are very important on a character! I’ll consider getting this in a near future!

I knew I was going to like this from the title. It is both awesome and slightly creepy! It would be great to parametrize the shape of the pupil somehow to create squarish sheep eyes, vertical cat eyes, or demonic star-shaped eyes, etc. Differentially dilating based on the radial position input into some arbitrary function (even just sine and cosine would probably be neat).

I don’t have a need for anything like this now, but I’ll have to remember about it for later. Keep up the good work!

omg you extracted those eyes from your avatar!? No wonder he has such a frightened look… :hushed:

This looks very nice! Cat and reptile eyes would be a great addition.

Eye. Love. It!

Wow! Those would look amazing on UMA!

hello
I wonder if this is compatible android platform, and if so, if it does not take too many resources

The main shader compiles to OGL ES 2.0, but I haven’t tested on android yet. It should be noted that this is an expensive shader, but in most cases it will not take up a lot of pixels on screen at once

The fallback shader(without eye depth/parallax effect) should work on all platforms. I plan to test on android soon.