rend3 icon indicating copy to clipboard operation
rend3 copied to clipboard

Feature request: add draw_range to Object

Open gzp79 opened this issue 3 years ago • 4 comments

It is more of a question or feature request: as I see it is possible to share the same mesh between multiple objects (using the mesh handles) but there is no way to share the mesh and create objects referring different ranges of index/vertex buffer to draw.

My use case would be to render lods. The draw ranges define different level of lods for each mesh and based on some heuristics different ranges would required to be rendered. While I could create an objects for each LOD (referring the same mesh) and add/remove it from the scene, I could not find how to set/alter the default draw range and stop rendering the whole index(vertex) data.

Thanks.

edit: some typo fix

gzp79 avatar Jul 09 '22 12:07 gzp79

In your case it sounds like you would have multiple meshes (one per LOD), then create and remove objects based on the current LOD status. Definitely want this to be improved at some poitn.

cwfitzgerald avatar Jul 18 '22 05:07 cwfitzgerald

The issue is that, the vertex buffer is shared, only the index buffer differs. I could split the indices into multiple meshes but the vertex buffer have to be also duplicated in this solution and as I see buffers cannot be shared between multiple meshes.

gzp79 avatar Jul 23 '22 08:07 gzp79

That's very Unreal Engine. The camera already has a draw range, of course. Do objects need one? UE has that. It's probably useful when you want small objects to drop out and don't have some system that's swapping mesh LOD models as the camera moves. Won't save any GPU memory, though.

My own experience is that Rend3/WGPU is now fast enough on the better GPUs that I run out of GPU memory before I run out of GPU compute. Going to need more access to the GPU memory situation over the next few months.

John-Nagle avatar Jul 28 '22 00:07 John-Nagle

That's very Unreal Engine. The camera already has a draw range, of course. Do objects need one?

I don't think if it should be part of the (low level) render framework. It is very application dependent how you want to toggle mesh visibility. For now I'd like to use if for LOD but I could imagine other scenario, where parts of the meshes are turned on/off for some independent application logic.

I have a pre-baked huge soup of geometry data generated from multiple meshes/material etc. constructed by an artiste. The original meaning is lost and application logic can select the index ranges to render based on multiple condition. One of them is the LOD. I really like this concept as assets can be uploaded/manged in a huge chunk/package and all the "hard" part, batching, material unification (like texture atlas generation), adding/removing attributes to the vertices is a task for an offline tool that can take any time (from minutes to even month if one wants to make it so irrational :) ).

gzp79 avatar Jul 29 '22 06:07 gzp79

Closing, no change for years..

gzp79 avatar Feb 27 '24 16:02 gzp79