Sprite Batch interferes with Depth Buffer?

I have a few 3D models which render just fine. However, whenever I use a SpriteBatch to draw some sprite elements, the Depth Buffer seems to go all wonky. As a result, my sprites render just fine, but the models no longer render correctly (appears to be a depth buffer issue because visible models are the ones drawn last).

Is there an obvious reason this is happening



Answer this question

Sprite Batch interferes with Depth Buffer?

  • Liam404

    Thanks for the answer, although it would have been nice without the disdainful attitue.

    1.) I actually searched quite a bit in both XNA forums here. I also searched google.

    2.) What 'last' forum pages Do you mean the oldest posts or an other forum entirely Please elaborate.

    3.) I have been reading a few of the developer's msdn blogs sarting recently, but please provide me with your list of all the competent people's blogs on the internet so that I can read them all first and won't ever waste your time again.

    I did read and search through a reasonable volume of information before asking this question. I also to the best of my knowledge followed the "before you post" suggestions. I guess the one thing that I didn't do in the recommended "before you post" link http://www.catb.org/~esr/faqs/smart-questions.html was:

    "When you ask your question, display the fact that you have done these things first; this will help establish that you're not being a lazy sponge and wasting people's time. Better yet, display what you have learned from doing these things. We like answering questions for people who have demonstrated they can learn from the answers."

    So maybe I should have written everything that I tried and read first so you wouldn't assume I didn't put any effort into it. I assure you that the XNA MSFT Employee blogs are now in my resource list. Perhaps this should be added to the "before you post" thread.

    So in closing, I guess I shouldn't be so offended about your reply because once again according to http://www.catb.org/~esr/faqs/smart-questions.html :

    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-bullshit communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy.

    When you perceive rudeness, try to react calmly. If someone is really acting out, it is very likely a senior person on the list or newsgroup or forum will call him or her on it. If that doesn't happen and you lose your temper, it is likely that the person you lose it at was behaving within the hacker community's norms and you will be considered at fault. This will hurt your chances of getting the information or help you want."

    However, I am not sure how much of that faq I want to take to heart, especially when it makes suggestions like:

    "Q: I'm having problems with my Windows machine. Can you help
    A: Yes. Throw out that Microsoft trash and install an open-source operating system like Linux or BSD."

    Personally I love MS technology, and am quite surprised that a link from a self-proclaimed MS slandering hacker is the suggested reading material before using this MS forum.


  • Hans1982

    The reason may be a one of:
    1) you don't use search
    2) you have not read the last forum pages
    3) you have no good practice to regular viewing the competent people's blogs

    The blog of Shawn Hargreaves (who is one of the MS XNA developers) has cleared this up:
    http://blogs.msdn.com/shawnhar/archive/2006/11/13/spritebatch-and-renderstates.aspx


  • NetPochi

    I don't think of my answer as of something offensive. May be due to my poor english I can't balance on the edge of tact properly. If so, I'm very sorry. 
    Nevertheless I'll reply to I Heart Bacos.

    2.) What 'last' forum pages   Do you mean the oldest posts or an other forum entirely Please elaborate.

    The XNA GSE forum is generating about a dozen topics daily last weeks. In case you haven't the broadband connection or haven't too much time to read all of the topics,  you can just select  headers of interest and then copy topics content to your HDD to be read offline.
    As to your topic - I have answered this question three times already (of course, I am not the first answerer and inventor at all). The last topic with the right answer dated  11-30-20066 (not answered by me)
    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=973130&SiteID=1

    All the public forums suffer from repeating questions but next time i'll say to myself, as usual, : "Take it easy! Be happy!"
    What is my interest to answer such kind of questions so far Not to have the "answer points" or to puff cheecks out. I am just a scholar here like most of the forum readers. I do like every new sentence on this forum and every good trick/idea/sample/hint/link. Not so many people  have produced things. And I just want to free the time for people like Shawn Hargreave, Leaf., and other much more advanced XNA boys than I am, to discuss more subtle questions.

    please provide me with your list of all the competent people's

    I'll do more. I'll give you the method. The bottom right corner has a list named "Top Answerers in this forum". Just one click on Shawn Haregreaves and you'll see the address of his blog. All the MSFT blogs contain links to something interesting. And try to follow all the links in the forum to find usefull links and sites. After some filtering you'll have the best personal list of links to be visited.

     George Clingerman wrote:
    I know I have responded that way myself in the past but have been making a concentrated effort to not do it any more. So this is my apology to you to make up for my past sins.

    Thank you .I feel next time is my turn to beg pardon for someone else.


    Once more, sorry if my first post here seems too far from being polite... 

     

     


  • Luis Carlos Guimarães

    I understand the frustration of repeated questions.  I certainly didn't intend to add one. But it happens to the best and worst of us (I fall in that range somewhere).  The longer I am doing this and the more I read each day, the more I will know and won't need to ask how to find something.  I think part of my problem was that the search string "depth buffer" or "depthbuffer" didn't seem to pop up what I was looking for because that code content is hosted elsewhere (Blogs).  But another issue is that 10 people can ask the same question in different ways sometimes even indirectly or with interesting terminology, so it isn't always apparent even if you have found what you are looking for.  It would be a nice feature of the forum to be able to add tags of some kind, similar to you_tube or gmail, so that the sorting of information is more logical and easily accessible.

    Nonetheless, I'm trying not to be an annoying noob, and don't want to be mistaken for one.  I know that patience can run thin at times.  Just remember what it is like being new to a huge community.  There is so much information, some of which is obsolete due to version updates.  Sometimes it takes a little bit until you are swimming with the rest.

    No hard feelings.


  • ReiXou

    I just wanted to say that type of response isn't typical in the forums here. The majority of the people here do take the time to answer your question respectfully. While it is true, it probably would have helped to mention that you had done some searching on your own, it still doesn't excuse the lack of tact in the answer.

    I know I have responded that way myself in the past but have been making a concentrated effort to not do it any more. So this is my apology to you to make up for my past sins. I'm sorry that you weren't given a more polite response, a response that was encouraging liked you deserved. Hopefully, this apology will give you a better feeling about the forums here and you won't hesitate to asking a question again.

    We are trying to build an XNA community and part of being any community that you want to grow is having that extra filter that helps you try to say things in a little nicer manner and be welcoming and encouraging to others. I hope that everyone who takes the time to answer a question here thinks about that first before they post. If you really can't resist being snide or insulting to someone who has asked a question, just don't take the time to answer it, someone else who can resist will come along and answer it. That's the tactic I've been using, I think my mom taught me something about that. If you have nothing nice to say, then...


  • Sprite Batch interferes with Depth Buffer?