public void dragon() { var scene = new Scene(); var material = Material.GlossyMaterial(Color.HexColor(0xB7CA79), 1.5, Util.Radians(20)); var mesh = OBJ.Load("dragon.obj", material); mesh.FitInside(new Box(new Vector(-1, 0, -1), new Vector(1, 2, 1)), new Vector(0.5, 0, 0.5)); scene.Add(mesh); var floor = Material.GlossyMaterial(Color.HexColor(0xD8CAA8), 1.2, Util.Radians(5)); scene.Add(Cube.NewCube(new Vector(-50, -50, -50), new Vector(50, 0, 50), floor)); var light = Material.LightMaterial(Color.White, 75); scene.Add(Sphere.NewSphere(new Vector(-1, 10, 4), 1, light)); var mouth = Material.LightMaterial(Color.HexColor(0xFFFAD5), 500); scene.Add(Sphere.NewSphere(new Vector(-0.05, 1, -0.5), 0.03, mouth)); var camera = Camera.LookAt(new Vector(-3, 2, -1), new Vector(0, 0.6, -0.1), new Vector(0, 1, 0), 35); camera.SetFocus(new Vector(0, 1, -0.5), 0.03); var sampler = DefaultSampler.NewSampler(8, 8); var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.IterativeRender("dragon.png", 10); }
public void cylinder() { Scene scene = new Scene(); var meshes = new Mesh[] { Util.CreateMesh(Material.GlossyMaterial(Color.HexColor(0x730046), 1.6, Util.Radians(45))), Util.CreateMesh(Material.GlossyMaterial(Color.HexColor(0xBFBB11), 1.6, Util.Radians(45))), Util.CreateMesh(Material.GlossyMaterial(Color.HexColor(0xFFC200), 1.6, Util.Radians(45))), Util.CreateMesh(Material.GlossyMaterial(Color.HexColor(0xE88801), 1.6, Util.Radians(45))), Util.CreateMesh(Material.GlossyMaterial(Color.HexColor(0xC93C00), 1.6, Util.Radians(45))), }; for (int x = -6; x <= 3; x++) { var mesh = meshes[(x + 6) % meshes.Length]; for (int y = -5; y <= 4; y++) { var fx = (double)x / 2; var fy = (double)y; var fz = (double)x / 2; scene.Add(TransformedShape.NewTransformedShape(mesh, new Matrix().Translate(new Vector(fx, fy, fz)))); } } scene.Add(Sphere.NewSphere(new Vector(1, 0, 10), 3, Material.LightMaterial(Color.White, 20))); var camera = Camera.LookAt(new Vector(-5, 0, 5), new Vector(1, 0, 0), new Vector(0, 0, 1), 45); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 960, 540); renderer.IterativeRender("cylinder.png", 1000); }
public void ellipsoid() { var scene = new Scene(); var wall = Material.GlossyMaterial(Color.HexColor(0xFCFAE1), 1.333, Util.Radians(30)); scene.Add(Sphere.NewSphere(new Vector(10, 10, 10), 2, Material.LightMaterial(Color.White, 50))); scene.Add(Cube.NewCube(new Vector(-100, -100, -100), new Vector(-12, 100, 100), wall)); scene.Add(Cube.NewCube(new Vector(-100, -100, -100), new Vector(100, -1, 100), wall)); var material = Material.GlossyMaterial(Color.HexColor(0x167F39), 1.333, Util.Radians(30)); var sphere = Sphere.NewSphere(new Vector(), 1, material); for (int i = 0; i < 180; i += 30) { var m = Matrix.Identity; m = m.Scale(new Vector(0.3, 1, 5)).Mul(m); m = m.Rotate(new Vector(0, 1, 0), Util.Radians((double)i)).Mul(m); var shape = TransformedShape.NewTransformedShape(sphere, m); scene.Add(shape); } var camera = Camera.LookAt(new Vector(8, 8, 0), new Vector(1, 0, 0), new Vector(0, 1, 0), 45); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 960, 540); renderer.IterativeRender("ellipsoid.png", 1000); }
public void materialspheres() { var scene = new Scene(); var r = 0.4; Material material; material = Material.DiffuseMaterial(Color.HexColor(0x334D5C)); scene.Add(Sphere.NewSphere(new Vector(-2, r, 0), r, material)); material = Material.SpecularMaterial(Color.HexColor(0x334D5C), 2); scene.Add(Sphere.NewSphere(new Vector(-1, r, 0), r, material)); material = Material.GlossyMaterial(Color.HexColor(0x334D5C), 2, Util.Radians(50)); scene.Add(Sphere.NewSphere(new Vector(0, r, 0), r, material)); material = Material.TransparentMaterial(Color.HexColor(0x334D5C), 2, Util.Radians(20), 1); scene.Add(Sphere.NewSphere(new Vector(1, r, 0), r, material)); material = Material.ClearMaterial(2, 0); scene.Add(Sphere.NewSphere(new Vector(2, r, 0), r, material)); material = Material.MetallicMaterial(Color.HexColor(0xFFFFFF), 0, 1); scene.Add(Sphere.NewSphere(new Vector(0, 1.5, -4), 1.5, material)); scene.Add(Cube.NewCube(new Vector(-1000, -1, -1000), new Vector(1000, 0, 1000), Material.GlossyMaterial(Color.HexColor(0xFFFFFF), 1.4, Util.Radians(20)))); scene.Add(Sphere.NewSphere(new Vector(0, 5, 0), 1, Material.LightMaterial(Color.White, 25))); var camera = Camera.LookAt(new Vector(0, 3, 6), new Vector(0, 1, 0), new Vector(0, 1, 0), 30); var sampler = DefaultSampler.NewSampler(16, 16); var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.FireflySamples = 32; renderer.IterativeRender("materialspheres.png", 100); }
public static void shrender(int l, int m) { Scene scene = new Scene(); var eye = new Vector(1, 1, 1); var center = new Vector(0, 0, 0); var up = new Vector(0, 0, 1); var light = Material.LightMaterial(Color.White, 150); scene.Add(Sphere.NewSphere(new Vector(0, 0, 5), 0.5, light)); scene.Add(Sphere.NewSphere(new Vector(5, 0, 2), 0.5, light)); scene.Add(Sphere.NewSphere(new Vector(0, 5, 2), 0.5, light)); var pm = Material.GlossyMaterial(Color.HexColor(0x105B63), 1.3, Util.Radians(30)); var nm = Material.GlossyMaterial(Color.HexColor(0xBD4932), 1.3, Util.Radians(30)); var sh = SphericalHarmonic.NewSphericalHarmonic(l, m, pm, nm); scene.Add(sh); var camera = Camera.LookAt(eye, center, up, 50); var sampler = DefaultSampler.NewSampler(4, 4); sampler.SetLightMode(LightMode.LightModeAll); sampler.SetSpecularMode(SpecularMode.SpecularModeFirst); var renderer = Renderer.NewRenderer(scene, camera, sampler, 1600 / 2, 1600 / 2); renderer.IterativeRender("sh.png", 10); }
public void refraction() { var scene = new Scene(); var glass = Material.ClearMaterial(1.5, 0); // add a sphere primitive scene.Add(Sphere.NewSphere(new Vector(-1.5, 0, 0.5), 1, glass)); // add a mesh sphere var mesh = STL.Load("sphere.stl", glass); mesh.SmoothNormals(); mesh.Transform(new Matrix().Translate(new Vector(1.5, 0, 0.5))); scene.Add(mesh); // add the floor scene.Add(Plane.NewPlane(new Vector(0, 0, -1), new Vector(0, 0, 1), Material.DiffuseMaterial(Color.White))); // add the light scene.Add(Sphere.NewSphere(new Vector(0, 0, 5), 1, Material.LightMaterial(Color.White, 30))); var camera = Camera.LookAt(new Vector(0, -5, 5), new Vector(0, 0, 0), new Vector(0, 0, 1), 50); var sampler = DefaultSampler.NewSampler(16, 8); sampler.SetSpecularMode(SpecularMode.SpecularModeAll); var renderer = Renderer.NewRenderer(scene, camera, sampler, 960, 540); renderer.IterativeRender("refraction.png", 100); }
static void Main(string[] args) { int width = 256; int height = 144; Scene scene = new Scene(); scene.Add(Sphere.NewSphere(new Vector(1.5, 1.25, 0), 1.25, Material.SpecularMaterial(Color.HexColor(0x004358), 1.3))); scene.Add(Sphere.NewSphere(new Vector(-1, 1, 2), 1, Material.SpecularMaterial(Color.HexColor(0xFFE11A), 1.3))); scene.Add(Sphere.NewSphere(new Vector(-2.5, 0.75, 0), 0.75, Material.SpecularMaterial(Color.HexColor(0xFD7400), 1.3))); scene.Add(Sphere.NewSphere(new Vector(-0.75, 0.5, -1), 0.5, Material.ClearMaterial(1.5, 0))); scene.Add(Cube.NewCube(new Vector(-10, -1, -10), new Vector(10, 0, 10), Material.GlossyMaterial(Color.White, 1.1, Util.Radians(10)))); scene.Add(Sphere.NewSphere(new Vector(-1.5, 4, 0), 0.5, Material.LightMaterial(Color.White, 30))); Camera camera = Camera.LookAt(new Vector(0, 2, -5), new Vector(0, 0.25, 3), new Vector(0, 1, 0), 45); camera.SetFocus(new Vector(-0.75, 1, -1), 0.1); DefaultSampler sampler = DefaultSampler.NewSampler(4, 8); sampler.SetSpecularMode(SpecularMode.SpecularModeFirst); Renderer renderer = Renderer.NewRenderer(scene, camera, sampler, width, height); renderer.IterativeRender("./out.png", 200); }
public void runway() { const int radius = 2; const int height = 3; const int emission = 3; Scene scene = new Scene(); var white = Material.DiffuseMaterial(Color.White); var floor = Cube.NewCube(new Vector(-250, -1500, -1), new Vector(250, 6200, 0), white); scene.Add(floor); var light = Material.LightMaterial(Color.Kelvin(2700), emission); for (int y = 0; y <= 6000; y += 40) { scene.Add(Sphere.NewSphere(new Vector(-100, (double)y, height), radius, light)); scene.Add(Sphere.NewSphere(new Vector(0, (double)y, height), radius, light)); scene.Add(Sphere.NewSphere(new Vector(100, (double)y, height), radius, light)); } for (int y = -40; y >= -750; y -= 20) { scene.Add(Sphere.NewSphere(new Vector(-10, (double)y, height), radius, light)); scene.Add(Sphere.NewSphere(new Vector(0, (double)y, height), radius, light)); scene.Add(Sphere.NewSphere(new Vector(10, (double)y, height), radius, light)); } var green = Material.LightMaterial(Color.HexColor(0x0BDB46), emission); var red = Material.LightMaterial(Color.HexColor(0xDC4522), emission); for (int x = -160; x <= 160; x += 10) { scene.Add(Sphere.NewSphere(new Vector((double)x, -20, height), radius, green)); scene.Add(Sphere.NewSphere(new Vector((double)x, 6100, height), radius, red)); } scene.Add(Sphere.NewSphere(new Vector(-160, 250, height), radius, red)); scene.Add(Sphere.NewSphere(new Vector(-180, 250, height), radius, red)); scene.Add(Sphere.NewSphere(new Vector(-200, 250, height), radius, light)); scene.Add(Sphere.NewSphere(new Vector(-220, 250, height), radius, light)); for (int i = 0; i < 5; i++) { var y = (double)((i + 1) * -120); for (int j = 1; j <= 4; j++) { var x = (double)(j + 4) * 7.5; scene.Add(Sphere.NewSphere(new Vector(x, y, height), radius, red)); scene.Add(Sphere.NewSphere(new Vector(-x, y, height), radius, red)); scene.Add(Sphere.NewSphere(new Vector(x, -y, height), radius, light)); scene.Add(Sphere.NewSphere(new Vector(-x, -y, height), radius, light)); } } var camera = Camera.LookAt(new Vector(0, -1500, 200), new Vector(0, -100, 0), new Vector(0, 0, 1), 20); camera.SetFocus(new Vector(0, 20000, 0), 1); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.IterativeRender("runway.png", 1000); }
public void volume() { string[] imglist = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\images", "*.*", SearchOption.AllDirectories); List <Bitmap> bmplist = new List <Bitmap>(); foreach (string file in imglist) { Console.WriteLine(file); bmplist.Add(new Bitmap(file)); } Scene scene = new Scene(); scene.Color = Color.White; Color[] colors = new Color[] { // HexColor(0xFFF8E3), Color.HexColor(0x004358), Color.HexColor(0x1F8A70), Color.HexColor(0xBEDB39), Color.HexColor(0xFFE11A), Color.HexColor(0xFD7400), }; const double start = 0.2; const double size = 0.01; const double step = 0.1; List <Volume.VolumeWindow> windows = new List <Volume.VolumeWindow>(); for (int i = 0; i < colors.Length; i++) { var lo = start + step * (double)i; var hi = lo + size; var material = Material.GlossyMaterial(colors[i], 1.3, Util.Radians(0)); var w = new Volume.VolumeWindow(lo, hi, material); windows.Add(w); } var box = new Box(new Vector(-1, -1, -0.2), new Vector(1, 1, 1)); var volume = Volume.NewVolume(box, bmplist.ToArray(), 3.4 / 0.9765625, windows.ToArray()); scene.Add(volume); var camera = Camera.LookAt(new Vector(0, -3, -3), new Vector(0, 0, 0), new Vector(0, 0, -1), 35); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 512, 512); renderer.IterativeRender("volume.png", 1000); }
public void hits() { var scene = new Scene(); var material = Material.DiffuseMaterial(new Color(0.95, 0.95, 1)); var light = Material.LightMaterial(Color.White, 300); scene.Add(Sphere.NewSphere(new Vector(-0.75, -0.75, 5), 0.25, light)); scene.Add(Cube.NewCube(new Vector(-1000, -1000, -1000), new Vector(1000, 1000, 0), material)); var mesh = STL.Load("hits.stl", material); mesh.SmoothNormalsThreshold(Util.Radians(10)); mesh.FitInside(new Box(new Vector(-1, -1, 0), new Vector(1, 1, 2)), new Vector(0.5, 0.5, 0)); scene.Add(mesh); var camera = Camera.LookAt(new Vector(1.6, -3, 2), new Vector(-0.25, 0.5, 0.5), new Vector(0, 0, 1), 50); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 1500, 1500); renderer.IterativeRender("hits.png", 1000); }
public void toybrick() { const double H = 1.46875; var scene = new Scene(); scene.Color = Color.White; var meshes = new Mesh[] { Util.CreateBrick(0xF2F3F2), // white Util.CreateBrick(0xC4281B), // bright red Util.CreateBrick(0x0D69AB), // bright blue Util.CreateBrick(0xF5CD2F), // bright yellow Util.CreateBrick(0x1B2A34), // black Util.CreateBrick(0x287F46), // dark green }; for (int x = -30; x <= 50; x += 2) { for (int y = -50; y <= 20; y += 4) { var h = new Random().Next(5) + 1; for (int i = 0; i < h; i++) { var dy = 0; if (((x / 2 + i) % 2) == 0) { dy = 2; } var z = i * H; var mnum = new Random().Next(meshes.Length); var mesh = meshes[mnum]; var m = new Matrix().Translate(new Vector((double)x, (double)(y + dy), (double)z)); scene.Add(TransformedShape.NewTransformedShape(mesh, m)); } } } var camera = Camera.LookAt(new Vector(-23, 13, 20), new Vector(0, 0, 0), new Vector(0, 0, 1), 45); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 960, 540); renderer.IterativeRender("toybrick.png", 1000); }
public void love() { var scene = new Scene(); var material = Material.GlossyMaterial(Color.HexColor(0xF2F2F2), 1.5, Util.Radians(20)); scene.Add(Cube.NewCube(new Vector(-100, -1, -100), new Vector(100, 0, 100), material)); var heart = Material.GlossyMaterial(Color.HexColor(0xF60A20), 1.5, Util.Radians(20)); var mesh = STL.Load("love.stl", heart); mesh.FitInside(new Box(new Vector(-0.5, 0, -0.5), new Vector(0.5, 1, 0.5)), new Vector(0.5, 0, 0.5)); scene.Add(mesh); scene.Add(Sphere.NewSphere(new Vector(-2, 10, 2), 1, Material.LightMaterial(Color.White, 30))); scene.Add(Sphere.NewSphere(new Vector(0, 10, 2), 1, Material.LightMaterial(Color.White, 30))); scene.Add(Sphere.NewSphere(new Vector(2, 10, 2), 1, Material.LightMaterial(Color.White, 30))); var camera = Camera.LookAt(new Vector(0, 1.5, 2), new Vector(0, 0.5, 0), new Vector(0, 1, 0), 35); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 960, 540); renderer.IterativeRender("love.png", 1000); }
public void teapot() { var scene = new Scene(); scene.Add(Sphere.NewSphere(new Vector(-2, 5, -3), 0.5, Material.LightMaterial(Color.White, 50))); scene.Add(Sphere.NewSphere(new Vector(5, 5, -3), 0.5, Material.LightMaterial(Color.White, 50))); scene.Add(Cube.NewCube(new Vector(-30, -1, -30), new Vector(30, 0, 30), Material.SpecularMaterial(Color.HexColor(0xFCFAE1), 2))); var mesh = OBJ.Load("teapot.obj", Material.SpecularMaterial(Color.HexColor(0xB9121B), 2)); mesh.SmoothNormals(); scene.Add(mesh); var camera = Camera.LookAt(new Vector(2, 5, -6), new Vector(0.5, 1, 0), new Vector(0, 1, 0), 45); var sampler = DefaultSampler.NewSampler(4, 4); sampler.SpecularMode = SpecularMode.SpecularModeFirst; var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.FireflySamples = 64; renderer.IterativeRender("teapot.png", 1000); }
public void bunny() { var scene = new Scene(); var material = Material.GlossyMaterial(Color.HexColor(0xF2EBC7), 1.5, Util.Radians(0)); var mesh = OBJ.Load("bunny.obj", material); mesh.SmoothNormals(); mesh.FitInside(new Box(new Vector(-1, 0, -1), new Vector(1, 2, 1)), new Vector(0.5, 0, 0.5)); scene.Add(mesh); var floor = Material.GlossyMaterial(Color.HexColor(0x33332D), 1.2, Util.Radians(20)); scene.Add(Cube.NewCube(new Vector(-10000, -10000, -10000), new Vector(10000, 0, 10000), floor)); scene.Add(Sphere.NewSphere(new Vector(0, 5, 0), 1, Material.LightMaterial(Color.White, 20))); scene.Add(Sphere.NewSphere(new Vector(4, 5, 4), 1, Material.LightMaterial(Color.White, 20))); var camera = Camera.LookAt(new Vector(-1, 2, 3), new Vector(0, 0.75, 0), new Vector(0, 1, 0), 50); var sampler = DefaultSampler.NewSampler(4, 4); sampler.SetSpecularMode(SpecularMode.SpecularModeFirst); var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.FireflySamples = 128; renderer.IterativeRender("bunny.png", 1000); }
public void qbert() { var scene = new Scene(); var floor = Material.GlossyMaterial(Color.HexColor(0xFCFFF5), 1.2, Util.Radians(30)); var cube = Material.GlossyMaterial(Color.HexColor(0xFF8C00), 1.3, Util.Radians(20)); var ball = Material.GlossyMaterial(Color.HexColor(0xD90000), 1.4, Util.Radians(10)); int n = 7; var fn = (double)n; for (int z = 0; z < n; z++) { for (int x = 0; x < n - z; x++) { for (int y = 0; y < n - z - x; y++) { (var fx, var fy, var fz) = ((double)x, (double)y, (double)z); scene.Add(Cube.NewCube(new Vector(fx, fy, fz), new Vector(fx + 1, fy + 1, fz + 1), cube)); if (x + y == n - z - 1) { if (new Random().NextDouble() > 0.75) { scene.Add(Sphere.NewSphere(new Vector(fx + 0.5, fy + 0.5, fz + 1.5), 0.35, ball)); } } } } } scene.Add(Cube.NewCube(new Vector(-1000, -1000, -1), new Vector(1000, 1000, 0), floor)); scene.Add(Sphere.NewSphere(new Vector(fn, fn / 3, fn * 2), 1, Material.LightMaterial(Color.White, 100))); var camera = Camera.LookAt(new Vector(fn * 2, fn * 2, fn * 2), new Vector(0, 0, fn / 4), new Vector(0, 0, 1), 35); var sampler = DefaultSampler.NewSampler(4, 4); var renderer = Renderer.NewRenderer(scene, camera, sampler, 960, 540); renderer.FireflySamples = 32; renderer.IterativeRender("qbert.png", 100); }
public void veachscene() { Scene scene = new Scene(); Material material; Mesh mesh; material = Material.DiffuseMaterial(Color.White); mesh = OBJ.Load("veach_scene/backdrop.obj", material); scene.Add(mesh); material = Material.MetallicMaterial(Color.White, Util.Radians(20), 0); mesh = OBJ.Load("veach_scene/bar0.obj", material); scene.Add(mesh); material = Material.MetallicMaterial(Color.White, Util.Radians(15), 0); mesh = OBJ.Load("veach_scene/bar1.obj", material); scene.Add(mesh); material = Material.MetallicMaterial(Color.White, Util.Radians(10), 0); mesh = OBJ.Load("veach_scene/bar2.obj", material); scene.Add(mesh); material = Material.MetallicMaterial(Color.White, Util.Radians(5), 0); mesh = OBJ.Load("veach_scene/bar3.obj", material); scene.Add(mesh); material = Material.MetallicMaterial(Color.White, Util.Radians(0), 0); mesh = OBJ.Load("veach_scene/bar4.obj", material); scene.Add(Sphere.NewSphere(new Vector(3.75, 4.281, 0), 1.8 / 2, Material.LightMaterial(Color.White, 3))); scene.Add(Sphere.NewSphere(new Vector(1.25, 4.281, 0), 0.6 / 2, Material.LightMaterial(Color.White, 9))); scene.Add(Sphere.NewSphere(new Vector(-1.25, 4.281, 0), 0.2 / 2, Material.LightMaterial(Color.White, 27))); scene.Add(Sphere.NewSphere(new Vector(-3.75, 4.281, 0), 0.066 / 2, Material.LightMaterial(Color.White, 81.803))); scene.Add(Sphere.NewSphere(new Vector(0, 10, 4), 1, Material.LightMaterial(Color.White, 50))); var camera = Camera.LookAt(new Vector(0, 5, 12), new Vector(0, 1, 0), new Vector(0, 1, 0), 50); var sampler = DefaultSampler.NewSampler(4, 8); sampler.SpecularMode = SpecularMode.SpecularModeAll; sampler.LightMode = LightMode.LightModeAll; var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.IterativeRender("veachscene.png", 1000); }
public void sdf() { var scene = new Scene(); var light = Material.LightMaterial(Color.White, 180); double d = 4.0; scene.Add(Sphere.NewSphere(new Vector(-1, -1, 0.5).Normalize().MulScalar(d), 0.25, light)); scene.Add(Sphere.NewSphere(new Vector(0, -1, 0.25).Normalize().MulScalar(d), 0.25, light)); scene.Add(Sphere.NewSphere(new Vector(-1, 1, 0).Normalize().MulScalar(d), 0.25, light)); var material = Material.GlossyMaterial(Color.HexColor(0x468966), 1.2, Util.Radians(20)); var sphere = SphereSDF.NewSphereSDF(0.65); var cube = CubeSDF.NewCubeSDF(new Vector(1, 1, 1)); var roundedCube = IntersectionSDF.NewIntersectionSDF(new List <SDF> { sphere, cube }); var a = CylinderSDF.NewCylinderSDF(0.25, 1.1); var b = TransformSDF.NewTransformSDF(a, new Matrix().Rotate(new Vector(1, 0, 0), Util.Radians(90))); var c = TransformSDF.NewTransformSDF(a, new Matrix().Rotate(new Vector(0, 0, 1), Util.Radians(90))); var difference = DifferenceSDF.NewDifferenceSDF(new List <SDF> { roundedCube, a, b, c }); var sdf = TransformSDF.NewTransformSDF(difference, new Matrix().Rotate(new Vector(0, 0, 1), Util.Radians(30))); scene.Add(SDFShape.NewSDFShape(sdf, material)); var floor = Material.GlossyMaterial(Color.HexColor(0xFFF0A5), 1.2, Util.Radians(20)); scene.Add(Plane.NewPlane(new Vector(0, 0, -0.5), new Vector(0, 0, 1), floor)); var camera = Camera.LookAt(new Vector(-3, 0, 1), new Vector(0, 0, 0), new Vector(0, 0, 1), 35); var sampler = DefaultSampler.NewSampler(4, 4); sampler.LightMode = LightMode.LightModeAll; sampler.SpecularMode = SpecularMode.SpecularModeAll; var renderer = Renderer.NewRenderer(scene, camera, sampler, 1920, 1080); renderer.IterativeRender("sdf.png", 1000); }