A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Previous and most likely Cull

  1. #1
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008

    Previous and most likely Cull

    Another optimization I thought I'd mention is previous culling. This applies to frustrum culling.

    Assign each face of your frustrum an integer (left side = 1 top = 2 right = 3 etc)

    Now, when a vertex is culled by the frustrum, it stores which side it was last culled on. On next frame of rendering the face first checks it's previous side it was culled on since by probability it will be culled again on the same side (if the camera isn't thrashing around in large intervals).

    Next, if the camera rotates right, then the most likely candidate would be the left side so in your frustrum cull set a parameter to have priority in checking the left side.

    So, first check the previous cull, then check the most likely candidate, then just check what's left over in any order.

    If the face is not culled then it receives a 0 as it's previous cull. Of which it will just check the most likely candidate first then check the rest in any order.

    I have tested and have on average reduced frustrum cull calculations by 25% or more depending on the circumstances. It never seems to cost more than it's worth though. So might be useful to implement if you're trying to make an engine :P

    EDIT: I changed something. It's not the face that stores what side it was tested on, it's every vertex that stores what side it was on.
    Last edited by Diniden; 06-22-2009 at 03:06 PM.

  2. #2
    Palindrome emordnilaP Diniden's Avatar
    Join Date
    Feb 2008
    And I did some reading and apparently this technique I mentioned is used in quad trees. So, just leave the memory of which side the quad was culled on and repeat that test first.

    But, you can also make use of my most likely cull idea I mentioned in quad trees. This could help speed up the action of rotating the camera.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center