Upload Code
loading-left
loading loading loading
loading-right

Loading

Profile
No self-introduction
codes (2)
Ray tracing for GPU implementation
no vote
First determine the position of the eyes and gaze direction. Then determine the proceeding from the eye through each pixel Center Ray equation. Through the rays of the light and the objects in the scene recently of intersection. If the intersection point, first of all, the shadow test rays, it is the connection point source of light, and then calculating the intersections between the light source and for blocking, if it doesn't calculate the component of the Phong model, if blocks are not accounted for. If the intersection scene for reflective surfaces, reflect light, this light will continue to intersection with scene. If the scene at the intersection of transparency, then produces a transmission of light, this light will continue to work with the intersection. If there is no intersection, or a default value. Finally fill in the color in the corresponding pixel. Recursion termination conditions: 1. the recursion depth: preset a recursion depth 2. brightne
immjx
2016-08-23
1
1
Ray tracing
no vote
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
immjx
2016-08-23
0
1
No more~