Oren
Oren

Reputation: 955

Attaching 2D objects to 3D objects in WPF

I have a Viewport3D object containing a scene of hierarchical Model3D objects (grouped in Model3DGroups).
I need to "attach" 2D objects to 3D elements in the scene.
I read some articles on 3D projection but I couldn't fully understand how to apply my WPF scene data to those solutions.
What is the proper way to do that? I also tried Petzold.Media3D library but I didn't understand how to use it...

Thanks

Upvotes: 0

Views: 3434

Answers (1)

Govert
Govert

Reputation: 16907

I think you are looking for the Viewport2DVisual3D class. It allows you to render any Visual2D into the 3D space.

Searching the web for more info on this class will give you examples and videos explaining how it works.

Anyway, if you are doing any WPF 3D you also need to know about the Helix Toolkit - an awesome (free) WPF 3D toolkit.

It has two classes added recently that might also be relevant to what you are doing:

  • BillboardVisual3D (quad that always faces camera) and
  • TextBillboardVisual3D (text that always faces camera).

There are useful if you want to make some 2D image that must always face towards the 3D camera.

Upvotes: 1

Related Questions