Sometimes you just have to accept your limitations and move on. My limitation is math. Man, is it math. I tried several ways to get the texture mapping in Cheetah to export to Quake in a happy way and they all failed in some way or another. In the most promising case, it looked like a simple rounding issue because if I hand typed the values I wanted into the MAP file, it would look right but if my exporter wrote the map file it would add a few decimal points here and there and the texture would be way off in Quake (OK, a few texels but in level design that might as well be a chasm).
The problem has something to do with scaling. Well, honestly, I think it has to do with the fact that Cheetah multiplies it’s texture matrix in a different order than Quake does or something like that. Because it looks right in Cheetah. And it looks like proper values in the exporter. But then it’s off slightly (or sometimes majorly) inside of Quake itself. So I had to change gears.
My goal through all of this was to come up with a way to minimize the pain of texture mapping in Cheetah. See, Cheetah has this concept of material tags that can be applied to specific polygons within a mesh. This sounds great until you try to use it. The feature is so horribly implemented that half the time it doesn’t listen to you and the other half it fucks up previous assignments and … just … ugh. So I wanted to get away from that and that meant one thing: UV mapping. And that’s fine. I can UV map competently but the problem is that I can’t convert a 0-1 UV mapping into a Quake UV vector and offset because of my previously mentioned dumb addedness in math.
What I was able to do, however, was a multiple step process that allows me maximum freedom within Cheetah while still allowing me to get something good looking into Quake. This will sound horrible but it’s not that bad, really.
- To use simple offsetting (panning) of a texture, I can just use the UV mapping inside of Cheetah. If I use this option, I also have to add a “Render Tag” to the object. My exporter looks for this tag and if it sees it, the exporter will compute the offset values automatically by comparing the default Quake texture mapping with the current Cheetah texture mapping. The difference in position is the offset.
- If I want to rotate a texture, I have to resort to using the material tag system (grrr). If the material tag for a polygon has a rotation value, then the exporter will grab the offset, rotation and scale from that tag and not try to get fancy.
- Finally, if I just want a brush to be default mapped in Quake I just create it and add a texture to it. The exporter will just spit it out to Quake and let it worry about it.
Now, yes, this is somewhat complicated but remember that I’m trying to turn a 3D modeling program into a Quake level editor. We’re going to have to accept some hacks along the way.
I still have a long way to go here since entities need key/value properties and a bunch of other niggly things need to happen. Better get back to it.