It is an object to provide an image generating system and program which can generate
such an image as in the real world with reduced processing load. The alpha-value
for each pixel in the original image is set to a value corresponding to its Z-value.
The set alpha-value is used to perform alpha-blending between the original image
and a defocused image. As the difference between the Z-value of the focus and the
depth value increases, the synthesis ratio of the defocused image is increased.
The range of depth of field and defocusing effect are controlled by varying the
corresponding relationship between the Z-value and the alpha-value. The alpha-value
is set such that the alpha-value for an pixel located in an area AR1 between
Z1 and Z2 will be set to 1, the alpha-value for an
pixel located in an area AR2 between Z2 and Z3 will be set
to 2 and so forth. The alpha-value is set by updating the alpha-value
of a pixel located farther from an object when the object is drawn in a frame buffer.
When the original image is set as a texture which is in turn mapped through the
bi-linear filtering method, the defocused image is generated by shifting the texture
coordinates by a value smaller than one texel.