How to get depthmap from offscreen?

Hi
I want analysis sunlight for buildings.
Firstly, i calculate the positon of sun(x,y,z), and create a offscreen camera there.
then i want to get the depthmaps every hour via offscreen camera to find out the shadow area.
image
In some case, the depthmap will be empty(every pixel’s depth is 0)

What’s the reason for this? How to get depthmap accurately?