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(Colour.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(Colour.HexColor(0x105B63), 1.3, Util.Radians(30)); var nm = Material.GlossyMaterial(Colour.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, false); renderer.IterativeRender("sh.png", 2); }
internal static IShape NewSphericalHarmonic(int l, int m, Material pm, Material nm) { var sh = new SphericalHarmonic(); sh.PositiveMaterial = pm; sh.NegativeMaterial = nm; sh.harmonicFunction = shFunc(l, m); sh.mesh = MC.NewSDFMesh(sh, sh.BoundingBox(), 0.01); return(sh); }