Traditionally, 3D models, even so called solid ones, can only represent the object's surface information, and the interior is regarded as homogeneous. In most applications, it is necessary to represent the interior structures and attributes of an object, such as materials, density and color, etc. Surface model is incapable of bearing this task. In this case, voxel model is a good choice. Voxelization is the process of converting a geometrically represented 3D object into a three dimensional volume of dataset. In this paper, an algorithm is proposed to voxelize the polygonal meshes ported from current CAD modeling packages into volume datasets based on the easily indexing property of Octree structure. The minimal distance to the feature voxel (or voxels) is taken as criterion to distribute different material compositions to get a new kind of material called FGM (functionally graded material), which is suitable for the interface of RPM (Rapid Prototyping Manufacturing).