dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Angling Optimization

Threaded View

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

    Angling Optimization

    Well, I couldn't sleep so I decided to work on implementing an optimization mainly related to backface culling. I'll extend it to frustrum culling as well. I'll let you know how it turns out and how much performance boost I can get. (at least rough estimates on performance boost...flash is kinda flaky in giving actual specs...)

    At any rate, here's the idea. Thrash me if it's already a common practice but:

    First, this procedure mainly applies to static objects. Dynamic objects will take some thought.

    Now, get all your static object faces and collect all of their unit surface normals. Divide all of the faces into groups according to their normals angles first by the y axis, then by the x axis. So since we have 360 per axis we can divide all the faces by 30 increments giving us 12 groups for the x-axis and then 12 groups per each x-axis group for the y-axis.

    Now with this subdivided, it's easy to see how this can speed things up. Instead of checking against every face, we can cull per grouping, and only the groups that lie on the fuzzy line of cull or no, we do every surface check.

    Now that's the first benefit. Another benefit is we can predict which group will need to be checked by simply seeing how much the camera rotated. If the camera only changed a little since last frame, but it's angle didn't change enough to include another group, then we can jump straight to just checking the same groups we checked last frame! Handy handy.

    This idea is probably already a common practice, but just thought I'd throw it oot :P

    Also, for dynamic objects, I'd say one would group the faces in it's model space, then after the transform to world space, just add the angles that transformed the model to world space to the grouping references...gotta think on that one a bit though...

    To make the dynamic work with this it's gotta beat using a dot product and a comparator to get it within the groupings...that is per face...if I can wing em in by groups then I'll have it down
    Last edited by Diniden; 06-19-2009 at 07:46 AM.

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