This paper describes an approach to construct unstructured tetrahedral and hexahedral meshes for a domain with multiple materials. In earlier works, we developed an octreebased isocontouring method to construct unstructured 3D meshes for a single-material domain. Based on this methodology, we introduce the notion of material change edge and use it to identify the interface between two or several materials. We then mesh each material region with conforming boundaries. Two kinds of surfaces, the boundary surface and the interface between two different material regions, are distinguished and meshed. Both material change edges and interior edges are analyzed to construct tetrahedral meshes, and interior grid points are analyzed for hexahedral mesh construction. Finally the edge-contraction and smoothing method is used to improve the quality of tetrahedral meshes, and a combination of pillowing, geometric flow and optimization techniques is used for hexahedral mesh quality improvement. The shrink set is defined automatically as the boundary of each material region. Several application results in different research fields are shown.