Thread: some kind of occlusion culling

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    244

    some kind of occlusion culling

    so i have my scene organized in some kind of tree (e.g. kd-tree, oct tree)
    each node has a bounding object assigned to it (e.g. axis aligned cuboid (bounding box))

    now i position the camera somewhere in the scene and want to render the stuff.
    so i first check what nodes could be seen (so which lie in the frustrum), sort them in z-order and start pushing the contents of the boxes to the graphics card.

    the thing now is that if i stand right in front of a wall i would probably render things that are like a kilometer away although they are occluded.

    so is it a good idea to do the following (can it be even done that way?):

    ok, the nodes to be drawn are sorted already (closest first)

    i would say that when selecting nodes against some frustrum, always the nodes that just overlap or are completely contained in the frustrum are chosen. (instead of e.g. chosing all leaf-nodes)

    Code:
    draw the objects in the first visible node (that is the leaf the camera is in)
    
    current_node = next visible node in z-order;
    
    render the front sides of the current node's bounding cuboid (so at most the 3 sides of the bounding box
    that can be seen from the camera position) but  just do depth checking, and count how many pixels would have
    been drawn (but don't draw anything) )
    
    if(0 pixels were drawn)
      skip that node and all children because its already occluded by previous objects
    else (if there are objects in that node) {
      render all objects in that node
      move to the children (if there are any) and repeat the same procedure (thus: render their
      bounding box, and check if anything was drawn)
    }
    
    move on to the next visible node.
    so is this a good idea to do that?
    (is it even possible not to draw something, but do depth-testing, and just count the pixels? i am just about to start learning pixel shaders)
    Last edited by Raven Arkadon; 10-03-2006 at 08:25 AM.
    signature under construction

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Solution to earlier quad-tree culling
    By VirtualAce in forum Game Programming
    Replies: 3
    Last Post: 08-10-2006, 08:04 PM
  2. Solution to culling issues?
    By VirtualAce in forum Game Programming
    Replies: 4
    Last Post: 03-14-2006, 06:59 PM
  3. What kind of job...
    By Discolemonade in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-15-2005, 08:23 PM
  4. Replies: 11
    Last Post: 03-25-2003, 05:13 PM
  5. Backface Culling in Lesson10 NeheGL Tutorials
    By Zeeshan in forum Game Programming
    Replies: 2
    Last Post: 09-14-2001, 03:06 AM