# Blender 3D: Noob to Pro/Procedural Eyeball

|previous=Creating Pixar-looking eyes in Blender
}}
```
Level: intermediate\
**Building a better (procedural) eyeball!**\
Originally created by Jon McKay (Ammusionist) and posted on
blenderartists.org/forum\
1
The end result of this tutorial is an eyeball that fulfills the
following requirements:

1.  Single mesh
    -   I wanted to be able to append a single object into any project.
2.  Procedural Textures
    -   I didn\'t want to have to rely on image maps that could get
        lost.
3.  Versatile
    -   One single model to be used for any type of character, be it
        human, alien or whatever.
4.  Easy
    -   Any effects needed to be quickly accessible. I don\'t want to be
        wasting time faffing around with colour-band settings at the
        texture level
5.  Impressive
    -   This sucker needs to look good any way it goes.
6.  One other thing I really wanted was the iris musculature to follow
    the pupil dilation!

![](Procedural_eyeball_blender2.75_rendered.jpg "Procedural_eyeball_blender2.75_rendered.jpg")\
\
\
\
\
\
\
\
\
\
An old and different Tutorial:

1.  Very old video for making deep-looking eyes
    <http://www.youtube.com/watch?v=KKmHUZroaBA>

## Creating the Mesh

The objective here is to make a great looking eyeball. That means it may
not be anatomically perfect, but there are some things we need to take
into account: The eye should consist of a white (white bit with veins);
an iris (coloured bit); a pupil (black but in the centre of the iris)
and a cornea (clear bit surrounding the whole eye). These may not be
absolutely correct, but these are how I\'m referring to the pieces of
the eye.

1.  Start with a ball: Go to a front view
    () and create a UV sphere. 32 Rings
    and 32 segments should be sufficient. It\'ll give us plenty of
    smoothness and enough verts to work with when we create shapes.
2.  Click on \"Align to view\"
3.  This sphere will become the coloured parts of the eye, but we also
    need a second sphere for the cornea. Use the
     key to switch to a wireframe view (if
    you\'re not already there). Hit the 
    key a couple of times to ensure all points are selected then
     to duplicate the sphere.
4.  Press  key to scale and scale the
    second sphere to slightly larger than the first. (Hint: Hold
     while scaling for fine
    adjustment) or you could also enter a value, 1.01.
5.  Now that we have a nice confusing mesh, we\'re going to make our
    life easier. We\'re going to hide the outer bit for the moment. Hit
    the  key.
6.  **Noob Note:** Don\'t panic like I did the first time I accidentally
    hit , you can bring it all back with
    . (Note: In blender
     + some key often reverses the
    effect of pressing the key in the first place!)

-   OK Now to create the basic mesh for the inner part. Basically, we
    need to make a concave iris/pupil section.

1.  Make sure you're in Orthographic view.
2.  Switch to a side view and use the Border Select
    () to select the first 4 rings and the
    tip. Now we\'re going to flatten these. Press
     for scale
     for Y axis only and
     for scale-to zero.

For more realistic eyes you can also grab the inner 3 rings + the tip a
bit inwards the eye.

**Noob Note:** It is also possible to flatten the rings in a way that
leaves the last ring in place and moving the rings later is not
necessary. Before you flatten those 4 rings and the tip of the sphere
place your 3D cursor in the plane where the last ring involved in
scaling operation lies (use border select to select *only* the fourth
ring, press , and select \"Cursor to
Selected\"). Then set the pivot point to \"3D Cursor\". Finally proceed
like instructed above by selecting all rings to be flattened and scaling
them to 0 in Y direction. This time the outermost ring will stay in
place. Do not forget to set the pivot point back to the default option
\"Median Point\". You may return the 3D cursor to the center by pressing
.
![](Procedural_eyeball_blender2.75_1.jpg "Procedural_eyeball_blender2.75_1.jpg")\
\
\
\
\
\
\
\
\
\

1.  Last, grab them along the Y-axis to the eye till it\'s round again.

![](Procedural_eyeball_blender2.75_1-2.jpg "Procedural_eyeball_blender2.75_1-2.jpg")\
\
\
\
\
\
\
\
\
\
\* Now for the cornea. It\'s not perfectly spherical; it bulges slightly
at the front. We\'re going to use the Proportional Editing tool.

1.  First, we need to un-hide the cornea. Hit Alt-H to make it visible.
2.  Click the O-Key, this will activate proportional editing, click on
    \"Connected\" in the 3D view header at the settings for Proportional
    editing.
3.  Select the type of falloff: "Sphere Falloff"
4.  Press A-Key a couple of times again to make sure no points are
    selected, switch to a side view (Keypad-3) and right click just to
    the left of the front-most point. We just want to select the tip
    vertex.
5.  Now comes some fun. We want to drag that point away from the eye in
    the y axis, so press "G" for grab and "Y" for Y axis. As you move
    the vertex, you\'ll see a circle that defines the influence of the
    proportional editing. Adjust it so it is as the height of the whole
    iris and drag it out until it looks right.

![](Procedural_eyeball_blender2.75_2.jpg "Procedural_eyeball_blender2.75_2.jpg")\
\
\
\
\
\
\
\
\
\
\# First, switch off Proportional editing.

1.  Select from center the tip and the first 4 Loops.

![](Procedural_eyeball_blender2.75_2-2.jpg "Procedural_eyeball_blender2.75_2-2.jpg")\
\
\
\
\
\
\
\
\
\
\# Then Hit Ekey and Ykey then drag out a bit \'till it\'s good.
![](Procedural_eyeball_blender2.75_3.jpg "Procedural_eyeball_blender2.75_3.jpg")\
\
\
\
\
\
\
\
\
\
\* To clean the model up, we\'re going to apply a subdivision surface
modifier and some smoothing.

1.  Go to Modifiers in the Properties Header and hit new and choose
    \"Subdivision Surface\" choose view: 2.
2.  Hit Tab to switch to Object mode and hit the \"Set Smooth\" button
    in the Link and Materials panel.

![](Procedural_eyeball_blender2.75_4.jpg "Procedural_eyeball_blender2.75_4.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_5.jpg "Procedural_eyeball_blender2.75_5.jpg")\
\
\
\
\
\
\
\
\
\

-   Now would be a good time to save your work before we go on to
    textures.

## Adding the Textures

You\'re going to need multiple materials on this mesh. It\'s possible to
apply materials to selected faces.

1.  Press A a couple of times to ensure nothing is selected.
2.  Press Z to switch off wireframe; this will be easier without it.
3.  Place the mouse pointer in the centre of one of the faces on the
    outside layer of the eye and press "L" to select linked faces. If
    you get a message saying "Nothing Indicated" try positioning the
    pointer on a different face and try again.

![](Procedural_eyeball_blender2.75_6.jpg "Procedural_eyeball_blender2.75_6.jpg")\
\
\
\
\
\
\
\
\
\
\# Once the outside section is selected, go to "Materials" in the
Properties Header, click "+". Click "Assign" to assign the outside faces
to Material.001.
![](Procedural_eyeball_blender2.75_7.jpg "Procedural_eyeball_blender2.75_7.jpg")\
\
\
\
\
\
\
\
\
\
\* Now the inside.

1.  Hide the outside faces (H-Key). We\'ll assign the rest from the eye.
    If a face is already assigned to a material and you assign it to
    another, it just switches material.

![](Procedural_eyeball_blender2.75_8.jpg "Procedural_eyeball_blender2.75_8.jpg")\
\
\
\
\
\
\
\
\
\
\# Press A to select all and, as above, click "+" then click "Assign" so
it is assigned to Material.002.
![](Procedural_eyeball_blender2.75_9.jpg "Procedural_eyeball_blender2.75_9.jpg")\
\
\
\
\
\
\
\
\
\
\* Now for the iris and pupil.

1.  Hit A to deselect all.
2.  Switch to a front view and zoom in. Hit "C" to enable circle select
    and select the central faces plus one ring out. You can control the
    size of the selector by rotating your mouse wheel.
3.  Again, create a "+" material index and "Assign" the pupil faces to
    it.

![](Procedural_eyeball_blender2.75_10.jpg "Procedural_eyeball_blender2.75_10.jpg")\
\
\
\
\
\
\
\
\
\
\# Finally, click Akey to deselect all and use circle select again to
select the remaining faces on the iris. Assign them to a new material.
![](Procedural_eyeball_blender2.75_11.jpg "Procedural_eyeball_blender2.75_11.jpg")\
\
\
\
\
\
\
\
\
\
\* Now we\'re ready to make the materials.

### Cornea Material

1.  Switch to object mode (Tab). Go to Material.001.

We\'ll start with the simplest texture first. The cornea is basically
just colourless and transparent. This is because some lighting
conditions make the eye under the cornea difficult to see. Go to the
shading buttons (F5)

1.  Locate the "Transparency" control. Set this on. This means as we go
    we\'ll be able to see through the cornea. Note that we\'re using
    Z-Transparency instead of Raytrace. And set Alpha to \".2\"
2.  Diffuse at white and intensity is 0.1.
3.  Under Specular CookTor is used 1 and Hardness is 333.
4.  Under Mirror, Click on, and set to 0.4, Depth is 3
5.  Unclick the \'Traceable\' setting under Options
6.  And Under Shadow unclick \"Cast\"

![](Procedural_eyeball_blender2.75_13-1.jpg "Procedural_eyeball_blender2.75_13-1.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_13-2.jpg "Procedural_eyeball_blender2.75_13-2.jpg")\
\
\
\
\
\
\
\
\
\

### White Material

The white of the eye\'s a little trickier. The material here includes
some red veins that can be seen at the side of the eye, but not from the
front. This can be done with two textures, but there\'s a cheat we can
use.

First, the veins:

Switch to Material.002.

Go to the texture Properties aside of the from the Material:

Make a new texture.

Use a marble texture, and copy these settings.

1.  Under color choose Ramp.
2.  The first point is \"0\": Pos=0; R=1, G=0.0, B=0.0; A=1;
3.  Click on the second point, The second point is \"1\": Pos=0.340;
    R=1, G=1, B=1; A=1;
4.  Under the Marble tab: Sharper, Sin, and under \"noise\", hard are
    clicked;
5.  Size=2; NoiseDepth=10; Turbulence=26.04;
6.  And set under mapping \"Coordinates\" to \"Generated\". And
    \"projection\" to \"sphere\" or \"Flat\".

The two colour band items are shown here separately. This makes a nice
marble texture that will evenly cover the eyeball. So how to hide it
from the front of the ball? Another colour band trick, but this time in
the material itself.

Here they are in all their glory.

1.  Under the material tab, Diffuse is white and intensity is 1;
2.  Check Ramp, 0: Pos=0.533; R=1, G=1, B=1; A=0; Input is Shader;

```{=html}
<!-- -->
```
1.  1: Pos=0.544; R=1, G=1, B=1; A=1; Input is Normal;

![](Procedural_eyeball_blender2.75_14-1.jpg "Procedural_eyeball_blender2.75_14-1.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_14-2.jpg "Procedural_eyeball_blender2.75_14-2.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_15.jpg "Procedural_eyeball_blender2.75_15.jpg")\
\
\
\
\
\
\
\
\
\
The colour band items are both white with one alpha 0.0 and one alpha
1.0. As you can see they are very close together to give a fairly clear
line that the veins will stop at. The input setting for the band is set
to "Normal" this means the left hand side of the band refers to faces
that are parallel to the camera view and the right is faces that are
facing directly towards the camera.

There\'s also some colour band fun to be had with the pupil material.

### Pupil Material

I wanted a nice black texture, but I also wanted to get a red-eye effect
if a light is shone directly at it from behind the camera. Why? I guess
just because I can, and now so can you!

As before move to Material.003.

There are no textures in this one. It\'s basically black and a little
reflective with a nice hard specular.

1.  Diffuse is Black, presumably with an Intensity of 1
2.  Specular is white with an Intensity of 0.6 and a Hardness of 300;
3.  Under Mirror reflectivity is 0.1;

![](Procedural_eyeball_blender2.75_16-A2.jpg "Procedural_eyeball_blender2.75_16-A2.jpg")\
\
\
\
\
\
\
\
\
\
If you want to have the red-eye effect, have a good look at the colour
band settings though! (Not Necessary, and maybe not wanted by everyone)

1.  Check Ramp.
2.  0: Pos=0.970; R=0, G=0, B=0, A=0;
3.  The second is fully red (with no blue or green). We want the red-eye
    to respond to light not angle like the white of the eye.
4.  1: Pos=1; R=1, G=0, B=0, A=1; Input: Energy;

![](Procedural_eyeball_blender2.75_16-B.jpg "Procedural_eyeball_blender2.75_16-B.jpg")\
\
\
\
\
\
\
\
\
\
Now the bit you\'ve all been waiting for -- the iris!

### Iris UV Map

Save your work and grab a cup of coffee for this part. It\'s a little
involved.

We need the texture to stay glued to the mesh irrespective of the shape
of the mesh. This gives the effect of the muscles in the iris expanding
and contracting. In a nutshell, we\'re going to UV map a procedural
texture to a single part of the mesh.

OK, here we go. Switch material.004. You\'ll need to be able to see both
3D view and UV/Image editor. This can be achieved by splitting windows,
if you don\'t know anymore how to do this read
 again. Noob
note: If you rendered the image of the eye you will see the rendered
image, we want an empty grid. So click the \"X\" in the Datablock
(Image) choose-section in the UV/Image editor Header.

![](Procedural_eyeball_blender2.75_if_rendered.jpg "Procedural_eyeball_blender2.75_if_rendered.jpg"){width="810"
height="10"}\
\
\
![](Procedural_eyeball_blender2.75_17.jpg "Procedural_eyeball_blender2.75_17.jpg")\
\
\
\
\
\
\
\
\
\
Make sure the window is displaying a front view (Keypad-1) this will be
important when we unwrap the bit we\'re going to use.

Change the 3D view to edit mode en Face select mode.

1.  Hide the outside (cornea) as done before.
2.  Go to Material.004 and click on \"Select\" right of \"Assign\", this
    will select the to the material assigned faces. We will unwrap the
    faces to place our texture.

-   You can use these properties for the iris material:

1.  Diffuse: black but with an intensity of 1
2.  Specular: Intensity: 0

![](Procedural_eyeball_blender2.75_16,5.jpg "Procedural_eyeball_blender2.75_16,5.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_18.jpg "Procedural_eyeball_blender2.75_18.jpg")\
\
\
\
\
\
\
\
\
\
\# Now search in the tool shelf for the Shading/UV\'s tab, you will find
there the \"Unwrap\" button under \"UVs\".

1.  Click it and select \"Unwrap\". The unwrap tool, is a tool which you
    can position a texture. You can allocate the places in the texture
    to the mesh by positioning the unwrapped faces in a grid. The
    texture can be an image or another texture and will be used at the
    places, that are described in the unwrapped image in the \"UV/Image
    editor\"
2.  Zoom in \'till it\'s placed exactly to the outer edge the \"UV/image
    editor\" window.

![](Procedural_eyeball_blender2.75_19.jpg "Procedural_eyeball_blender2.75_19.jpg")\
\
\
\
\
\
\
\
\
\
\# The image window should now contain a nice even circle of dots. If
they aren\'t selected anymore, put the cursor in the \"UV/Image editor\"
and press "A" to select all the points. Now select each ring in turn
using Alt-Shift, starting from the innermost, and scale them until they
cover from the centre to the outside of the image grid as shown. (This
won\'t affect the mesh)

![](Procedural_eyeball_blender2.75_20-2.jpg "Procedural_eyeball_blender2.75_20-2.jpg")\
\
\
\
\
\
\
\
\
\
Now we\'ve got a map, lets get a texture. In the 3D view \"Tab\" to
object mode for the next part. If the UV/Image editor is in your way you
can merge the two windows. If you don\'t know anymore how to do this
read  again.

### Iris Texture

Firstly, a texture to control the colour blend across the iris.
Generally it starts on the outer edge dark and gets lighter as it moves
to the centre. Sounds like a job for the blend texture.

1.  Create a new texture for Material.004 at the Texture Properties in
    the Properties Header. It will be called \"Texture.001\".
2.  Change Type to Blend.
3.  create a second texture with type: Clouds

The texture itself is fairly straight forward, but again, the colour
band is where the magic happens.

There are two stops in the colour band. Note the alpha values. This
blend texture is meant to tint the iris texture so it\'s lighter in the
centre and darker in the outside.

We make a Blend texture and a clouds texture (yes clouds)

Now for that iris texture:

Blend texture:

The blend texture is applied to the UV map input. The green colour is
used as a lighten mix to tint the iris near the centre.

1.  Select Ramp,
2.  (Blue) 0: pos: 0, play with the color settings and set alpha to 1
3.  (Green) 1: pos: 0.009, play with the color settings and set alpha to
    0.89
4.  set progression to Spherical
5.  Set mapping to Coordinates: UV, Projection: Flat

![](Procedural_eyeball_blender2.75_21-1.jpg "Procedural_eyeball_blender2.75_21-1.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_21-2.jpg "Procedural_eyeball_blender2.75_21-2.jpg")\
\
\
\
\
\
\
\
\
\
Now you\'ve got color

Clouds texture:

The colour band points are black with alpha 0 and white with alpha 1.

1.  0: pos: 0, black with alpha: 0
2.  1: pos: 0.737, black with alpha: 1
3.  Under Clouds: Grayscale, Noise: Hard
4.  size: 0.4, depth: 2
5.  here is (together with the UV mapping) the magic of the lines:
    Mapping Coordinates: UV, Projection: Flat
6.  **Important:** Size X: 0.01, Y: 5
7.  Under influence - Geometry - Normal: 1

![](Procedural_eyeball_blender2.75_22-1.jpg "Procedural_eyeball_blender2.75_22-1.jpg")\
\
\
\
\
\
\
\
\
\
![](Procedural_eyeball_blender2.75_22-2.jpg "Procedural_eyeball_blender2.75_22-2.jpg")\
\
\
\
\
\
\
\
\
\
This texture is applied to UV again and. This makes some small shadows
in the iris when the light is from the side. Add some lights and have a
look at your eyeball so far.

## Pupil Dilation

We\'re going to use shape keys to create the pupil effects.

We\'re going to create a normal eye and a cat\'s eye. Fortunately, the
fully dilated eye is the same in both cases so that\'s going to be our
shape key basis.

**Noob Note:** note that you can only set a \"Shape key\" in object
mode.

1.  Go to Object Mode and go to the \"Shape Keys\" properties in the
    \"Object data\" (The triangle one) context in the \"properties\"
    header.
2.  Click "Add Shape Key" to create the \"basis\".
3.  Make 3 extra Shape keys. (Don\'t make a shape key after editing,
    because you will change the previous keyframe and that is not the
    intention)

![](Procedural_eyeball_blender2.75_23.jpg "Procedural_eyeball_blender2.75_23.jpg")\
\
\
\
\
\
\
\
\
\
\# Go to \"edit mode\" and click on Shape Key 1.

1.  Use circle select, Alt+Shift of de Select button in Material to
    select just the first 2 loops en the tip (pupil) in vertex select
    mode.
2.  Now scale this to the next loop, select the latter and scale to just
    before the edge of the iris (This gives a very wide pupil). It has
    to be as wide as possible because you can adjust how wide you want
    it in the shape key section. It is just a maximum so you can simply
    make an animation.
3.  Change the name to "Wide Pupil Contract"

![](Procedural_eyeball_blender2.75_24.jpg "Procedural_eyeball_blender2.75_24.jpg")\
\
\
\
\
\
\
\
\
\
\# Just because you may also need it make a very little pupil (with
shape key 2). Call it (Little Pupil).
![](Procedural_eyeball_blender2.75_25.jpg "Procedural_eyeball_blender2.75_25.jpg")\
\
\
\
\
\
\
\
\
\
Use the value slider in \"Object mode\", also set Viewport shading to
Rendered (so you can see how it will be when rendered), To increase the
shape of the pupil with \"Wide pupil Contract\" and make it smaller with
\"Little pupil\" you can use them at the same time also (and much more
if preferred).

Now switch back to object mode and try the shape key sliders out. Pretty
neat huh?

1.  Let\'s make a cat\'s eye now. Change the name of Shape Key 3 to
    -"Cat Pupil".
2.  Use the same method as before to scale the edge loops. As you scale,
    restrict your scaling to the X axis (That is "S" then "X"). You
    should end up with a shape key tiny but medium long.

![](Procedural_eyeball_blender2.75_26.jpg "Procedural_eyeball_blender2.75_26.jpg")\
\
\
\
\
\
\
\
\
\

That\'s pretty much it. Try some other things to practise with this.

Set the Camera and lightning.

Note: Due to the settings you\'ve done in the material of the white of
the eye, you have to position the camera in front of the eye. Because
the white of the eye that overrules the vein-texture is a white spot in
the middle of the camera and that has to be placed in the middle of the
eye around the iris.

Don\'t forget to save -- and enjoy!

![](Procedural_eyeball_blender2.75_rendered.jpg "Procedural_eyeball_blender2.75_rendered.jpg")\
\
\
\
\
\
\
\
\
\

