SamuKata
colortwist
colortwist

patreon


Shadow occlusion based iris shaders

This is something I've been working on for a little while whenever I've had some free time. I'm not actually sure if these are going to get put into production, but I thought the effect was somewhat interesting and nearly convincing enough to consider it a partial success.

Long story short, a lot of modern day rendering engines suck at eyes. The main problem behind this is the lack of bidirectional rendering, which means that you can't easily render out refractive caustics without a highly specialized lighting setup or an obscene number of diffuse samples.

Unfortunately, refractive caustics (which is the same thing that gives you pretty light patterns when you place a glass filled with water in the sunlight) are responsible for providing a lot of "depth" that makes eyes look like eyes. Light tends to refract through the cornea lens in such a way that the iris opposite to the direction of the light is illuminated, giving the eyes an alluring appearance which I believe is largely responsible for the whole "eyes are a gateway to the soul" thing.

Without bidirectional rendering, this effect is typically VERY difficult to achieve. It can't be done realistically without refractive caustics, which means you're stuck looking for some sort of clever workaround instead. This was more or less my attempt at creating such a workaround.

In this particular case, the shaders are relying on the fact that shadow rays within Arnold are typically cast towards the direction of the light source within the scene. This means that you can leverage that information to generate a fake "virtual" shadow, which is then projected onto the cornea surface and used to vary the opacity of that material for the shadow rays only. In essence, the shader draws a (hidden) circle on the cornea that is guaranteed to face towards the light source- the size and density of which are varied based on the angular difference between the shadow ray direction and the local Z axis of the eyeball (this is done so the effect fades away if the light source is directly in front of the eyes).

The end result of this is a slight darkening of the iris on the surface pointing towards the light source. Combined with the elongated geometry of the cornea itself (human eyes are not perfectly round), this effectively causes the opposite side of the iris to appear brighter than the side facing towards the light.

This sorta works, and it sorta doesn't. It's not at all "realistic", but the effect is mostly there and it's dynamic enough to adapt to any scene lighting conditions automatically. In theory, it could be made "more accurate" by lightening the unoccluded regions of the iris while simultaneously darkening the rest, since this would be more inline with what happens IRL when light is focused onto a specific spot.

I'll probably take another crack at this technique in the near future since I do want to see if I can get it working a bit better than it does. For now though, I still thought it was an interesting "hack" to work around the whole unidirectional rendering issue, especially when it comes to the appearance of human eyes.

Shadow occlusion based iris shaders

More Creators