Bsp-Trees+Vertex-Arrays+zBuffer+Texturinng=Problems!

Started by
7 comments, last by XBTC 23 years, 11 months ago
How do proffessional games like Q3,UT,....traverse and render the Bsp-Tree in a scene with multiple textures?Do they: A.Render single faces while traversing the tree(from back to front)? B.Make a huge array conataining all the faces or their indices of the scene while traversing the tree(from back to front,too) and render the whole array then? My problem is that both methods have big disadvantages in conjunction with texturing(i´m using OpenGl,but it should be the same problem with any other api)and I cannot think of another way to do it.The disadvantages: With A you have to change the current texture very often (which should be *very* slow with any api) while traversing the tree,´cause nothing is sorted by textures.With B you have nearly the same problem ´cause one cannot sort the Triangles in the array by textures without destroying the back to front order the polys are stores in the array.
Advertisement
Good question, I have no idea.
What normally happens is that polygons are cached. What this means is that while traversing the tree, the traversal code calls various other functions, such as culling and rendering. When it calls the rendering functions to draw say a set of polys with a certain texture, the polys instead of being draw directly, are cached.
So basically the rendering call just adds the polys to say a hash table based on the texture handle they use, then after the tree has been completly traversed, or the poly cache is totally used up, a call to say ''flush'' is made which then draws all the cached polys, therefore minimizing texture state changes.
You could use any type of caching sytem you want, eg. linked lists, has tables, sort them hierachically etc...

hope that helps
Thanx!
Yes Prismas idea sounds good but I think the number of texture-changes will be nearly the same with this approach as if you render while tree-traversal ´cause even if you have an hash-table,arrax,.... you´ll have to draw it in the Bsp´s back to front order.

There has to be "the one" solution,but nobody told it to me so far.

Pleas help,XBTC.
Sorry,i forgot to write my username and pw,the post from anonymous poster is from me(If you didn´t realize it already)

XBTC.
Hi, it''s me again.

Well I think that BSP engines use something called a span buffer, which basically minimizes overdraw of polygons. It encodes only the visible raster lines of the polygons, and this combined with a polygon/texture cache will 1) reduce state changes 2) render the polygons as fast as possible.

I have to say XBTC that this is a complicated area, and it can make or break a BSP rendering engine. This is why (among other things) the quake and unreal engines are so much more superior to all the others...

Take a look at some commercial quality BSP engines (Genesis, Quake1 source code, Crystal Space etc..), and c how they do it....but be forewarned, you will not be able to code up a ''quick'' solution to this problem.
Thanx alot!
I use OpenGl but that doesn´t matter,´cause this is a problem with every Bsp-Render,the only thing which doesn´t help in this case are Span-Buffers(at least I think,please tell me if i´m wrong).So i´ll look at some sourcecodes like Prisma said.
And if someone has also thought about this problem already please tell me about your ideas (and problems,perhaps I can learn something from your faults) even if they aren´t good.
Thought you might be interested in this:

http://www.gamers.org/dEngine/quake3/bwh_gdc99.txt

Thanx alot!
I think the article is really interesting.

XBTC.

This topic is closed to new replies.

Advertisement