Wednesday, September 21, 2011

Lightmaps - A Conclusion

The culmination of my recent work on the lightmapping code has been reached, and it goes something like this.

The experimental HDR texture formats are gone. Too much messing, performance issues and quality tradeoffs involved in trying to get a better range out of 8/8/8/8 textures.

64-bit lightmaps are back in DirectQ. These are now the default mode and used if available. There is some speed loss incurred from using them, but on balance having an effectively unbounded range more than compensates. It also gives me some motivation to try claw back the performance from elsewhere.

If 64-bit textures are not available on your hardware DirectQ will look for 10/10/10/2 texture support. This 32-bit mode is very widely supported, has roundabout got performance parity with standard textures, and gives 2 extra bits of precision to play with per-component (the alpha component is not used). What this means is that it can achieve 4x the dynamic range of standard GLQuake lighting without compromise (in practice there are a few places even in ID1 maps that exceed even this range, so we clamp if required).

If this format is not available (unlikely) the final fallback is to standard 8/8/8/8 textures (D3D only has one 8/8/8 format available and hardware support for it is poor so I don't even bother checking).

DirectQ is now overbrights only, and on all the time. I had thought about doing this a few times in the past, and the new texture formats made my mind up for me. The rationale for this is that software Quake was also overbrights-only (as a quick check of the colormap.lmp file will confirm), Quake II had overbrights, Q3A had overbrights. Why is GLQuake so lonely in the middle without overbrights? I'm contending here that overbrights are ID's intended look for all of these engines, and that GLQuake was nothing more than an experimental stepping-stone to Quake II. On account of that, any oddities in it's behaviour - especially when they differ from software Quake - should be discarded.

Would someone say that heaving and buckling skies are part of Quake's intended look? What about tearing/shearing water surfaces? Or huge polygon cracks you could sail a Star Destroyer through when underwater? These are all things that were abandoned when ID finished GLQuake's development, and my argument is that lack of overbrights belong in that list too.

Some might say that if another few revisions of GLQuake had happened then these would all have been fixed. Others might say that these revisions did happen - it was called Quake II.

I'm retaining the ability to switch fullbrights off as there are too many released maps where the texture artist has screwed up. Yeah, I know that there are also places where the same could be said of overbrights, but thats something I'm going to take a stand on now.

Moving on, the ability to switch coloured light on or off has been restored. The old r_coloredlight cvar which has always been hanging around the engine now works again.

RMQ is - naturally - going to pick up on some of this stuff. I don't think I'll go with the 64-bit lightmap support (glTexSubImage2D is just too slow compared to D3D's LockRect/UnlockRect/AddDirtyRect stuff) but I will be implementing the 10/10/10/2 texture format, pending confirmation of some hardware support. I'll probably also leave the non-overbright mode available there.

6 comments:

Ravey said...
This comment has been removed by the author.
Ravey said...

I've noticed some enemy textures flicker between point/linear filtering when it's set to point:
http://dl.dropbox.com/u/14499652/dq_textureflicker_saves.zip
(Edit: Fixed link!)

Anonymous said...

MH, Lightmaps: This all sounds great, as always. I reposted this because I didn't think you saw it as to where the link went on your page:

"Anonymous said...

MH, reading your blog show the passion and dedication that you have for this, even if I can only understand some of it. You used to have a link on your site for using texture replacement that went into great detail that has been missing for a while. Even after it was gone in used to show up when I do a Google search, but now it doesn't even show up there. Where can I read that info again. I want to give the link to my son also.
Thanks,
Marty"

Tuesday, September 20, 2011 7:53:00 PM GMT+01:00

mhquake said...

"You used to have a link on your site for using texture replacement that went into great detail that has been missing for a while."

If memory serves I removed the page because there is a limit on the number of such pages you can have (blame the blog software), I was quite close to it, and I needed the headroom.

Archive.org may still have it. Otherwise grab the DarkPlaces guide as I've largely followed it's conventions (there are a few extra things I do, but nothing dramatic).

Anonymous said...

MH:

"Archive.org may still have it. Otherwise grab the DarkPlaces guide as I've largely followed it's conventions (there are a few extra things I do, but nothing dramatic)."
The only reason I was looking for it was That I used DirectQ in May or June to play many of the classic quake single player levels and I could have swore that music worked then just by having it in: QUAKE\ID1\sound\cdtracks, or QUAKE\ID1\music\cdtracks without having the original CD or CD image loaded. It still works fine in Darkplaces. I just didn't want to ask the dumb question that I can solve myself. I haven't played Quake again until recently.

Thanks Again,
Marty

Anonymous said...

MH I'm still having trouble getting music to play in DirectQ I did go again to Darkplaces site and they show that to play music you put the ogg files in quake\id1\sound\cdtracks, but this is contradictory to this post by you on quakeone :http://quakeone.com/forums/quake-help/general-help/5188-play-music-without-cd.html
quake\id1\music, starting with "track02.ogg". What am I doing wrong? I've checked all of my sound control panel settings in advanced, etc., and the Creative control panel settings and I am stumped. The music plays fine in Darkplaces with music in: quake\id1\sound\cdtracks,or ,quake\id1\music\cdtracks, or quake\id1\music\

The only thing I can think of is that I hid my main DVD drive with Pr0t.St0p v1.1 and ran a quake CD virtual disk image.any clue what I'm doing wrong. I also tried to delete the directq config file.
My original CD is cracked so I can't try it. I can by a new one to test. Does GOG sell old Quake CDs. Thank again. signed,loosing my mind!