How does Umbra 3 support Level of Detail?
LOD support in Umbra is accomplished via draw distance limits, from Umbra's point of view it is now simply a question of distance range culling target objects.
Umbra::Scene::insertObject now has these new optional parameters:
const Vector2* drawDistanceLimits const Vector3* distanceBoundsMin const Vector3* distanceBoundsMax
For "drawDistanceLimits" you pass in the distance range (min, max) for which the object is active. "distanceBoundsMin" and "distanceBoundsMax" define the axis-aligned box against which the distance measurement is done.
Objects that represent different LOD levels of the same entity should have the same "distance AABBs", but different distance ranges (you may want overlap if you're doing morphing or something similar, otherwise prev level max = this level min). Use a negative value to indicate infinity.
The actual runtime distance is simply the shortest distance between the camera position and the "distance AABB". If no distance AABB is given as input, the AABB computed from the geometry is used. Note that you can pass in a point-like AABB for the object center or other anchor point if that is what you need.
Umbra will only use objects that have min distance limit at 0 as occluders. This means that there is potential for false self-occlusion from the most detailed LOD level to the other levels, in line with what we have discussed.
For more advanced uses, it might be beneficial to be able to pass in the other end of the distance measurement in runtime (overriding the camera position). We are considering adding this API, let us know if you feel that you need it right away. The downside of this is that it would disallow some pretty useful static data optimizations (distance culling in the preprocess, basically).