In a Los Angeles hospital a short drive from Hollywood, some patients are tapping into virtual reality. But at Cedars-Sinai Medical Center, 3D technology is there not for entertainment but pain relief.

Patients in chronic or acute pain have put on special goggles and traveled virtually through Iceland’s waterfalls and valleys, floated among...