First of all, the eye position and line of sight direction are determined. Then determine the light equation from the eye through the center of each pixel. The nearest intersection point between the light and the object in the scene is obtained through the light. If there is an intersection point, the shadow test light is generated first, which is the light connecting the intersection point and the light source, and then whether there is a barrier between the intersection point and the light source is calculated. If there is no barrier, the Phong model component of the point is calculated, and if there is a barrier, it is not calculated. If the scene at the intersection is a reflecting surface, a reflected light is generated, and the light continues to intersect the scene. If the scene at the intersection is transparent, a transmitted light is generated, and the light continues to intersect the scene. If there is no intersection, the default value is returned. Finally, the color is filled in the corresponding pixel. Recursion end conditions: 1. Recursion depth: preset a recursion depth value. 2. Brightness value: if the contribution of reflected or refracted light is too small to be ignored, stop recursion. This system chooses VS2008 platform for development, and adopts MFC single document structure as the overall architecture of the system. The object class is the base class of objects in the scene, from which two subclasses are derived: plane class and sphere class, representing plane class and sphere class respectively. Color structure represents color, including R, G, B three color components. The material structure represents the material properties of the object in the scene, including,, three components, which represent the diffuse reflection coefficient, specular reflection coefficient and refraction coefficient of the object respectively. Vect structure represents the coordinates of points in the scene. Ray class represents light or light source. When it represents light, it contains origin and unit direction vector dir; when it represents light source, it also contains color of light source. The hit class represents the intersection class, which contains the normal vector at the intersection, the surface of the object at the intersection, and the intersection coefficient t. Scene class represents scene class, which includes object pointer array objects, light pointer array lights, number of scene objects nobjectcount, number of scene light sources nlightcount. Cscenelightdlg class is the scene light source configuration dialog box, which displays all the light sources in the current scene. Users can continue to add light sources in the dialog box. Csceneobjectdlg class configures the dialog box for scene objects, which displays all objects in the current scene. Users can continue to add objects in this dialog box. The cscenepicturedlg class is a photo configuration dialog box, which displays the current eye position, photo size, position and resolution. Users can modify this setting. Craytraceview class is the view class of the frame, which is responsible for the display of pictures. I have included a scene object in it, a concrete implementation of ray tracing