Implementing god rays when light source is not visible


I want to implement god rays, or light scattering shader. I understand the basic concepts - render light source’s volume mesh, blur it with surrounding environment and apply the result to real render, but this technique won’t work if the light source is fully occluded by something or behind the camera - basically not visible.

Is there a way to achieve the god rays effect when the light source’s mesh can’t be visible? For example in a corridor when the rays should be projected from the windows on the walls.

My thoughts was to use somehow modified shadow map, but I don’t know how a light can be projected on a surface that doesn’t exist.