  We investigate the mechanism of the resonant X-ray scattering on the Ti $K$
edge region of YTiO$_3$ using the band structure calculation combined with the
local density approximation. A large intensity is obtained for the orbital
superlattice spots. The calculated spectra consist of several peaks as a
function of photon energy in agreement with the recent experiments. Against a
naive interpretation that directly relates the intensity to the orbitally
polarized $3d$ states, the obtained large intensity arises from the distorted
crystal structure, i.e., the tilt of the TiO$_6$ octahedra and the Jahn-Teller
distortion, which considerably modifies the $4p$ states in the intermediate
states of the dipolar process. This casts doubt on a prevailing assertion that
the resonant x-ray scattering is a direct observation of the orbital order.
