If you look at a lot of the text file formats we often have something like this:

TEXTURE
TEXTURE_LIT
TEXTURE_NOWRAP
TEXTURE_NOWRAP_LIT

etc. It’s a bit of a disasteer. The problem is that the command is encoding two separate ideas:

  1. What the texture is used for (primary texture vs. lit vs. composite vs. mask)
  2. How the texture is loaded (with wrapped vs clamped edges)

What got me looking at this was a test Sergio did with some ground lighting. He had texture compression on and his nice lighting and halo textures were absolutely trashed, because texture compression isn’t very nice to alpha masks.

Internally we deal with this by marking textures as “not to be compressed” — this is why the clouds don’t look ugly. I thought, “why don’t I make this available in OBJ and pol files…that’s not very hard”. But do we really want this?

TEXTURE_LIT_NOCOMP
TEXTURE_LIT_NOCOMP_NOWRAP

So I’m thinking we may need a syntax that separates the “what” (what slot in the scenery the texture is used for) from its settings. Something like this:

TEXTURE2 -nocomp -wrap my_truck.png
TEXTURE2_LIT -comp -nowrap my_truck_LIT.png

The “flags” would affect how the texture is loaded (the two obvious ones are wrapping/clamp controls, and compression-inhibition) and the command name would say what the texture is used for.

I am also looking at adding normal maps to objects – this would be a third texture attached to the object (so you could have a base texture, normal map, and lit texture). The advantage of this scheme is we’d need only three commands with a pile of flags.

Anyway, just something I’m thinking about.

(One thing I haven’t worked out is how this would interface with dataref-driven textures, which would require yet more file format gunk.)

About Ben Supnik

Ben is a software engineer who works on X-Plane; he spends most of his days drinking coffee and swearing at the computer -- sometimes at the same time.