Jump to content
  • Advertisement

Archived

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

XBTC

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

This topic is 6915 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Thought you might be interested in this:

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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!