Colors and Textures

The texture map images for iris and sclera are specified with irisTexture and scleraTexture:

Download: file
  "irisTexture"   : "hazel/iris.bmp",
  "scleraTexture" : "hazel/sclera.bmp",

If you prefer a solid color to an image, omit those lines and instead use irisColor and/or scleraColor, with color specified as three values [red, green,blue] in brackets:

Download: file
  "scleraColor"   : [ 255, 255, 255 ],

Colors can either be three integers in the range 0 to 255 (like most folks are used to) or three floating-point values from 0.0 to 1.0 (same idea, just different scale).

Solid colors save a TON of space compared to texture maps, if your design can get away with it.

A few more items have configurable colors:

Download: file
  "pupilColor"    : [ 0, 0, 0 ],
  "backColor"     : [ 140, 40, 20 ],

pupilColor is self-explanatory…like if you want glowing red or white pupils or something.

backColor covers the outermost/backmost part of the eye where the sclera texture map (or color) doesn’t reach. With a little planning, this and your sclera texture map can be designed to blend together…otherwise you’ll see a conspicuous crescent of backColor when the eye is looking off to a side.

The eyelid (and background) color is also configurable, but it’s not a normal RGB color. Instead, use eyelidIndex and an 8-bit value:

Download: file
  "eyelidIndex"   : "0x00",

Notice the hexadecimal value must be quoted. The value corresponds to one of the colors in this palette:

eyelidIndex doesn’t use a normal RGB value because the code is using an optimization trick here, which limits the available colors in this one area. The default eyelidIndex if unspecified is “0x00” — black.

This guide was first published on Sep 19, 2019. It was last updated on Sep 19, 2019.
This page (Colors and Textures) was last updated on Jun 11, 2020.