Renderer
From WarzoneWiki
The graphics renderer in Warzone is old and has severe limitations that prevents it from exploiting modern graphics hardware properly. It currently uses immediate mode OpenGL, which is about to be phased out with OpenGL version 3.0 and beyond.
We should change the renderer to draw from static arrays of data that are kept in graphics memory on the GPU. Such arrays are often called VAs (vertex arrays) when kept locally in system memory, and VBOs (vertex buffer objects) when kept in the GPU memory. Solving the problem for VAs is one step toward solving it for VBOs, the difference is that VBOs need an extra step to synchronize changes locally with the buffer in GPU memory. Changes to VBOs should be done rarely, since this is slow (for non-dynamic-write VBOs).
The current problems with making terrain into VBOs:
- Water tiles and water edges are both drawn in separate passes, and putting them in their own arrays the size of the map would waste a ton of memory. And do we want to draw empty indices of the water and water edge arrays over the entire visible view?
- We can put all overlay elements into a second set of arrays. Eventually we will want to combine basic terrain and visual elements on those tiles during runtime rather than have a very large set of combined tiles. The current method of doing water animation by texture matrix manipulation would have to be changed in this case, though.
- Fog of war is implemented by changing vertex colours. A soft exploration effect is achieved by slowly changing the colours to non-black.
- We can draw non-textured tiles with alpha and black over the terrain once it has been drawn.
- Effects change vertex colours to dynamically light up terrain.
- This can be solved by lightmaps, but we would need a series of them to get a dynamically changing effect.
- Highlighting tiles is implemented by changing vertex colours.
- This can easily be fixed by using a lightmap texture which is blended on top of the terrain, where applicable. This also allows modders to easily change how highlighting looks.
- Building structures on the map may flatten the terrain under them. We have to make sure such changes are synchronized with the VBO.
- We can draw a special foundation object between the building base plate and the terrain on which it sits. It does not look as pretty, though.
- Another alternative is to modify the models to be have far deeper bases, and just drive them through the terrain to fit.
- A whole class of problems with colours can be "solved" by simply doing colours as a VA instead of a VBO, and recalculating and uploading that array every frame.
The current problems with making structures, features and droids into VBOs:
- Defensive structures are 'fitted' to the terrain by manipulating the vertex coordinates. We have to make sure that if the terrain changes, the structure's vertex coordinates are recalculated.
- See foundation discussion above.
- Texture animation and team colour are implemented by manipulating texture coordinates.
- FIXED by WZM format
- Models are composed of triangle fans instead of triangles.
- We can solve this be tessellating the triangle fans.
- FIXED by WZM format
Render branch plan
- Use WZM instead of PIE format for all models.
- Remove support for ANIM3DFRAMES (movie frame) animation. Replace with ANIM3DTRANS (bone heap) animation.
- Use vertex arrays for all rendering. No more glBegin ... glEnd. This prepares for the death of immediate mode OpenGL and allows more polygons.


