Yes, but optical rotary encoders are generally a different kettle of fish - ie, they're much rarer, maybe 5x more expensive, and usually much bigger than the electromechanical ones.

Great for home stereos with the smooth "endless" rotary controls, but not good if you have <5mm of height above the PCB to fit the switch body into!

Hugo