Overview

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 Parameters

Shader Params

Description

Cornea Refraction

With this slider the eyes pupil size can be controlled, and potentially animated

Cornea Smoothness

Controls the glossiness of the corneas reflections. The default 1 gives smaller and sharper highlights much as in real life.

Indirect bounce color

An old feature mostly not used any more, does nothing when the PBR system is used.

Iris Color

Tweaks the Iris color without affecting the eye white, can potentially be used for eye variation between characters using the same texture.

Iris Depth

Simulates the actual form of the Iris, since the in-game mesh has the shape of a sphere.

Iris Shadowing

Selfshadowing of the Iris, further simulating the actual form of the iris. Note that this shader effect is only affected by sunlight and not by other light sources.

Iris SSS

The SSS of the Iris, blurring the shadows. The higher the value the more it blurs the shading.

Sclera SSS

Controls the SSS of the eye whites, blurring the shadows. The higher the value the more it blurs the shading.

Depth bias scale

Sets the depth bias of the overlay mesh to avoid clipping with the eyes.

Diffuse occlusion strength

Controls how strong the occlusion effect on the eyes is.

Specular occlusion strength

Controls how strong the occlusion effect on the eyes specular highlights are.

Shader Generation Params

Shader Gen Params

Description

Environment map

If the blending cube map feature is not used this box needs to be marked, and “nearest_cubemap” needs to be assigned in the environment slot of the textures.

Ambient occlusion overlay

Needs to be turned on for the occlusion mesh that overlays the eye. This mesh gives the eyes a more natural shadowing and integrates them with the head.

Specular overlay

Used for the eye water mesh

Eye Anatomy

 

An eye is made of several "components". The most relevant ones in this case are:

The eye shader simulates these components using various techniques in a single draw call.

In-Game Eye Parts

The first step is to setup the meshes needed for the eye. There are 5 meshes used to create a believable eye.

The modeling process is relatively straightforward. The eye occlusion mesh and the eye water topology should have the same density and align with the eye lids edge loops; the reason for this is to make the skinning easier and animations smooth.

Textures

When setting up the UVs it’s crucial that the pupil and iris is centered in the middle of the UV space, otherwise some of the shaders features will not work properly. The textures should follow these guidelines:

Eye ball

Previous versions of the Eye shader had a dedicated "Subsurface" map but this is obsolete with the current Eye shader, as this masking information is received from the Diffuse Alpha channel and controlled with the Iris/Sclera SSS sliders.

Eye Water

Tear Duct

Eye Occlusion

Eye Lashes

This mesh works as a regular hair setup. See: Hair Shader.

Shader Texture Setup Examples

Eye Ball

Eye Occlusion

Eye Water

Shader Params Examples