Control of self-propelled particles is central to the development of many microrobotic technologies, from dynamically reconfigurable materials to advanced lab-on-a-chip systems. However, there are few physical principles by which particle trajectories can be specified and can be used to generate a wide range of behaviors. Within the field of ray optics, a single principle for controlling the trajectory of light -- Snell's law -- yields an intuitive framework for engineering a broad range of devices, from microscopes to cameras and telescopes. Here we show that the motion of self-propelled particles gliding across a resistance discontinuity is governed by a variant of Snell's law, and develop a corresponding ray optics for gliders. Just as the ratio of refractive indexes sets the path of a light ray, the ratio of resistance coefficients is shown to determine the trajectories of gliders. The magnitude of refraction depends on the glider's shape, in particular its aspect ratio, which serves as an analog to the wavelength of light. This enables the demixing of a polymorphic, many-shaped, beam of gliders into distinct monomorphic, single-shaped, beams through a friction prism. In turn, beams of monomorphic gliders can be focused by spherical and gradient friction lenses. Alternatively, the critical angle for total internal reflection can be used to create shape-selective glider traps. Overall our work suggests that furthering the analogy between light and microscopic gliders will result in a wide range of new devices for sorting, concentrating, and analyzing self-propelled particles.