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

Double view frustrum

Last post 06/10/2007 18:39 by nih. 10 replies.
  • 06/10/2007 05:34

    Double view frustrum

    Heya everyone

    I'm just about done with Microsoft's great Programmable Graphics Pipeline book. I hit the frustrum appendice and it got me to thinking.

    My brother and I have both experienced the odd issue with the depth stencil not being accurate enough for distant objects when the far plane is made too large. In particular this problem is really bad on older video cards that don't have a very accurate depth stencil. Although there may be better solutions (if there are, share 'em!) I might have thought of another workaround.

    Since my problem relates to terrain in particular, I thought that after a certain distance I might fade the terrain out, with terrain further than being drawn in a different pass (or whatever the term is) and using larger near and far clip values. Except doing the further pass first.

    This is similar to the delayed-update skybox idea used in many newer games, where the background is rendered to a persistent buffer at a much less frequent rate than the foreground. One thought was to use cone step mapping on that persistent skybox to give it a realtime-update feel.

    Is this possible or reasonable? Does breaking up a draw sequence like this cause any sort of a speed hit?
    _______________________________________
    www.skull.co.nz
  • 06/10/2007 16:17 In reply to

    Re: Double view frustrum

    How big is your world? Unless you're doing something really crazy like rendering hundreds of miles visibility, I'd be amazed if you can't fit this into a single depth buffer. Even with very large words you will typically run out of floating point precision for other things like your physics simulation long before depth buffer precision becomes a blocking issue.

    My guess is that your near clip plane is set too small. The far clip plane makes almost no difference to zbuffer precision: it is the near plane that matters.
    XNA Framework Developer - blog - homepage
  • 06/10/2007 16:36 In reply to

    Re: Double view frustrum

    In my case, I don't have a level as such yet, I'm just noticing that as my test objects/terrain become quite distant they flicker a lot. My near clip plane is set to 1.0. What's a reasonable value?

    In my brother's case he has objects that aren't all that far away, although it just occurred to me that he's using a pretty old video card. I don't know why I didn't click on to that earlier. That will probably be his problem.

    As for the double-pass rendering, one of the big falldowns of existing games is that you can't see convincingly far enough to make the world feel real. World of Warcraft in particular suffers from this. You wouldn't be simulating physics in the distant area, but it'd be nice to have buildings that didn't wait to fade in at 50 feet yet still retain a reasonable framerate.

    I'm not advanced enough yet to knock up an example, but I'll put one up in time.
    _______________________________________
    www.skull.co.nz
  • 06/10/2007 17:36 In reply to

    Re: Double view frustrum

    Pushing out your near plane generally helps precision more than pulling in the far plane, but a near plane that's 1 away should be fine...

    Assuming the issue is truly from depth precision, one thing you could do is to draw far off objects onto a render target, and then draw them again into your scene as a billboard. This has the added advantage that drawing a billboard is really fast, and you don't need to update it every frame.

  • 06/10/2007 17:40 In reply to

    Re: Double view frustrum

    Exactly! That's more or less what I envisaged, except I was thinking of rendering narrow slices to each polygon of a cylinder instead.

    I'm really jazzed having finished the book, I can't wait to start whacking some of these ideas out.
    _______________________________________
    www.skull.co.nz
  • 06/10/2007 17:42 In reply to

    Re: Double view frustrum

    Haha, it's a fun idea but I'm a little skeptical about the problem being with depth precision. You're using D24S8 for your depth stencil buffer right? I think older cards might default to D16.

  • 06/10/2007 17:55 In reply to

    Re: Double view frustrum

    One of the benefits of this idea is that you bring your far clip plane a lot closer for the area that's being updated every frame and still keep distant detail. You can put a little extra time into that distant pass too, if it's broken up over several frames.

    There's also nothing stopping you from doing two background passes: distant and very distant.

    I think the thing that will really bring it together though is the relief or cone step mapping. The effect will be pretty subtle, but having mountains and towers change perspective by a fraction will help remove the 'this is a static image' feel.

    A lot of this assumes there'll be stuff in the foreground area adequately hiding the join between zones, but fading to transparency might help that.
    _______________________________________
    www.skull.co.nz
  • 06/10/2007 18:05 In reply to

    Re: Double view frustrum

    What? Aren't you the OP?
  • 06/10/2007 18:16 In reply to

    Re: Double view frustrum

    What gave you the impression I wasn't? :P
    _______________________________________
    www.skull.co.nz
  • 06/10/2007 18:38 In reply to

    Re: Double view frustrum

    It sounded like you were talking to yourself
  • 06/10/2007 18:39 In reply to

    Re: Double view frustrum

    Whoops, double post.

    I was responding to you :D
    _______________________________________
    www.skull.co.nz
Page 1 of 1 (11 items) Previous Next