How to state Z-Order? (D3DX DX 9 honored the Z-depth of sprites (orthogonal projection)).

Feb 27, 2015 at 9:35 AM
Edited Feb 27, 2015 at 9:36 AM
I see in the demo code, the following SlimDX draw:

sprite.Draw(srvTexture, new Vector2(300, 170), new Vector2(150, 150), new Vector2(75, 75), new Radians(totalMillisec / 1000.0), CoordinateType.Absolute);

It uses a Vector2, not Vector3 like the MS DX version had.

MS DX sprite implemented the Z depth as a double between 0 (furthest) and 1 (closest), so that the developer didn't need to use the painters algorithm to draw the sprites.

Using hardware Z depth to order the sprites has got to be much faster than using the painters algorithm in software: sorting by a Z order, and drawing front to back....

Will SlimDX / SharpDX SpriteTextRenderer be supporting Z-depth in the future?
Coordinator
Mar 2, 2015 at 5:50 PM
Edited Mar 2, 2015 at 5:51 PM
Hi Sarah,

drawing with depth testing enabled comes with some problems. Besides the need to draw to an offscreen surface and re-drawing everything to the screen, the most problematic part is transparency. This is quite hard to get correct with depth-testing.
Currently, we consider transparency more important than explicit depth-ordering. Therefore, right now we have no plans on implementing a depth-coordinate.
Please take a look at the SpriteRenderer documentation for explanations about the draw order.

Nico