We describe a method for calculating, within density functional theory, the electronic structure associated with typical defects which substitute for Cu in the CuO2 planes of high-Tc superconducting materials. The focus is primarily on Bi2Sr2CaCu2O8, the material on which most STM measurements of impurity resonances in the superconducting state have been performed. The magnitudes of the effective potentials found for Zn, Ni and vacancies on the in-plane Cu sites in this host material are remarkably consistent with phenomenological fits of potential scattering models to STM resonance energies. The effective potential ranges are quite short, of order 1 A with weak long range tails, in contrast to some current models of extended potentials which attempt to fit STM data. For the case of Zn and Cu vacancies, the effective potentials are strongly repulsive, and states on the impurity site near the Fermi level are simply removed. The local density of states (LDOS) just above the impurity is nevertheless found to be a maximum in the case of Zn and a local minimum in case of the vacancy, in agreement with experiment. The Zn and Cu vacancy patterns are explained as due to the long-range tails of the effective impurity potential at the sample surface. The case of Ni is richer due to the Ni atoms strong hybridization with states near the Fermi level; in particular, the short range part of the potential is attractive, and the LDOS is found to vary rapidly with distance from the surface and from the impurity site. We propose that the current controversy surrounding the observed STM patterns can be resolved by properly accounting for the effective impurity potentials and wave-functions near the cuprate surface. Other aspects of the impurity states for all three species are discussed.