views:

332

answers:

1

I want to present up to 300 strings (just a few words) in a Viewport3D - fast! I want to render them on different Z positions and zoom in and out fluently.

The ways I have found so far to render text in a Viewport3D:

  • Put a TextBlock in a Viewport2DVisual3D.
  • This guy's PlanarText class.
  • The same guy's SolidText class.
  • Create my own 2D panel and align TextBlocks on it. Call InvalidateArrange() every time I update the camera position.

All of these are extremely slow and far apart from zooming fluently even with 10 strings only. Does anyone have a solution for this handy? It's got to be possible to render some text in a Viewport3D without waiting seconds!

A: 

Have you tried using a VisualBrush as the material for each GeometryModel3D?

Something like this:

<GeometryModel3D>
  <GeometryModel3D.Geometry>
    <MeshGeometry3D Positions="0,0,0 1,0,0 1,1,0 0,1,0" TriangleIndices="0,1,2 2,3,0" />
  </GeometryModel3D.Geometry>
  <GeometryModel3D.Material>
    <VisualBrush ...>
      <VisualBrush.Visual>
        <TextBlock Text="Some text here" />
      </VisualBrush.Visual>
    </VisualBrush>
   </GeometryModel3D.Material>
 </GeometryModel3D>
Ray Burns
Just tried this yesterday - and I guess I found out the reason for the performance problems now: If the text has a background color, so the object is shaped rectangularly, everything works fast. But as soon as I want to see other objects through the text (not transparency, but through the hOles), it gets slow.
eWolf