posted March 02, 2000 05:32 PM
well, i was working on a ROAM implementation last year, but put it down for a while, because i could never get the "feedback variance" working properly (seumas's method - no merge, no pqueue, etc). anyway, i picked it up again recenctly and was able to make the feedback stuff ALMOST work...
a description of my scene:
4 patches (8 tritree roots) with max 12 levels of subdivision, for a max of 32768 triangles
1025x1025 heightmap (1 byte height data)
8474 triangles with non-zero variance.
targetting 1024 triangles rendered
right now, my "error" is simply the variance - i don't take distance from camera into account yet. the reason i list the number of triangles with non-zero variance is because that is the # of triangles it would take to render the scene "as well as possible" (keeping in mind that the max level of subdivision per root is 12).
anyway, the threshhold in my code is initially specified as 1, so i start out rendering way too many triangles - 8474 to be exact (i stop subdividing when the error is less than the threshhold, so initially, it renders every triangle with non-zero variance -- recalling that my error is simply the bintritree's variance). so, i only allow the threshhold to change by something in the range [90%, 110%] each frame. so after a few seconds, the threshhold has risen up to about 81, and the triangle count has lowered down to about 1200. then, something happens. apparently, 81 is a pretty common variance, and when the threshhold hits 81, suddenly there are only 600 or so triangles with a variance less than that (whereas there were about 1200 triangles with a variance less than 82). and as a result, suddenly half my terrain disappears, because very large bintritrees aren't getting subdivided. then, since so few triangles were rendered, after a few frames, the threshhold goes back up to 82, then 1200 triangles are rendered, and it pretty much just sits in this pattern forever.
i guess i'm just wondering if:
1) will geomorphing "fix this"? i haven't been able to get it to work yet.
2) could this be due to having "unrealistic data" (my heightmap is NOT smooth, and there are a lot of "discontinuities")
3) does it sound like a bug?
somehow i doubt geomorphing will fix a popping of 600 or so triangles. i'm going to try a new heightmap and see if things are any better. i guess it could be a bug...
here's my split code (the part that uses the feedback variance...) ... anything look weird? (especially the morphing -- it doesn't work)
inline void CTerrainMgr::Split(CBinTriTree* pBinTriTree, uint nLevel)
if ( nLevel >= kMaxLevels )
pBinTriTree->m_fMorph = 1.0f;
if ( !pBinTriTree->IsSplit() )
uint nError = s_abyVariance[pBinTriTree->m_iImplicit];
if ( nError < s_fThreshhold )
pBinTriTree->m_fMorph = 1.0f;
pBinTriTree->m_fMorph = (nError - s_fThreshhold)/256.0f;
// AVERAGE LEFT/RIGHT morph values??
if ( pBinTriTree->m_pLeftChild )
pBinTriTree->m_pLeftChild->m_fMorph = pBinTriTree->m_pRightChild->m_fMorph =
(pBinTriTree->m_pLeftChild->m_fMorph + pBinTriTree->m_pRightChild->m_fMorph)/2.0f;