开发者

WPF: How to replace 3D object in Viewport3D with its image?

开发者 https://www.devze.com 2023-01-21 22:02 出处:网络
In my WPF application I want to add multiple 3D objects from xaml files. But if more objects I\'m having in viewport3D performance of my application becomes worse with every object I add.

In my WPF application I want to add multiple 3D objects from xaml files. But if more objects I'm having in viewport3D performance of my application becomes worse with every object I add. As I can only work with only one 3D object at the same time I thought that maybe I can replace 3D objects that I'm not using with their images and when I try to interact with some of these unused objects image is replaced ba开发者_开发知识库ck with its original 3D object.

Any suggestions on how I can get this bitmap from 3D object?


Do you need to be able to do it dynamically? If not, you can render the object, take a screenshot and then save the relevant part as a bitmap.

If you do need to be able to do it dynamically, you can render the 3D object once and the save the view as a RenderTargetBitmap and then use that in future. E.g. http://www.codeproject.com/Articles/103184/How-to-Render-Bitmap-or-to-Print-a-Visual-in-WPF.aspx

In either case, the bitmap can then be applied to a simple square as a texture.

0

精彩评论

暂无评论...
验证码 换一张
取 消