Sunday, June 6, 2010

Changes to Textures

OK, with the netcode fully ported (including rcon) it's time to tackle another item that has been on the to-do list for quite some time, and that's elements of how DirectQ handles external textures.

The first thing is that external textures now get the same gamma scaling as native Quake textures do. This is very important for consistency as in the past, if you had a mixture of both texture types in a map, things just looked bad.

The gamma scaling, by the way, is similar to what GLQuake did (which most source ports have removed) and is - so far as I'm concerned - a non-negotiable feature. For the reason why you need to do a side-by-side comparison of DirectQ with another engine, like so:



On the left we have the iconic wbrick1_5 texture in a typical Quake engine, whereas on the right you can see how it looks in DirectQ. If you click on the link for the full-sized version you'll see even better how the DirectQ version just looks so much more vibrant, colourful and detailed than the other. This is something that's just totally lost without the scaling, so the scaling stays.

Anyway, the second item on the list is handling of fullbrights from external textures. The blend mode DirectQ uses for fullbrights is (mostly) correct so far as native Quake textures are concerned ((lightmap + fullbright) * texture), but doesn't work well with external textures, which were designed with a different blend mode in mind ((lightmap * texture) + fullbright).

Sometimes the end result is that fullbrights just look darker than they should, other times weird things can happen; for example if the base texture has the texels that would have been fullbright removed from it (to prevent over-saturation).

I'm currently about half way through fixing this, and the chosen solution is to just switch the blend mode if an external fullbright was loaded. I might go back and rework some of the native texture code so that I can use a consistent render path, but for now that's where things are at.

Until then, it seems reasonable to finish with a shot of DirectQ in all of it's external texture glory (yes, including sky).

0 comments: