The eye shader is a specialized shader for rendering eyes. Eyes are very complex not only in shading but also in composition, therefore their shading/look cannot be achieved via regular shading methods.
Shader Params | Description | Shader gen option |
---|---|---|
Cornea Opacity | Sets the opacity of the cornea. | Default |
Glint multiplier | Sets the strength of the glint highlight. | Default |
Iris color | Sets the color of the eye's iris. | Default |
Iris depth | Sets the depth of the iris. | Default |
Iris scattering | Amount of light scattering inside the iris. | Default |
Pupil dilation | Sets the default amount of dilation for the pupil. | Default |
Pupil dilation dynamic | Sets the strength of dynamic pupil dilation. | Default |
Pupil position X | Sets the horizontal position in UV space (X, or U) of the center of the pupil. | Default |
Pupil position Y | Sets the vertical position in UV space (Y, or V) of the center of the pupil. | Default |
Depth bias scale | Sets the depth bias of the overlay mesh to avoid clipping with the eyes. | Eye overlay |
Occlusion strength | Sets the strength of ambient occlusion for the overlay. | Eye overlay |
An eye is made of several "components". The most relevant ones in this case are the sclera (white area), iris (where eye color comes from), pupil (the dark spot in middle), and the eye cornea (the "windshield" of the iris).
Simplified eye structure
The eye shader simulates these components using various techniques in a single draw call.
The first step is to setup the mesh for use with the eye shader. There are 3 meshes used to create a believable eye.
This process is relatively straightforward. The overlay should be correctly skinned to move with the eyelids or modeled in such a way that moving eyelids won't cause cracks in the overlay.
The texture setup is the most important part of the entire shader. The textures should follow these guidelines:
Eye texture examples |
---|
Overlay Red Channel | Overlay Green Channel | Merged result |
---|
To update old assets to use the new shader:
The eye shader has various parameters to control the look of the eye.
Zero opacity | Full opacity |
---|
No glint highlight | With glint highlight |
---|
No parallax | With parallax |
---|
No scattering | With scattering |
---|
Pupil under bright light conditions | Pupil under low light conditions |
---|
The overlay shader is simple but very important. It's main purpose is to ground the eyes into the character and to give it a natural look. It contains but 2 unique settings.
No ambient occlusion | With ambient occlusion |
---|