Easy Eyes Out !

promo

Hi everyone !

Recently, I have been working on a little something. A shader to setup eyes in a quick and easy way. Here is a little demo of it in action, before going further in explanations :

The package itself has a lot more features to customize. You can change the color, the size, and the blend between each components (sclera, iris, pupil, and veins). Here is an overview of the material inspector :

eyes_material

First of all, the shader mainly revolves around the use of one texture, containing several masks :

– The iris : an iris texture in gray values.
– The color mask : a mask used to blend the two eye colors over the gray iris texture.
– The heightmap : used to add some parallax to the iris.
– The veins : they will be added over the sclera.

This texture is the heart of the shader, and without it, the eye wold simply be a radial gradient, based on the colors of the next section :

– First Color : the main color blended over the iris, using the white value of the mask provided.
– Second Color : the secondary color blended over the iris, using the black value of the mask provided.
– Iris Rim Color : the color of the ring added around the iris.
– Sclera Color : the color of the sclera, which is the white part of the eye.
– Sclera Veins Color : the color of the veins.

There is then some parameters to change the values of the PBR material. It didn’t cost much to let them available if necessary, but you probably won’t have to change really change them. Except the emission, if you want your character to be a magic practitioner or some demon (they would probably blind themselves, but, well, it’s magic, so….).

There is then the parallax settings :

– Parallax Strength : will be applied using the heightmap in the main texture, and make the iris deeper looking or not.
– Parallax Bias : is applied to the whole eye. It gives some depth to the eye. Not much, but subtile when looking at the eye from the side.

Then there is the pupil size. In the shader it is an exponential value, which explain why the higher the value, the lower the rate at which the iris contract.

After this comes the Iris section :

– Iris Size : the size of the iris.
– Iris Rim Distance : the distance at which the iris start fading to the rim color (as a percentage of the iris size).
– Iris Rim In Fade : the intensity of the fade of the rim inside the iris.
– Iris Rim Out Fade : the intensity of the fade of the rim outside the iris.
– Normal Scale : the scale of the normal provided below, as a multiplier of the size of the iris.
– Strength : the strength of this normal map. Lower value are stronger normals.
– Pupil Normal : the normal map. The basic one is simply there to simulate the cornea.

Finally, we have the sclera :

– Sclera Size : the size of the sclera.
– Sclera Fade : the intensity of the fade of the sclera.
– Veins Fade : the intensity of the fade of the veins.
– Veins Scale : A scale for the veins texture, to get more or less details if the texture is tiling.
– Strength : the strength of this normal map. Lower value are stronger normals.
– Veins Normal : the normal map. Best effect is when it matches the veins mask provided in the main texture.

It isn’t the most complex shader, but it allows a lot of freedom to the user. At first, I wanted to generate veins and iris with procedural noises. I had some interesting results in Unreal Engine 4, but the quality doesn’t compare to a few handmade textures. From here on, it was just figuring out which texture to use to get the best results while keeping great customization.

I hope this quick overview of the asset allowed you to get a better understanding of what values will change which aspect of the eye. The package contains a few script to make the pupil react to the light as seen in the demo, and a system for the eyes to look at points of interest. If you have any question, feel free to leave a reply here, or contact me at this address : huguenin.benjamin@gmail.com

If you are interested, here is a link to the asset store : http://u3d.as/Cng

And feel free to send me an email to show me the project you have been working on with this asset. I could add a screenshot to the asset store to showcase your game and show my asset in action !

4 Comments:

  1. nothing bad to say about the eyes just what I asked for having issues using them the way I want.

    can you change the pupil and lens to a different shape?
    do you know how to apply them to morph3d model ?

    • Hi !

      First of all, thanks for you purchase. Concerning the pupil and the lens shape, if you want something more “cat-like” or anything else, it will be the subject of the next update. Having the pupil expand the right way with non-circular shape will require some work though, and I currently haven’t any time frame to give you concerning when it will be released. I apologize for this if you needed this feature.

      Concerning Morph3D, I never used their models. If the eyes are in a separate mesh or submesh, it should just be a drag and drop matter. But if the eyes are part of their main material and aren’t part of a dependent submesh, you will have to separate the eyes with a 3d software. Sadly, this issue is beyond my control. Like for any 3d model, each part that need its own material has to have it’s own submesh.

      Sorry I can’t be of much help, but I hope this answer will give you the information you need.

      Benjamin

  2. Hey, I just got You shader, but is there any specific way to set it onto a already modelled character? I keep having red or white eyes.

    • Hi Chris !

      It should just be a matter of dropping the material on your character’s eyes. Someone already contacted me to ask me if it would cause an issue to use the shader on another mesh, and it wasn’t, everything was fine. If it’s not working, could you contact me by mail with more details ? Some screens of the issue in Unity, one of the material inspector, and maybe a screen of your UVs would help me track down the issue.

Leave a Reply

Your email address will not be published. Required fields are marked *