I'm not sure but I don't think optical switches have that ability either, you're either breaking the beam or you aren't.
Wooting uses hall-effect sensors and MX-compatible "switches" that have a magnet in the plunger. The set and reset thresholds can be set in software/firmware.
So it can be done with hall-effect switches but not with mechanical switches as you say.
For this you need an analogue sensing mechanism such as hall-effect sensors (as Wooting use). You can see some open-source reference designs for PCBs, Firmware, and switches using hall-effect sensors on riskable's github to get you started. Technically you should be able to make a PCB like this and then use the same "switches" that Wooting use, though idk where they source them.