Two important features have just made it into DirectQ.
The first is gamma-corrected mipmapping. This helps prevent lower mipmap levels from turning to sludge, and is applied to both native and external textures, with the exception of DDS files, where it is assumed that the texture author will provide a full mipchain in the DDS using a high-quality mipmapping algorithm.
The second is in relation to skyboxes. I've dumped the cubemapping, gone back to six separate skybox textures and have written my own cubemap lookup function to sample from these. It's on the GPU rather than the CPU, of course, so it plays nice with static vertex buffers and all the rest.
The reason for the latter is connected to the way Quake content is occasionally provided. Sometimes skyboxes have missing components or different resolution components - an example might be where the mapper or modder provided a lower-resolution bottom face, or doesn't provide one at all, on the assumption that this face of the skybox will never be visible.
Previously with the cubemap it was necessary to enforce that all face textures be present, be square, and be the same size. I handled this by first loading the 6 face textures into temporary storage, then resizing them as necessary, flipping/rotating/mirroring them to orient properly for a cubemap, then building a cubemap properly from that. It worked but it was somewhat nasty.
That's all gone now and skyboxes are handled with full flexibility instead. It's still a cubemap, but the cubemapping is now done manually and none of the old restrictions apply.
The downside is that skybox drawing is now a mite slower than before. In practice this means that the big Marcher Fortress scene runs at about 870 fps rather than 890, so it's not too big a deal but it is there. In an ideal world all code would run fast, look good and be flexible. In the real world you don't always get to have all three, and this was one case where sacrificing some speed was worthwhile.
If it was possible in Quake to just draw the skybox as a large cube at infinite distance this wouldn't be much of an issue. I'd just use fairly standard texture lookups and everything would be clean and fast. Unfortunately there are places in id1 maps where sky is used to occlude other geometry, and combining that with the need to support sky surfaces on brush models means that a more robust and general purpose solution was needed.
One other thing that's been fixed up is video mode selection. D3D11 gives a different video mode list than D3D9 did, so unfortunately that means that the mode list changes again. The upside is that it's now fully working, with the ability to select refresh rates, centered or stretched modes, and different scanline ordering. Of course, if your hardware doesn't expose some specific modes then you won't get them, so don't go looking for me to add stretched modes if there are none in the list. Your hardware just doesn't support them, and I can no more give you such a mode from the engine than I can upgrade your RAM from it.
Not yet done is multisampling. In order to provide this in D3D11 I'll need to destroy and recreate the swap chain. Seems simple enough, but I'm playing it a little on the cautious side.
Sunday, April 22, 2012
DirectQ Update - 22nd April 2012
Posted by
mhquake
at
2:07 AM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment