b3d texture index q.

Blitz3D Forums/Blitz3D Programming/b3d texture index q.

Sledge(Posted 2004) [#1]
Hmmm. I'm finding that I need to blend my textures in a specific order to achieve a certain effect. Specifically, the lightmap needs to occupy index zero while the "regular" textures need to sit above it.

At the moment this is easily done manually as my test b3d level uses a single texture. I anticipate becoming totally stumped when I come to use a proper, fully textured level though as index 0 will be automatically occupied by the b3d's regular textures and sneaking the lightmap below will become impossible. So, obvious question - any of you guys know if it's possible to increment the index that an existing set of textures use when they're loaded automatically by a b3d file and thus don't provide you with handles? I don't see anything in the docs, but then I've said that before :/


Sunteam Software(Posted 2004) [#2]
Ahhh yes, I remember, there are several ways of overcoming this. The easiest is to use a level designer that you know allows you to control which tex coord set your using. However I don't know of any like this, so you may be stuck with having to delve into the innards of the b3d file format.

This is not easily recommended as I remember many people (incl myself) having many problems understanding it and getting it to interpret correctly, I'd set aside at least a whole day if not weekend for this one.

What you could do is write a b3d file parser so that you can extract all the tex coords from your level file and then re-insert them back in the right tex coord system. hmmm I'm not being very clear but the problem is that you need to know the output tex coord system your level editor is creating the b3d files in, i.e. which coord set is it using for the mesh (0,1,....??).

So if it outputs your level including a lightmap, it is most likely outputting two coord sets per mesh, so then you need to find out which coord set is the lightmap and if it isn't 0 then to swap over all the tex coord sets..... urm well I did say this wouldn't be a simple solution. Unfortunately I don't have time to go into more detail (sorry), but if you can figure this side out then you can remove the texture references from the b3d file, load the mesh into Blitz without textures and load and apply the textures seperately. As your level file should have the tex coords on the right layers you can then blend them how you want :)

Sorry if this throws you way off, it's one of those subjects I haven't looked at in ages, and although I know what I'm trying to say.... I haven't had my coffee yet this morning :D

Good luck, if you need further help I'll try but maybe some of the others, more awake then me, can help.


Sledge(Posted 2004) [#3]
Yikes! Ta for the (frankly scary) suggestions. I suspect you are exactly right, which is a pain as it's one of those "you'd think it would be easy to..." kinda things.