AB4D Forum

Full Version: Question about Billboard Text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was Helix3D user before I found Ab3d.PowerToy.

I'm very satisfied with its performance and easy to use.

But, it is still missing some functions that Helix3D has.

1. Billboard Text : In a 3D scene we often need to apply labels next to 3D object that is moving around (rotation, translation) in the scene. These labels should always face the camera but still move with the object.

2. Fit into View : If I make some models like WireframeVisual3D then call FitIntoView methods, it doesn't work correctly.

Is there anyone who can tell me how to do those functions above in Ab3d.PowerToy??
I am glad that you like Ab3d.PowerToys library.

As you will see an even bigger advantage of Ab3d.PowerToys is that I try to provide very good support for the library.

Here are answers to your questions:

1. Billboard Text:
I have that on my todo list with high priority. I think that this can come into the next version.

However, for most cases I advise showing a 2D text in an overlay - for example displaying a TextBlock in Canvas that is drawn over Viewport3D. In this case you need to subscribe to camera and size change events and after each change reposition the TextBlock. You can get the 2D position from the 3D object with calling Point3DTo2D method that is defined on all Ab3d.PowerToys cameras.

You can check the "Camera 3D to 2D" sample in the Ab3d.PowerToys samples project.

This has many advantaged over billboards:
- you can better control the size of the text and this makes it better readable for user,
- easier to define the 2D content - you can use any WPF control
- better performance


A disadvantage is that the 2D content is always on top of 3D scene - so it cannot be hidden by other 3D objects. There you need to use billboards.

If you really need them, I might find some time next week and prepare a simple demo on how to do that with Ab3d.PowerToys.


2)
I have checked FitIntoView method again with WireframeVisual3D and it worked correctly. The only case that I have found and where FitIntoView does not work is, if you call it before the size of Viewport3D is known - for example in the constructor. The problem in this case is that the size of Viewport3D is needed to get the projection matrix.

If you are also calling FitIntoView in constructor, then please move it to a Loaded event handler - there the size of Viewport3D should be already known. Another possibility is to set Width and Height of the Viewport3D manually before calling FitIntoView.

In some other cases it may help to call RecreateWireframeModel on WireframeVisual3D.

If you have found some other use case where FitIntoView does not work, please describe it in more details - ideally with some source code so I can reproduce the problem.