SFTtech/openage

Frustum Culling

Opened this issue · 2 comments

Frustrum culling

Required Skills: C++, computer graphics knowledge helps

Difficulty: Medium

With frustum culling we would only render objects visible by the camera. This could potentially save a lot of rendering time and let the renderer scale easily with larger scenes.

Implementing frustum culling in openage could be much simpler than in other engines since the camera has a fixed (dimetric) perspective using orthogonal projection, creating the well-known isometric view also seen in AoE2. Camera movement is currently limited to the x-z-plane. Furthermore, the camera supports zooming into/out of the scene.

Tasks:

  • Find objects inside camera view
    • Calculate camera view plane and the view frustum ( should be a 3D view "box")
    • Check if renderable objects are inside the view frustum (for simplicity, we can assume that objects are points or rectangle sprites)
    • Only draw renderable objects if they are inside the view frustum
    • Only update uniforms of renderable objects if they are inside the view frustum

The view frustum does not necessarily have to be perfectly accurate at first, i.e. it can be slightly larger than the camera view if it's easier to calculate. Our primary goal here is speed, not accuracy.

To test the implementation, there should be

  • a demo that showcases how frustum culling works
    • one way to do this is to use two cameras: the first camera is only used for culling, the second one is zoomed further out and used for rendering
  • a stresstest that compares performance with and without frustum culling

Further Reading

Hi, can I have this task if it isn't already taken?

Go for it!