thank you both for your answers !!
[QUOTE=Dark Photon;1287850]Ok, so lots of models, each model has multiple mesh LODs, each mesh LOD is a draw call. And you want to do LOD selection based on some “screen size” heuristic.
You could use this as a LOD selection heuristic. However, think about a long thin feature like a table top (with no legs or thin legs). When you’re looking top-down it hits a lot of samples. When you’re looking near edge-on, it hardly hits any samples. Do you really want to render a different and much lower-resolution LOD for that? That’s when you need the edge profile detail.
I suspect you may be happier with a LOD selection heuristic based on the size of the model’s bounding sphere on-the-screen (in the view frustum), or based on a distance-to-model-center heuristic. Both are super-cheap to evaluate in a shader, and the former has the benefit of dynamically adapting to field-of-view (frustum) changes. With either of these, you don’t need to rasterize the model to be able to tell which LOD you want to use.
If you think one of those LOD selection criterias (or something similar) might work for you, you can do the model culling and LOD selection on the GPU using a geometry shader in a first pass (this builds a list of instances). And immediately after that, you can launch one instanced draw call per unique LOD mesh (e.g. 5) and in doing so render all of your models (e.g. 100+), each one rendering with the correct LOD.
This all happens on the GPU side so it’s very fast, and in the end you end up rendering a lot of models with very few draw calls.
For more on this, read this thread (including the linked tutorial pages):
“instance shader” … “model culling” … sounds very interesting
something like:
pass 1: build instances
for each object
determine model type, add transformation matrix to temp array
put all temp arrays of model instances into array buffer (or uniform buffer)
for each model type
use compute shader or transform feedback to determine if model center is in view frustum, feedback if so, and determine LOD dependent on the “depth” value = (MVP * vec4(0, 0, 0, 1)).z / w
pass 2:
for each model type
for each mesh
for each LOD
drawinstanced() (maybe indirect if i’m getting it right)
… right ?! i’ll try that approach … thanks again !