1
\$\begingroup\$

Im back again with yet another problem :( My current problem is with my billboard effect. Im having trouble trying to get the depth correct so that billboards that are closer to the player are infront of the things that are actually behind them (like in the real world). Here is a screenshot of what the problem looks like:https://www.dropbox.com/s/rvgdsp0mw4kheak/Screenshot%202015-02-24%2018.47.32.png?dl=0

You can see that the grass that is positioned in front is actually behind the one that is actually positioned in front. I have tried using...

        Globals.device.BlendState = BlendState.Opaque;
        Globals.device.DepthStencilState = DepthStencilState.Default;
        Globals.device.RasterizerState = RasterizerState.CullNone;

but it didnt work. Thanks in advance! Any ideas?

\$\endgroup\$
4
  • \$\begingroup\$ Have you set a reasonable value for the near plane for the projection matrix? It should not be too much smaller than the far plane, and it should not be 0. \$\endgroup\$
    – Ale
    Commented Feb 24, 2015 at 19:10
  • \$\begingroup\$ I'm think it's not billboards, but just planes with texture of grass. \$\endgroup\$
    – user52551
    Commented Feb 25, 2015 at 8:11
  • \$\begingroup\$ @Ale The near is set to 0.5 and the far is set to 10000f as this is the players projection \$\endgroup\$ Commented Feb 27, 2015 at 15:48
  • \$\begingroup\$ @RyanEarnshaw Billboards are in fact 2d quads which rotate if the camera is moving. I don't know if they are billboard, because I cannot see them rotating. However, try a smaller value for the far plane. If it doesn't work, you may need to set DepthStencilState, BlendState and RasterizerState values at the beginning of each frame, remembering that SpriteBatch.Begin() sets these values to DepthStencilState.None, BlendState.AlphaBlend and RasterizerState.CullCounterClockwise (source: msdn.microsoft.com/en-us/library/bb195108.aspx). If you want a good answer, post your code. \$\endgroup\$
    – Ale
    Commented Feb 28, 2015 at 19:17

0

You must log in to answer this question.

Browse other questions tagged .