Make a three stop radial gradient and fill your ring with it. (I'll add soon images)
ADDENDUM That was actually not a good idea, because the same method is meanwhile appeared in another answers. Here's something else:
- Have a square image with a white layer. Let the image have pixel dimensions 200% of the wanted ring diameter. Draw a horizontal rectangular selection just at the middle of the image and fill it with black
- Let the selection stay, make a gaussian blur, so heavy that the black just lightens a little in the middle, too. The blur is now a gradient.
- Let the selection stay. Take the curves tool and adjust the steepness of the gradient to resemble a straight tube:
- Remove the selection Goto Filter > Distort > Polar coordinates > Rectangular to Polar
- Take the magic wand. Select the white and press DEL. Be sure you have the tolerance = 0 or 1 and antialiasing =ON. Before deleting you can goto selection menu and contract the selection if you want to save more white. Otherwise the pure white is removed.
ADD2: I just read you are programmers. Then you should have no problems to implement the following radial brightness:
Bx = Brightness (0...255) at the edge
Bm = Brightness at the middle of the ring
R1 = internal radius
W = radial width of the ring
h = roundness exponent, positive, start with h=1