It may not look like much but this is a more or less exact replica of software Quake MDL lighting (with texturing switched off so that you can see the shading). It's done per-pixel in a shader, and of course it gets texture filtering and gouraud shading, but otherwise it's spot on; everything looks the same from all angles. There's just some CPU-side light level clamping left to be done (not that much of a big deal) and we're there.
That's another major bone of contention of mine resolved: how inferior GLQuake MDL lighting was to software Quake's.
Vertex submission has gone up to 16 bytes as we now need to submit two (compressed) normals per vertex as well as 2 (compressed) positions; two of each are needed for interpolation (last verts or currverts). I could compress this down further (back to 12 bytes) but it's probably getting into micro-optimization territory. I'll most likely end up giving it a try anyway, just for the laugh.
On the other hand the requirement to refresh vertexes when the entity angle changes has been removed, so those 16 bytes only need to be refreshed about 10 times per second (rather than 72 times). Interpolation, lighting and shading, etc are all done in shaders, and are all per-pixel and per-millisecond correct.
This is quite a major performance gain with MDLs, which have always been quite a bottleneck in Quake.
Monday, February 14, 2011
Posted by mhquake at 11:24 PM