View Frustrum Culling

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
diki
Posts: 140
Joined: Thu Sep 11, 2008 7:53 pm
Location: GMT+1
Contact:

View Frustrum Culling

Post by diki »

hi,
looking for a new way to cull many objects, i tried to implement the parts that i understood in this article - basically, it is about not rendering anything outside of the camera view (the blue wireframe in this demo). it's not much, but looks useful & performant enough. your thoughts please :)

demo keys:
mouse to look around
arrow keys to rotate frustrum (camera view)
Attachments
view frustrum.gif
view frustrum.gif (8.22 KiB) Viewed 6453 times
20090929 view frustrum v22 public.zgeproj
(11.7 KiB) Downloaded 692 times
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Dude,

You're digging a hole for yourself :) Don't get me wrong, I'm happy to see people make good use of the libraries I posted .. but this won't do for your project either.

The main flaw is that you're using accurate frustum culling in combination with position coordinates of models. So when you get up close to a large object, there's a significant chance the "pivot" will be off-screen and thus it won't be rendered ( while it should ). The solution would be to use the model's AABB .. but this means a whole lot more math.

Start small & simple ~
K
User avatar
diki
Posts: 140
Joined: Thu Sep 11, 2008 7:53 pm
Location: GMT+1
Contact:

Post by diki »

hi,
i was thinking about checking for bounding sphere, which would still be accurate enough & really easy on the math :)
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi diki,

Spheres are a bit of a strange choice when all of your meshes so far are square + axis-aligned .. but it would work yes. Obviously though, you end up using a accurate method such a frustum culling together with not-so-accurate data .. plus you still probably want to use AABB for a first collision pass as well no ( instead of Sphere-Bounds )?

Keep in mind that these types of techniques are normally never scripted / always coded. And that a open-end / massive-scale city like in GTA is one of the hardest things to pull off ( at a decent frame-rate ).

K
Post Reply