-6

I'm making a 2d tiled base game, in which when I render many tiles, the fps goes down drastically. I know why this is happening, its because many objects are being rendered at once. I need to implement frustum culling in the orthographic view, but i don't know how to achieve that.

I've looked through numerous websites, searching all day. But still I can't find how to implement frustum culling in a 2d game.

Note: I'm using VBOs.

genpfault
  • 51,148
  • 11
  • 85
  • 139

3 Answers3

1

The difference between orthographic and perspective views is the clipping volume they represent; For perspective it is a frustum (or a 'square cone') and for orthographic it is a simple box.

You just need a simple AABB-AABB test to cull your sprites, and it's actually pretty simple.

pleluron
  • 733
  • 4
  • 12
0

I am fairly sure you don't need a frustum if it is a simple 2D game, can you not in your render method just do an if statement to check if the tiles are still within the bounds of the camera and if not then simply do not render them?

0

Late to the party but for those who need it.

How big is your tile? In a simple 2D game it's true that frustrum culling is often unnecessary.

If you're sure culling is the problem, divide your huge tilemap into several smaller tilemaps then draw only those that are within view. The rest is a simple AABB check for each tilemap section.