static void Main(string[] args) { int nx = 300; int ny = 300; int ns = 50; var(world, cam) = Scenes.CornellScene("../../../../SampleObj/teapot.obj", new SunsetquestRandom(), nx, ny); var worldBVH = new BVH(world); var wl = new IHitable[] { worldBVH }; var pathTracer = new PathTracer(nx, ny, ns, false); uint totalRayCount = 0; sw.Start(); var image = pathTracer.RenderScene(wl, cam, ref totalRayCount, (pcComplete => Console.WriteLine($"{pcComplete}%"))); sw.Stop(); image.Save("test.png"); float seconds = sw.ElapsedMilliseconds / 1000f; float rate = totalRayCount / seconds; float mRate = rate / 1_000_000; Console.WriteLine($"totalRayCount: {totalRayCount}"); Console.WriteLine($"BVH max depth: {worldBVH.MaxTestCount}"); Console.WriteLine($"Duration: {seconds} | Rate: {mRate} MRays / sec."); }
public static void Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, TraceWriter log) { string name = req.Query["name"]; int nx = 300; int ny = 300; int ns = 50; string path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath; path = Path.GetFullPath(path); path = Path.GetDirectoryName(path); path += @"\..\teapot.obj"; log.Info($"Obj path: {path}"); var(world, cam) = Scenes.CornellScene(path, new SunsetquestRandom(), nx, ny); var worldBVH = new BVH(world); var wl = new IHitable[] { worldBVH }; var pathTracer = new PathTracer(nx, ny, ns, false); uint totalRayCount = 0; var sw = Stopwatch.StartNew(); var image = pathTracer.RenderScene(wl, cam, ref totalRayCount, (pcComplete => log.Info($"{pcComplete}%"))); sw.Stop(); //image.Save("test.png"); float seconds = sw.ElapsedMilliseconds / 1000f; float rate = totalRayCount / seconds; float mRate = rate / 1_000_000; log.Info($"totalRayCount: {totalRayCount}"); log.Info($"BVH max depth: {worldBVH.MaxTestCount}"); log.Info($"Duration: {seconds} | Rate: {mRate} MRays / sec."); log.Info($"C# Queue trigger function processed: "); }