Sup polycounters!
I've been trying to learn how to write my own shaders, and in the process I decided to work on a 3ds Max shader for the community. I didn't want to make another Do-it-all shader, we seem to have plenty of awesome versions of that, so I decided to do something more specialized.
It's been a great learning experience for me. I hope some people find it useful. Feel free to ask questions, and please post your results!
Features:
- Diffuse maps: Separated Cornea and Iris Diffuse and Normal maps with seperate texture coordinates
- Normal maps: Separate Cornea and Iris Specular controls
- Parallax Offset Mapping (POM): used to simulate Iris Indentation and Cornea Refraction. Hard to 'see' in still image.
- Pupil Dilation: Similar in concept to Valve's pupil dilation, this is done entirely through UV math!
- Cubemap Reflections: Cubemap-based reflections with Strength, Contrast and Fresnel Falloff controls
- Image-based Ambient: Cubemap-based Ambient lighting
- Hemispherical Ambient: Hemispherical ambient lighting in UV-space.
- Shadow Map: Shadow map used to simulate eyelid-shadowing.
- 3-Light support!
Possible Future Features:
- "bounced" specular for iris interior
- Specular "Shape" mask? What if we can mask specular to a shape, to fake a light source?
- "negative" fresnel strength support (for flipped fresnel calculation) per Pior's suggestions
- "hemisphere shadowing", as an alternative to shadow-mapping. might be more flexible and overall better.
- Investigate adding fake chromatic abberation to pupil specular, maybe with a texture?
- optional second cubemap for ambient
- Tint masking: 3 color mask texture (Iris outer, iris inner, pupil)?
- 1D tint masking?: what if we just map a black&white iris to a 1D ramp? more color range and control? harder to author?
**
DOWNLOAD HERE!**
![eyeShader_buildup.gif](http://carlosmontero.com/data/eyeshader/eyeShader_buildup.gif)
Replies
Any chance of a Maya version?
I also played around a bit with dilation with a shader using a texture instead of UV animation. Was pretty neat, you could do whatever shape of dilation animation you wanted.
youtube.com/watch?v=CN9alIFB-d4
Keep going I wanna see those future updates.
Thanks for the reference
I cant wait for multi-light support as that'll really help put this over the top for me.
Scooby: I got multi-light support working, but I have some things to clean up. expect an update tomorrow!
Like this image:
I think the fresnel falloff would work better the other way around tho. More shiny on the edges of the volume, and less shiny inside...
http://wiki.blender.org/uploads/thumb/c/c6/Manual-Part-III-fresnel-ball.png/300px-Manual-Part-III-fresnel-ball.png
Also on your exemple it looks as if the bump on the veins is flipped maybe...
Hope this helps! Cant wait to play with it.
This is something more common to metals and plastics and stuff, and at first I thought it was maybe just the nature of reflection. Wikipedia seems to support this; http://en.wikipedia.org/wiki/Fresnel_equations
But after looking at a lot of eyeballs it seemed to me like I should shrug that off and just make it look "right". My rationale here was that in general less light probrably hits the sides of the eye because of the surrounding facial structure, so less light is able to be reflected. This is the phenomena I'm trying to simulate here, rather than the standard mathematical fresnel reflection falloff. This is what feels more natural and close to real-life reference to me as well.
Thinking about it some more, it would certainly be possible for me to support both..but I have to question if its necessary and what gains it might have...
If anyone disagrees with me or makes a good argument for it I'd be happy to consider changing it though.
And right you were with the normals! An embarassing mistake, this is what I get for making normal maps at 4 in the morning instead of sleeping...haha!
Maybe because the 'wetness' of it creates some kind of continuous membrane, getting up near the edges, hence sending the reflections away ?
Who knows hehe.
Supporting both miiiiiight be useful in the case of a standalone eyeball model maybe ...
Or just for added flexibility just in case (who knows what kind of alien stuff could be achieved with this shader!)
Great stuff!
eyes are about to look a lot more badass
Light usage is controlled via the technique (you must switch to the 3-light technique in order to use 3 lights!)
also: normal-map fixes, as per pior's suggestion.
**DOWNLOAD**
hell, even copying the reflectivity shader from the UDN website throws back errors...