0

Strange rendering behavior of BillboardTextVisual3D if an object is created during view rotation

Anonymous 10 years ago 0
This discussion was imported from CodePlex

3dfx_IceFire wrote at 2014-03-04 10:29:

I am using the Helix 3D Toolkit to draw a 3D diagram. I am currently using BillboardTextVisual3D objects for the axis designations since BillboardTextGroupVisual3D shows me some other rendering issues (see my other thread).
To improve the usability of the diagram the position of the axis designation change when the diagram is rotated to ensure the user can always see it.
I am using the Viewport3D.Camera.Changed event to calculate the current camera angle and trigger an update of the coordinate system axis if neccessary. The axis itself is a class which inherits from ModelVisual3D and contains several BillboardTextVisual3D objects as children. Each axis provides a function which recreates the Billboard objects and adds them as childs to itself:
public void UpdateModel()
      {
         this.Content = null;
         this.Children.Clear();
         ModelVisual3D labelTextGroup = new ModelVisual3D();

         if (0 == intervals)
         {
            return; 
         }
         var axesMeshBuilder = new MeshBuilder();
         var path = new List<Point3D>();
         path.Add(new Point3D(0.0, 0.0, 0.0));
         path.Add((Point3D)((double)intervals * Direction));
         axesMeshBuilder.AddTube(path, LineThickness, 4, true);

         labelTextGroup.Children.Add(new BillboardTextVisual3D()
         {
            Text = Caption,
            Position = (Point3D)((double)intervals * 0.5 * Direction + 3.0 * DescriptionOrientation),
            FontFamily = new FontFamily("Courier New"),
            FontSize = this.fontSize,
            Background = Brushes.White
         });

         for (int i = 0; i <= intervals; ++i)
         {
            // render description 3D label
            double current = begin + (double)i * intervalSize;

            labelTextGroup.Children.Add(new BillboardTextVisual3D()
            {
               Text = current.ToString(),
               Position = (Point3D)((double)i * Direction + (FontSize * 0.07) * DescriptionOrientation),
               FontFamily = new FontFamily("Courier New"),
               FontSize = this.fontSize,
               Background = Brushes.White
            });
         }

         this.Children.Add(labelTextGroup);
         GeometryModel3D axesModel = new GeometryModel3D(axesMeshBuilder.ToMesh(), Materials.Black);
         this.Content = axesModel;
         
      }
The problem which occurs now is that if I rotate the 3d plot in such a way that the position of the axis designation changes while the model is still in rotation due to its simulated inertia after I release the mouse button, the billboard objects go haywire (see my screenshot).

Left side is normal and how it is desired, right side is how it looks like after I rotated the object a bit around. It is interesting that the problem does not occur if I am still pressing the mouse button while the axis position changes.
I am using the latest version of Helix 3D Toolkit, C#, .NET 4. Let me know if you need more parts of my source code.
If I am using a BillboardTextGroupVisual3D object the problem does not occur.