In dimmer control circuits, it is usual to use a look-up table, and use the value in that to set the brightness of a lamp.
This is because all lights including LED's don't have a linear response to the PWM level against brightness
i.e. 0% (0) would be off 100% (255)= full on but 50%(128) s unlikely to be half brightness more likely 40% brightness and as it gets 'darker' so the linearity gets worse .
Also works at the top end; setting 80% PWM maybe much nearer 100% brightness something like 85+% brightness..
The look up table has a series of values that represent the PWM value for each brightness required, and will give he illusion of a 'linear' brightness as you fade in up and down.
The look up table is an array of values that convert the brightness level either 0-100 or 0-255 and as an example, and convert it to a value to use for the PWM value.http://en.wikipedia.org/wiki/Dimmer#Dimming_curves
this is for tungsten lamps often used in theaters http://doityourselfchristmas.com/forums/showthread.php?19487-Empirical-LED-Dimming-Curve
a forum discussion
I hope this may be of some help.