Search code examples
c#wpf3dwindows-10helix-3d-toolkit

Artifacts when capturing bitmap from Viewport3D?


I'm trying capture an image from a Viewport3D element in a WPF app. It works fine when the 3D models in the viewport are relatively close to the camera, but if I zoom out then artifacts start to show up. It seems like some kind of perspective thing, but I'm not sure why. The model seems to flatten out the more I zoom.

I'm using Helix Toolkit as the framework wrapping the 3D stuff, so my first try was to capture using Viewport3DHelper.SaveBitmap(), after that I tried using a more generic UIElement approach using a RenderTargetBitmap and writing it to disk via a PngBitmapEncoder. These yielded the same results.

My camera in question is a PerspectiveCamera, where I set the position, look direction, up direction, and the far plane distance (which I hadn't changed until trying to solve this).

Any thoughts or suggestions would be much appreciated.

Zoomed in Zoomed out

EDIT: Note this that issue does not appear when using an OrthographicCamera.


Solution

  • Try to reduce far plane distance or increase near plane distance