XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Depth Maps

Last post 05-03-2008 6:57 PM by benny53. 4 replies.
  • 05-02-2008 11:58 PM

    Depth Maps

    Is the only way of getting these by rendering the scene once with a special shader? Because it seems that rendering a scene multiple times, one for the scene and the other for the depth map, is a bit un-optimal. So is this the only way of getting a depth map created?
  • 05-03-2008 1:40 AM In reply to

    Re: Depth Maps

    As far as I know, XNA does not allow resolving the depth buffer (Someone correct me if I'm wrong).

    So you can either render the depth in a second pass, or you could render in one pass, storing the depth in the alpha channel if that is sufficient precision for you.
  • 05-03-2008 1:57 AM In reply to

    Re: Depth Maps

    They didn't expose any way to resolve the depth buffer because, as I was told, most graphics cards don't actually support this anyway.

    The other approach would be to use a multiple render target (MRT) approach. Then you simply write out color data to one render target and depth data to the other. I haven't tried it myself but it seems fairly straightforward (assuming your hardware can do it).

    Nick Gravelyn -- Microsoft XNA MVP
    Blog | The Best Game. Ever. | Next-Gen
  • 05-03-2008 3:40 AM In reply to

    Re: Depth Maps

    Using MRTs, as Nick said, you can obtain up to four results with a single pass.

    You can see how I used MRT to obtain a color map, depth map and normal map while only drawing the scene once, in one of my articles. The rest of the article might not be of interest to you, but this chapter explains MRTs.

  • 05-03-2008 6:57 PM In reply to

    Re: Depth Maps

    Wonderful! Thankyou everybody. This helps me a lot.
Page 1 of 1 (5 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG