Archived

This topic is now archived and is closed to further replies.

MindCode

where to place textures in a tree

Recommended Posts

This may be a general programming question, but since I'm using OpenGL for my engine, and since texture swapping is an expensive state change in Ogl, I thought it would be appropriate for the Ogl threads. I've written everything in my bsp compiler, tested it (thoroughly), and I'm ready to export my compiled data to a file. However there is only one thing I haven't taken into acount yet. Up until now I've just stored the texture index per face, rather than setting groups. I've avoided this since I couldn't really decide where in the heirarchy to place them. I was in a crunch for other stuff bugs/tools at the time and now I can't put off making a decision. But I still can't decide where to put them in my bsp structure. From what I've learned in the past about the q3bsp format, there is only one texture per leaf. I'm not sure how they did that, but I thought it might have something to do with the plane selection tests. I also considered creating a tree for each texture in the map so that there would be an absolute minimum of texture swaps (but this sounded too strange for me to consider further). Obviously binding textures per-face is not an option. The compromise was to split my leaves into groups for each texture within the leaf. This last seamed a slopply solution too though. So my question (in short): Is there an optimum postition within a generic bsp tree structure to place the texture binding? [edited by - MindCode on May 1, 2003 12:10:05 AM]

Share this post


Link to post
Share on other sites
Binding textures for every leaf is VERY fast.
You think that will make your engine lag?
no, I dont think so.

When you select the faces to be draw, Only what you see , you dont have choice to first bind your texture, after draw it.

Why ? : You need light map in your engine. Light map are texture. So you have to bind a different lightmap for every leaf. And the faster way to draw them is using multitexturing.
So the first past will be your original texture, after that your light map in second past, after you draw your leaf.

Share this post


Link to post
Share on other sites