Irregular topography can cause strong scattering and defocusing of propagating surface waves, so it is important to account for such effects when inverting surface waves for shallow S-wave velocity structures. We have developed a 3D surface-wave dispersion inversion method that takes into account the topographic effects modeled by a 3D spectral element solver. The objective function is the frequency summation of the squared wavenumber differences along each azimuthal angle of the fundamental mode or higher-order modes of Rayleigh waves in each shot gather. The wavenumbers associated with the dispersion curves are calculated using the data recorded along the irregular free surface. Numerical tests on synthetic and field data demonstrate that 3D topographic wave equation dispersion inversion (TWD) can accurately invert for the S-wave velocity model from surface-wave data recorded on irregular topography. Field data tests for data recorded across an Arizona fault demonstrate that, for this example, the 2D TWD model can be as accurate as the 3D tomographic model. This suggests that in some cases, the 2D TWD inversion is preferred over 3D TWD because of its significant reduction in computational costs. Compared to the 3D P-wave velocity tomogram, the 3D S-wave tomogram agrees much more closely with the geologic model taken from the trench log. The agreement with the trench log is even better when the tomogram is computed, which reveals a sharp change in velocity across the fault. The localized velocity anomaly in the tomogram is in very good agreement with the well log. Our results suggest that integrating the and tomograms can sometimes give the most accurate estimates of the subsurface geology across normal faults.