[LWJGL] Cant Figure Out How To Do Frustum Culling

Hello JGO!

I need some help. I’m trying to implement frustum culling into my game but i cant seem to figure out how to do it.
Ive searched all around and cant find a any thing telling you how to do it. I understand you have to multiply your projection and model view matrices together, And then extract the frustum planes some how? I really don’t know.

Thanks a bunch :slight_smile:

Libgdx has already implemented this for you. Just call camera.sphereInFrustum() (also works with points and other things) This will return your Boolean value.

He’s using LWJGL. I had issues with frustum culling as well. I would share my method but its riddled with odd code. (It’s only temporary until I figure out a better way.)

Try this:
https://code.google.com/p/exemplwjgl/source/browse/trunk/src/fcampos/rawengine3D/graficos/Frustum.java?r=40

I learned a lot from that one

Whoops! I read Libgdx for some reason :wink:

Thanks KudoDEV For the link! I tried to make a implementation using it, But the pointInFrustum() Method is always returning false.
Do you know whats wrong?

My Code: http://pastebin.java-gaming.org/8c3850c73171d

Thanks.

Never mind, I found the mistake. Thank you vary much for your help! :slight_smile:

I know you already have your answer but here is a good tutorial series on frustrum culling and the various collision algorithms

http://www.lighthouse3d.com/tutorials/view-frustum-culling/index/

A good read to find out what your culling algorithm and frustrum shape creation code is doing

And what was the problem Robo11?

How likely do you think it is that, having not logged in for almost two years now, @Robo11 will remember even the problem he had over three years ago, let alone the solution? (rhetorical question)

I use org.joml.FrustumIntersection, very convenient.

Maybe he thought robots can remember everything…