Drawing of entities outside of fov

Started by poo2thegeek, July 11, 2013, 16:07:58

Previous topic - Next topic

poo2thegeek

Does lwjgl automatically not draw objects outside of the fov of my user? I do not think it does, because when I exclude objects behind me I get a higher frame rate than if I do. So I assume I can do the same with all entities outside of my fov. But doing this would involve some quite complex maths. I know how to do it for a 2d fov (using the sin rule), and normal 3d wouldn't be too difficult. But I can't figure out how to create an algorithm that will take into account the directional vector of a players sight (pitch, yaw, and roll).

If anyone can tell me an algorithm, or tell me if my theory on lwjgl still drawing objects outside of view if correct, I would be hugely grateful. Thank you!

Fool Running

Yes, you are correct, LWJGL does not cull objects outside your FOV. What you are talking about is frustum culling. Easiest way to find information about it is to Google "opengl frustum culling": http://www.lighthouse3d.com/tutorials/view-frustum-culling/
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

poo2thegeek

Thanks! Great responce with a lot of help!
But while I am in the buisness of lag reduction I feel it necisery to ask how much logic is too much? I have heard that binding textures is very slow, and so (in a voxel/block based game) would it be faster to break thr world into blocks thrn break those mixed blocks into lists of single blocks, so that I only only have to bind once for each type of block? The logic would just be a simple for loop with an enum switch statement inbeded. This meens iterating through very large arrays (about 80,000 blocks). whic would be faster?

Thanks!

Cornix

Just try to use texture atlases to store the textures of several models in one opengl texture. This way you dont have to switch as often.