Jump to content

  • Log In with Google      Sign In   
  • Create Account


culling spheres and/or boxes and when?!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 cozzie   Members   -  Reputation: 1073

Like
0Likes
Like

Posted 06 March 2013 - 04:39 PM

Hi,

'today' I've implemented my (frustum) culling as followed:

 

- meshes: if boundingbox is not outside frustum, render

- point lights: if boundingsphere is not oustide frustum, render

 

There are most likely some optimizations possible, knowing that:

- for meshes situational box versus sphere might be considered (very 'high' or 'wide' objects as a sphere is bad)

- a box check is 8 times more checking then a sphere check

 

I see a few options:

1 - always do sphere check first (meshes) and if 'true' afterwards do the box check

(reduces checks for sure)

2 - only do sphere checks, winning checks, possibly losing unneccesary rendering

3 - do either sphere or box, based on a precalculated bool which one to do, for example if width is more then 'x'% of height and depth (and vice versa)

 

Another thing I consider is keeping track of my camera being moved or rotated, and only if TRUE, update visibility through checking everything against the frustum.

 

Really like to hear your thoughts on these 'dilemma's.


Edited by cozzie, 06 March 2013 - 04:39 PM.


Sponsor:

#2 EWClay   Members   -  Reputation: 655

Like
0Likes
Like

Posted 07 March 2013 - 06:43 AM

Culling is not usually a performance problem unless you have a huge number of objects, and then the best optimisation is to use a hierarchy to allow many objects to be rejected with a single test.

Accuracy is important however, and box tests (axis-aligned or rotated) are better than spheres on that score. It isn't worth branching, pick one and do everything the same way.

Finally, a box test is not eight times more expensive than a sphere test. You're checking all the corners, aren't you? You only need to find the extents of the box along the plane normal.

#3 cozzie   Members   -  Reputation: 1073

Like
0Likes
Like

Posted 07 March 2013 - 02:56 PM

Hi ewclay.

Thanks for your reaction, clear. Pick one (sphere or box) and use it only (not both). And afterwards, inplement hierarchy to reject early for 'groups' (within a node/ area).

 

Do you mean for the boundingbox I could only check the points (min_x, min_y, min_z) and (max_x, max_y, max_z).

When thinking about it it might (will) indeed give the same results with way less checks.

Do I understand correct?

 

If so, I'll go for spheres with point lights and bounding box with meshinstances.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS