4
$\begingroup$

I'm working on an eye shader. It renders quickly, firefly-less and looks fairly good, but I hit a roadblock and could use some help here.

Eye Shader

The eye uses a single sphere instead of being broken into into cornea, iris and pupil. I opted to avoid transparency or glass shaders to keep the noise down. The pupil is nothing but pure trickery.

Cycles nodes

The Reflection coordinate yields impressive results. The eye behaves as if the pupil were inside it. This method is superior than painting a black circle on the surface of the eye, as that would be glaring obvious from obtuse angles.

Eye and movement

It's also an one trick pony, because the texture coordinate > Reflection output position is "fixed". It would be perfect if it were fixed relative to the object, but no, it seems to be anchored in the world. As soon I rotate my mesh it's gone, just as in the crow's right eye, where the pupil, always facing the same direction, is turned to the head inside.

How can I recreate this effect without taking the traditional route of modelling iris and pupil separately? I'm really pleased with how clean and fast this shader is. Is that possible to anchor the reflection in the object instead of the world? I tried to use vector transform with unsatisfactory results.

P.s.: This model is built on top of this one, I'm just improving it for my own needs. All credits should go to the original creator.

$\endgroup$

1 Answer 1

4
$\begingroup$

Not sure I totally understand the issue or if I recreated your setup correctly, but the Vector Transform node seems to be the correct answer.

If you transform from World to Local coordinates it seems to fix the issue of a moving eye.

enter image description here

The Gradient Ramp might need some adjustments afterwards

$\endgroup$
4
  • $\begingroup$ I recreated your exact node setup from scratch in a new, armature-less sphere, despite having unsuccessfully tried vector transform before. To my surprise it worked! It turns out my first failure happened due the armature deformation. The reflection coordinate becomes fixed relative to the crow's resting origin position. The mesh would deform when posed, changing the eyes relative position to the origin, still fixed at the resting point, what produced all sort of weird results happen when using the vector transform: the crow became cross-eyed, pupil-less, etc. (1/2) $\endgroup$
    – Rhaenys
    Jul 21, 2017 at 19:46
  • $\begingroup$ The solution was to duplicate and separate the eyes from the mesh, parent them to the armature (so they'll be automatically duplicated when duplicating the crow) but replace their armature mod with two constraints: Track to the head's vertex group (it controls the gaze direction, I want it always straight), and Copy Location targeting the original eye vertex group (I left invisible eyes in the crow mesh for now, I'll replace it with a new selection straight from the head later). My issue was simply a rookie mistake from my part, thank you for your help in figuring it out! (2/2) $\endgroup$
    – Rhaenys
    Jul 21, 2017 at 19:46
  • 1
    $\begingroup$ Note: Your node setup is nearly the same as mine, except tidier. The main difference besides no gloss is that your iris color gradient is directly linked to the pupil, surrounding it, while mine uses fresnel, making it fixed in relation to the eye instead. It's technically unrealistic, but it gives the eye a (fake) glowing effect when viewed from steep angles, so it ends adding nice tiny realistic touch. $\endgroup$
    – Rhaenys
    Jul 21, 2017 at 19:55
  • 1
    $\begingroup$ You should probably post your findings as an answer below, they might be useful to someone else in the future $\endgroup$ Jul 21, 2017 at 20:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .