10-18-2023, 10:14 AM
Hi,
RenderToBitmap takes a long time (~60 seconds consistently) to render a 2048x2048 image. This seems excessive as in the onscreen view I can render in realtime.
Is this expected behaviour? If so, are there any workarounds for it?
I'm calling this routine:
public RenderTargetBitmap RenderToBitmap(Brush backgroundBrush = null, int dpi = 96);
RenderToBitmap takes a long time (~60 seconds consistently) to render a 2048x2048 image. This seems excessive as in the onscreen view I can render in realtime.
Is this expected behaviour? If so, are there any workarounds for it?
I'm calling this routine:
public RenderTargetBitmap RenderToBitmap(Brush backgroundBrush = null, int dpi = 96);
Code:
var viewport3D = new Viewport3D();
viewport3D.Width = 2048;
viewport3D.Height = 2048;
var camera = new FirstPersonCamera();
camera.Position = new Point3D(0, 0, 0);
camera.Bank = 0;
camera.Heading = 0;
camera.Attitude = -90;
camera.FieldOfView = 92;
camera.TargetViewport3D = viewport3D;
var displayModels = objs.AsModel3DGroup();
foreach (var m in objs.Values)
{
viewport3D.Children.Add(m.CreateModelVisual3D());
}
camera.Refresh();
Stopwatch renderStopWatch = new Stopwatch();
renderStopWatch.Start();
var img = camera.RenderToBitmap(backgroundBrush);
renderStopWatch.Stop();