Sensor shader tweaks

Some cleanup and performance improvements from attempting to fix #469.