public void Render(Camera cam, Scene Scene, Template.Surface screen) { float viewportX, viewportY, viewportZ, i = 0; Vector3 startpoint, raydir; Primitives.Plane viewport = cam.Screen; for (int y = 0; y < screen.height; y++) { for (int x = 0; x < screen.width / 2; x++) { startpoint = cam.Position; Vector3 ScreenPixel = cam.Corner1 + new Vector3(x, -y, 0); raydir = ScreenPixel - startpoint; raydir.Normalize(); Ray ray1 = new Ray(startpoint, raydir, Scene.PrimitivesList, 10f, Intersections, Scene.LightList[0]); if (x % 5 == 0 && y == 256) { DrawRay(startpoint, raydir, ray1.Length); } int Color = CreateColor((int)ray1.Color.X, (int)ray1.Color.Y, (int)ray1.Color.Z); Image[x + y * 512] = Color; } } }