A computer program product for blending a variable number of textures during rendering of a computer generated image, said computer program product comprising a computer useable medium having computer program logic recorded thereon for controlling a processor, said computer program logic comprising:
- a procedure that extracts at least a first mask and a second mask from a first texture by applying scale and bias operations to the first texture;
- a procedure that blends a second texture and a third texture in accordance with the first mask to form a first image;
- and
- a procedure that blend the first image and a fourth texture in accordance with the second mask to form a second image.