Mars exploration tasks are inseparable from the support of robotic equipment. More comprehensive environmental awareness capabilities can improve the efficiency of robots on the surface of Mars. Artificial neural networks have emerged as pivotal tools in enhancing the perceptual capabilities of robots. The cornerstone of effective neural network training lies in the availability of high-quality data. Regrettably, the unstructured terrains, particularly the Martian landscape, lack real-world datasets with high-quality annotations. To overcome this challenge, using simulators to generate large amounts of high-quality data for researchers is a good option. Nonetheless, the creation of these simulators requires complex details such as ground texture characteristics and rock distribution, which increases research costs. In response, we introduce a novel approach – the modular terrain construction framework and construct a Mars multi-terrain simulator based on it. This innovative simulator not only simplifies the simulation process but also grants users the flexibility to alter it to their specific research needs. One of the standout features of our simulator is its capacity to generate rich metadata, such as semantic and depth, which can be used seamlessly for a multitude of downstream applications. To validate the reliability of the data produced by our simulator, we have assessed its performance on a semantic segmentation task.