A three dimensional n+-p-p+ silicon Solar cell has been simulated using a Drift-Diffusion model which involves the self consistent solution of the Poisson and Continuity equations. Light does not enter through all the regions of the structure as metal contacts exist to tap the current from the solar cell and these contacts prevent the light from entering through them. Shadowing effect of the metal contact has been included in the code which plays an important role in the calculation of the efficiency of solar cell as it is one of the factors that determines the number of effective photons contributing to the generation of electron hole pairs in the device. The regions not having any contact on them will act as a window for the light to enter the device and are prone to surface recombination whose effect has also been included in the code. This effect tends to reduce the efficiency as some of the carriers are lost even before entering the structure. Recombination current in solar cells is the major limiter of its efficiency as it determines the open circuit voltage. The code is generalized and will be used in investigating the physics behind the operation of multi-junction and heterojunction structures for solar cells.