I've actually written ray tracers. It's pretty simple, actually. Work out the intersection between a line (aka ray) and a triangle. Represent the object as a simplex of triangles. You can use a Monte Carlo methods or simply populate a grid of rays.
Or if you're just interested in cheap and sleazy results try the PovRay code and extract the shadow from the png produced. There are likely other ray tracers for designing optics which would be more suitable but they can be kinda pricy.
One text that comes to mind is
"Geometrical Theory of Diffraction for Electromagnetic Waves" by Graeme L. James, IEE Electromagnetic Waves Series
Not so much for ray tracing as for physical optics and some better approximations like the physical theory of diffraction. I suspect that for what ever it is you're asking, this text is more appropriate but then you haven't shared dick about your actual problem so it's nearly impossible to tell.