Closed jdolan closed 3 years ago
This was addressed in de5b7134c7f8c49bcc016b7541323b486b17eb3d
We haven't encountered a GL driver that complains about the lightgrid texture size (yet). If we do encounter one, we'll need to add the CPU-side downsampling of the grid before uploading to the card.
The current lightgrid resolution aims to work with the OpenGL 3.0 minimum spec for 3D textures: 128x128x128. At 64 units per luxel, that allows us to cover our MAX_WORLD_AXIAL of 8192 (8192 / 64 = 128). This works, and looks okay. However, lighting, and especially fog, would benefit from a denser grid.
Most drivers will gladly support much larger 3D textures. 2048^3 appears to be a widely supported unofficial standard. So we could easily jump to a 256x256x256 grid without overstepping. This would work on 99% of the hardware we are targeting. However, we should provide a CPU downsample on level load for cards that do not support at least 256x256x256.
The change to jump to 256x is very easy: lightgrid luxel size is defined once in cm_bsp.h, and once in lightgrid.glsl. That's it. The work here is in querying the driver for supported texture size, and then of course implementing the CPU downsample on level load.
Assigning this to @Paril as he has already experimented with this. Let's wrap this fog up!