Billboard Question

I try to create a Billboard with a texture plus a written text.

Everything works fine and see both, the texture and the text.
When I move (transalte / rotate) my world the following happens:

The texture remains more or less stable. If I rotate the world to the back, the billboard flips, so that I can see it from the back.

The problem is, that the text moves out of the billboard.

So, two questions:
1. What is wrong with the text Here is the render code:

Dim sprflag As Integer
sprflag = SpriteFlags.Billboard Or SpriteFlags.AlphaBlend Or SpriteFlags.SortDepthBackToFront

' use the matrixstack to position within the world
drawArgs.matrixstack.Push()
Dim w As Matrix = Matrix.Translation(position)
Dim v As Matrix = drawArgs.device.Transform.View
Dim t As Matrix = Matrix.Scaling(scale)
drawArgs.matrixstack.MultiplyMatrixLocal(t)
sprite.Transform = drawArgs.matrixstack.Top
drawArgs.matrixstack.Pop()
sprite.SetWorldViewLH(w, v)

sprite.Begin(sprflag)
sprite.Draw(texture, Rectangle.Empty, Vector3.Empty, position, color)
If Not text = String.Empty Then
   drawArgs.device.RenderState.AlphaTestEnable = True
   Dim rect As Rectangle = New Rectangle(New Point(10, 10), System.Drawing.Size.Empty)
   font.DrawText(sprite, text, rect, DrawTextFormat.NoClip Or DrawTextFormat.ExpandTabs   Or  DrawTextFormat.WordBreak, textcolor)
   drawArgs.device.RenderState.AlphaTestEnable = False

End If
sprite.End()

2. When I move the world, the billboard doesn't move in Z-direction

Does somebody have an idea



Answer this question

Billboard Question

  • dreyx2000

    1) Try turning on SortTexture too

    2) Billboarded sprites will only rotate in 2d, not 3d, relative to the eyepoint position set in SetWorldViewLH (or RH).



  • Billboard Question