10-18-2023, 12:20 PM
camera.RenderToBitmap method is using WPF's RenderTargetBitmap to render the 3D scene to a bitmap. RenderTargetBitmap may use software rendering for this. This is also probably why it takes much longer than when the 3D scene is shown on the screen - there hardware rendering is used. This is pure WPF code so I cannot do much to improve performance.
If want better performance, then you will need to use use Ab3d.DXEngine. It uses a super fast DirectX 11 rendering engine that can render 3D scene that is defined by WPF 3D and Ab3d.PowerToys objects - so you do not need to change the code that defines your scene. With Ab3d.DXEngine you will be able to call DXViewportView.RenderToBitmap that is fully hardware accelerated and will work as fast as when shown on the screen. Ab3d.DXEngine also provides significantly improved visuals. See samples here: https://github.com/ab4d/Ab3d.DXEngine.Wpf.Samples
If want better performance, then you will need to use use Ab3d.DXEngine. It uses a super fast DirectX 11 rendering engine that can render 3D scene that is defined by WPF 3D and Ab3d.PowerToys objects - so you do not need to change the code that defines your scene. With Ab3d.DXEngine you will be able to call DXViewportView.RenderToBitmap that is fully hardware accelerated and will work as fast as when shown on the screen. Ab3d.DXEngine also provides significantly improved visuals. See samples here: https://github.com/ab4d/Ab3d.DXEngine.Wpf.Samples
Andrej Benedik

