2

you all know the layerDepth value of the spriteBatch.draw() call. I'm using 3D vectors for my 2D game. Is it possible to get the layerDepth as the z value within the vertex shader? Or can I call the draw function with 3d vectors?

I need the depth of a sprite for postprocessing.

1 Answers1

0

Yes, the layerDepth is passed as the Z position of each vertex.

Normally there is a range limit of between 0 and 1 for this parameter. Although I think this is only due to position near/far planes of the SpriteBatch default projection matrix. So it might not apply to you - I don't think the values are clamped or anything.

Andrew Russell
  • 26,924
  • 7
  • 58
  • 104