Hi, everyone
recently, I'm writing a terrain engine, and I tried Geomipmap algorithm.
I just wonder how the Heuristic with which to switch LOD is derived.
That is really a mystery for me, if anyone of you can help me, I will
really appreciate it.
Thanks.
A question about Geomipmap's Heuristic
Yes, I know. But, in irrlicht's source code, there's method like this:hybrid wrote:Most engines use a simple distance based decision. which is also quite common in other LOD applications.
Code: Select all
//! used to calculate or recalculate the distance thresholds
void CTerrainSceneNode::calculateDistanceThresholds(bool scalechanged)
{
// Only update the LODDistanceThreshold if it's not manually changed
if (!OverrideDistanceThreshold)
{
TerrainData.LODDistanceThreshold.set_used(0);
// Determine new distance threshold for determining what LOD to draw patches at
TerrainData.LODDistanceThreshold.reallocate(TerrainData.MaxLOD);
const f64 size = TerrainData.PatchSize * TerrainData.PatchSize *
TerrainData.Scale.X * TerrainData.Scale.Z;
for (s32 i=0; i<TerrainData.MaxLOD; ++i)
{
TerrainData.LODDistanceThreshold.push_back(size * ((i+1+ i / 2) * (i+1+ i / 2)));
}
}
}