tags:

views:

27

answers:

1

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 back with its original 3D object.

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

A: 

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.

Jackson Pope
Yes I need to be able to do it dynamically. But as I understand, with RenderTargetBitmap I can get bitmap only for whole Viewport3D, but I need to get bitmaps for separate 3D objects in viewport and then replace them with bitmaps if I'm not using them.
Maris
You could render it to a smaller Viewport on its own, then save the image before adding it to a texture in the real Viewport. As long as the backdrop of the two Viewports are the same it should look ok.
Jackson Pope
If I use RenderTargetBitmap for original viewport3d then I get image as I need, but when I add modelVisual3D to temporary viewport3D to get image of my 3d object I get blank image :(
Maris