public static SceneDescription SpheresReflection(float roughness = 0.01f) { var primitives = new List <Primitive>() { new GeometricPrimitive(new Sphere(Transform.Identity, 0.5f), new PlasticMaterial(new Spectrum(1), new Spectrum(1), roughness)), new GeometricPrimitive(new Sphere(Transform.Translate(1, 0, 0), 0.25f), new MatteMaterial(new Spectrum(1, 0, 0), 0)), new GeometricPrimitive(new Sphere(Transform.Translate(-1, 0, 0), 0.25f), new MatteMaterial(new Spectrum(0, 1, 0), 0)), new GeometricPrimitive(new Sphere(Transform.Translate(0, 0.75f, 0), 0.25f), new MatteMaterial(new Spectrum(0, 0, 10), 0)), new GeometricPrimitive(new Sphere(Transform.Translate(0, -1, 0), 0.25f), new MatteMaterial(new Spectrum(1, 1, 0), 0)), new GeometricPrimitive(new Sphere(Transform.Translate(-0.7f, 0.7f, 0), 0.25f), new MirrorMaterial(new Spectrum(1))), new GeometricPrimitive(new Sphere(Transform.Translate(0.7f, 0.7f, 0), 0.25f), new MirrorMaterial(new Spectrum(1))), new GeometricPrimitive(new Sphere(Transform.Translate(-0.7f, -0.7f, 0), 0.25f), new MirrorMaterial(new Spectrum(1))), new GeometricPrimitive(new Sphere(Transform.Translate(0.7f, -0.7f, 0), 0.25f), new MirrorMaterial(new Spectrum(1))), }; var lights = new List <Light>() { new PointLight(Transform.Translate(1, 1, -5), new Spectrum(25)), new PointLight(Transform.Translate(-3, -3, 3), new Spectrum(10)), }; return(new SceneDescription(new PrimitiveList(primitives), lights, OrthographicCamera.Create(new Point3 <float>(0, 0, -5)))); }
public static SceneDescription AreaLight(bool secondLight) { var lightTransform = Transform.LookAt(new Point3 <float>(0.5f, 0.75f, -0.5f), new Point3 <float>(0, 0, 0), new Vector3 <float>(0, 1, 0)).Inverse(); var lightShape = new Disk(lightTransform, 0.75f); var light = new DiffuseAreaLight(lightTransform, new Spectrum(5), lightShape, 1, true); var lightTransform2 = Transform.LookAt(new Point3 <float>(-1, -1.5f, -1f), new Point3 <float>(0, 0, 0), new Vector3 <float>(0, 1, 0)).Inverse(); var lightShape2 = new Disk(lightTransform2, 3); var light2 = new DiffuseAreaLight(lightTransform2, new Spectrum(1, 0.07f, 0.57f), lightShape2, 1, true); var primitives = new List <Primitive>() { new GeometricPrimitive(new Sphere(Transform.Translate(0, 0, 0), 0.5f), new MatteMaterial(new Spectrum(1), 0)), //new GeometricPrimitive(new Disk(Transform.Translate(0, -1f, 0), 2), new MatteMaterial(new Spectrum(1), 0)), new GeometricPrimitive(lightShape, new MatteMaterial(new Spectrum(1), 0), light) }; if (secondLight) { primitives.Add(new GeometricPrimitive(lightShape2, new MatteMaterial(new Spectrum(1), 0), light2)); } var lights = new List <Light>() { light }; if (secondLight) { lights.Add(light2); } return(new SceneDescription(new PrimitiveList(primitives), lights, OrthographicCamera.Create(new Point3 <float>(0, 0, -5)))); }
public static SceneDescription ManySpheres() { var primitives = new List <Primitive>(); for (var i = 0; i < 200; ++i) { var spectrum = new Spectrum(Random.Shared.NextSingle(), Random.Shared.NextSingle(), Random.Shared.NextSingle()); Material material; if (Random.Shared.NextSingle() > 0.7) { material = new MirrorMaterial(spectrum); } else { //material = new MatteMaterial(spectrum, 0); material = new PlasticMaterial(spectrum, new Spectrum(1), Random.Shared.NextSingle()); } var transform = Transform.Translate(Random.Shared.NextSingle() * 2 - 1, Random.Shared.NextSingle() * 2 - 1, Random.Shared.NextSingle() * 2 - 1); var radius = 0.1f + Random.Shared.NextSingle() * 0.1f; primitives.Add(new GeometricPrimitive(new Sphere(transform, radius), material)); } var lights = new List <Light>(); for (var i = 0; i < 5; ++i) { var transform = Transform.Translate(Random.Shared.NextSingle() * 2 - 1, Random.Shared.NextSingle() * 2 - 1, Random.Shared.NextSingle() * -3 - 5); var spectrum = new Spectrum(Random.Shared.NextSingle() * 25 + 15); lights.Add(new PointLight(transform, spectrum)); } return(new SceneDescription(new PrimitiveList(primitives), lights, OrthographicCamera.Create(new Point3 <float>(0, 0, -5)))); }