public Raytracer() { camera = new Camera(this, new Vector3(0f, 1f, 0f)); skybox = new Texture("Textures/skybox2.bmp"); // Make the skybox use HDR: for (int i = 0; i < skybox.Width; i++) { for (int j = 0; j < skybox.Height; j++) { skybox.Data[i, j] *= 1.2f; } } // Now we will compose the scene with a couple of objects and a couple of light sources: // OBJECTS: // white ball scene.AddPrimitive(new Sphere(new Vector3(0, 1.5f, -6f), 1.5f, new Material(Vector3.One, .5f, 100f))); // green ball scene.AddPrimitive(new Sphere(new Vector3(3f, 1.5f, -6f), 0.5f, new Material(new Vector3(0f, 1f, 0f), .75f, 10f))); // blue ball scene.AddPrimitive(new Sphere(new Vector3(-3f, 1.5f, -6f), 1, new Material(new Vector3(0f, 0f, 1f), .5f, 25f))); scene.AddPrimitive(new Quad(new Vector3(-5f, 0f, -10f), new Vector3(10f, 0f, 0f), new Vector3(0f, 10f, 0f), new Material(Vector3.One * 0.5f, 1f))); // normal is: Vector3.UnitY Texture floortexture = new Texture("Textures/floor.bmp"); scene.AddPrimitive(new TexturedPlane(floortexture, new Vector3(.8f, 0f, -.6f), new Vector3(-.6f, 0f, -.8f), 0f, new Material(Vector3.One))); if (jaccoPresent) { Texture jbtexture = new Texture("Textures/jb.png"); scene.AddPrimitive(new TexturedQuad( new Vector3(2.5f, 3f, -5.4f), new Vector3(2f, 0f, 1f), new Vector3(0f, 2f, 0f), jbtexture, new Material(Vector3.One) )); scene.AddPrimitive(new TexturedSphere( new Vector3(-3f, 2f, 3f), 1, jbtexture, new Material(Vector3.One, .5f, 25f) )); } // .obj file // scene.AddPrimitive(new Mesh("Objects/little_test.obj", new Vector3(-4.5f, 1f, -4f), 1f, new Material(new Vector3(1f, 1f, 0f)))); // scene.AddPrimitive(new Mesh("Objects/decimated_teapot.obj", new Vector3(0f, 0.5f, -2f), 1f, new Material(new Vector3(1f, 1f, 0f)))); // LIGHT SOURCES: // Ambient scene.AddLight(new Light(Vector3.One * 0.1f)); scene.AddLight(new PointLight(new Vector3(-3f, 2.5f, -3f), Vector3.One * 4f)); scene.AddLight(new PointLight(new Vector3(3.3f, 4.7f, -4f), Vector3.One * 1f)); scene.AddLight(new DirectionalLight(new Vector3(-1f, -5f, -2.5f), Vector3.One * .01f)); Triangle arealighttriangle = new Triangle(new Vector3(-2.1f, 3f, 3f), new Vector3(-2f, 3f, 3f), new Vector3(-2f, 3f, 3.5f), new Material(Vector3.One)); scene.AddLight(new AreaLight(arealighttriangle, arealighttriangle.material.diffuseColor * 5f)); // scene.AddPrimitive(arealighttriangle); scene.AddLight(new Spotlight(new Vector3(-2f, 2f, 0f), new Vector3(0f, -1f, 0f), (float)Math.PI / 3f, Utils.BLUE * 10f)); scene.AddLight(new Spotlight(new Vector3(3f, 3f, -3f), new Vector3(1f, -1f, 0f), (float)Math.PI / 3f, Utils.RED * 10f)); }