A Flash Developer Resource Site

1. ## 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

2. Hmmm this is trickier than one would think. All I can say to demonstrate visually what I am thinking here and why it is tricky:

Get a ping pong ball.

Now draw circles around it from a single pole to "slice it up" like you see longitude lines slicing up a globe.

Now, along one of the slices lines go to the mid point between the two poles that were made in the previous slice up. Now start another pole in that location and slice it up again the same way.

You will notice it gives a nice structured set up, but the shapes of the areas on it are kind of awkward. With a math friend of mine though we figured out how to calculate all of the vertices that arise from that operation, so we can just take the orthogonal plane to the camera view and calculate of the vertices of each group are in front or behind the plane or intersecting which will show whether to cull or keep the group or whether to examine each face individually for the group.

But like I said...got kinda complicated...but we figured it will still have performance boost...

3. Forgive the triple post, but no one seems to be posting themselves...so might as well keep flowing out with info :P

I thought about dynamic objects and how to help with using this method for a speed boost. But it comes with a condition that it only will help if the dynamic object has a lot of faces to deal with.

So, you just split up the angles of the dynamic object in the fashion I stated before, except keep these groupings as their own groupings since they are only in model space.

Now, just translate the camera to the model space of the object and perform the culling in that domain.

Like I said, since this creates another grouping cluster, one must have a lot of faces to deal with in the dynamic object, otherwise it becomes more of a bog down than a speed up.

This so far is the only solution I can come up with this thought.

4. And still no one interested in discussing apparently, so I'll continue the monologue:

I have attempted the funky method of getting a proper sphere that I was using (mathematically simple) but it kept coming out with a distorted sphere. So, in frustration I looked to some other options of properly categorizing my normals and slapped myself hard core in the face when I realized to use Spherical coordinates.

Easily got my sphere for categorizing my normals this way. But, now I am working on assuring that my normals are being grouped as they are supposed to be grouped.

Luckily, spherical coordinates already have a lot of mathematical analysis regarding them, so my cal book and I are exploring how to KISS (the method...nothing weird going on over here >_>).

5. (removed example from site)

6. PROJECT FAILED!!!

Someone should have caught me and reminded me all involved in backface culling X3

So, this method can't be exactly used for backface culling improvement, BUT it can be used for angle optimization, should you be dealing with angles in a certain way.

Since I finished making this weird device, I am determined to discover a practical use for it. I'll let you know what I come up with.

#### Posting Permissions

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

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap