In a method and apparatus for forming a three-dimensional image for an
inspection pattern, a reference intensity function of an inspection X-ray
is formed in accordance with a continuous scanning depth, and is
differentiated with respect to the scanning depth. The differential
reference intensity function is decomposed into a start function and a
characteristic function. The differential reference intensity function is
then repeatedly integrated while a temporary vertical profile function is
substituted for the start function until the temporary intensity of a
reference X-ray is within an allowable error range. The temporary
vertical profile function satisfying the error range is selected as an
optimal vertical profile function. A surface shape is combined to the
optimal vertical profile function along a depth of the inspection pattern
to thereby form the three-dimensional image for the inspection pattern.