Original Post
I'll be making a few references to topics discussed in this thread.
I've been attempting to write an ABT compiler & renderer for my engine, but I fear that some of the things I'm trying to do aren't in harmony with the original design of the ABT structure. To start with, I'd like to say that I've read through just about every thread on these forums that mentioned an ABT, many of them more than once, and I pretty much understand the concepts behind constructing one from static data. I do have a number of questions though...
1) I'm a little curious about how you'd actually implement the 4 minimizable functions that Yann listed - I've currently got this set of scoring functions:
Axis Score = Dimension(ThisAxis)/Dimension(LargestAxis)
Volume Score = 2*fabs(0.5 - SplitPercent)
Face Score = fabs(FrontBackDiff)/NumFaces
Splits Score = fabs(NumSplit)/NumFaces
where SplitPercent indicates how far "into" the volume the split is (0.25 at a quarter, 0.5 at halfway, etc), FrontBackDiff is a value that records the difference in how many faces are on each side of the splitting plane (positive means more on maxside of plane), and NumFaces is the number of faces in the current node being processed. Lower scores are obtained from better split locations, and the total score of the split is the weighted sum of those 4 function scores as mentioned in
2) How would you go about getting a successive approximation system to work with these functions, since only the geometry-ignorant functions are continuous? I suppose the face balance function could be somewhat continuous, with jumps instead of smooth transitions, but the splits function seems like you can't predict a value based on any previous samples - you won't have any idea how many are split at a position until you test it. I'm currently using a "best guess approximation" for picking the plane - I take 9 samples (10% 20% ... 90%) along each of the 3 axes, evaluating the score for each of the splits and keeping the one with the highest score. This obviously isn't perfect but it does split my extremely minimal dataset in a reasonable position.
3) I'm a little confused about this paragraph in Yann's building description: "At this point, due to all the overgrowing and optimization, your original node hierarchy will be largely out of sync with the nodes themselves. So you need to rebuild it from the bottom to the top. For each leaf, walk up the tree, and recreate the bounding boxes for each node by unifying the child AABBs to the parent AABB." - If each of the nodes AABB's is shrunk to contain only the geometry inside that node, then why would you need to re-shrink them after the leaves have been determined?
4) Can you get a decent collision detection result from an ABT that's only subdivided to 2000 faces per leaf? That seems like it'd be ridiculously slow to test against unless you further subdivide the leaves specifically for coldet, keeping the renderable geometry together in large vertex arrays though. Would it be possible to have 2 subdivision thresholds - one for renderable geometry, one for collideable geometry? You could have 2000 faces per render-leaf (level that stores renderable geometry) but then keep going from that node until you get down to around 50 faces per collision-leaf. This is also relevant for making a level editor - if I import a 10 million face level from max or maya, and then decide that a certain area should be textured differently (using a different texture, not adjusting the actual texture coords) then I'd have to be able to select those faces in order to change them.
5) I see that the ABT is good for doing pre-processed static goemetry with objects possibly moving around, but what about adding and removing geometry (small amounts, not half the level) at runtime? I'd like to be able to support CSG in the main engine structure, but I'd rather not compile a quake-style BSP in order to do so. I suppose this is somewhat linked to the previous question regarding collision detection, since it involves the CPU rather than the video card. But apart from doing CSG on the level data, it would be nice to be able to add new static geometry to the ABT without having to completely recompile the whole tree - would you need to keep the split statistics from the compilation around in the nodes in order to compound the previous results with the newly added geometry (instead of throwing the node hierarchy out the window and recompiling with a raw polygon soup again)? This is sort of another thing related to doing the level editor - importing multiple distinct pieces of a level or stitching separate levels together by importing them separately, and not doing all the work in 3dsmax.
6) Can you keep "objects" higher up than a leaf? If they are simply represented as a bounding volume (an AABB should fit in OK, right?) occupy most of the (minimized) volume of a non-leaf node, and can't reasonably be split into 2 or more pieces, then why not store them in the best-fitting non-leaf node... The kinds of objects that would occupy a non-leaf node when a leaf contains 2000 faces would be kind of large, admittedly, but in that vein I'm thinking about things that have precomputed LOD that can't really be properly processed by the ABT - large pieces of terrain specifically. Could the ABT structure effectively support a blend of LOD terrain with static geometry lying around on it - houses, caves, etc?
That's about all I can think of right now, hopefully someone can help me out on some of these issues though before I encounter some more
. I saw that Yann was planning to write a paper for siggraph 2003 regarding ABT's but haven't heard anything of it since then - any word on when it might be available (if ever)?
[edited by - Assassin on June 16, 2003 4:40:52 PM]