Hi Tweakie.
I have one of these driving the 445nm laser diode.
http://hacylon.case.edu/ebay/laser_diode/FlexModP3.php. It has analog and TTL modulation I'm using the USB port to power one of these.
http://usdigital.com/products/encoders/absolute/rotary/shaft/MA3 I purchased the analog output version instead of the PWM output one and it's attached to the Z axis stepper motor by a timing belt and pulley setup with a 6-1 ratio. With these ratios, when my Z axis motor moves from Z0.00 to Z-.016" the encoder outputs 0-5V. With a 2-1 ratio to my Z axis screw the laser only moves .008" and it's not enough to go out of focus. I'm not using any special code, but just like the PhotoVcarve software outputs for a Lithophane or rotary bit engraving with the X Y & Z g-code moves. Darker areas with a deeper depths of cut, it throttles up the power of the laser and lighter areas it throttles back so it is truly variable and proportional with all shades in between. This could be done with a more powerful CO2 laser if there was a way to vary the output power of it. I was planning on down the road to build my larger CNC router into one, when my finances with allow. I guess the tube would have to be mounted vertically to make it work properly. That way it could still move up and down based on material thickness so the beam would still stay in focus.
Jeff