Best practice for static scene elements conversion including LODs

All the resources I've seen are about converting your moving entities. But how should you create/convert your static scene elements and what is possible/available (like LODGroups)?
Several questions arise:
Is there a LOD solution that supports ECS? Or should you use RenderMeshArray to render multiple elements.
Do elements in RenderMeshArray get culled, or do all meshes in that array get rendered (needs culling calculations before)? The docs doesn't tell me this, but maybe I just have found the right ones.

LODGroups in your authoring GameObjects get converted into Entities that only render at the configured LOD ranges (one Entity per LODGroup). The resulting rendering should be the same as the original LODGroups.

When rendering, Entities are what get culled and rendered, not RenderMeshArray elements. RenderMeshArray is just the component that stores the Unity Mesh and Material objects so they can be referenced from the actual Entities.


Thank you for that superfast response!

And do rendered Entities get additional optimization in renderspeed? Meaning: Do different meshes like in a modular construction kit get rendered faster "behind the scenes", or do we still need the classic approach (Atlassing & merging meshes). Are TextureArrays supported with ECS? I would prefer them over Atlassing, or use them additionally.

1 Like

Entities render using a BatchRendererGroup based path, which is able to use instancing whenever there are multiple copies of the same mesh+material combination. This should be significantly faster on the CPU than rendering the same objects with traditional GameObjects.

However, if your content is such that most rendered objects are unique, then the difference will be smaller, as we will still need to issue separate draw calls for different meshes and materials.

As far as I know, there shouldn't be any problems with using texture arrays with ECS.

1 Like

There seems to be an issue if a single model is used within more than one lod level in a lodgroup. It renders for the lowest index level, but nothing renders for the higher indexes as demonstrated below. Is there a mechanism in place currently to resolve this and ensure that the same entity can be rendered for different levels, or will I have to try and cook something up myself?

Below, first you see the transition between lod_0 and lod_1 when the GameObject is loaded in the scene view. Then the scene is closed and the entity representations are loaded, and the lod group is then transitioned between 0 and 1 in the same manner. The missing/empty spots are where the same model was used between levels.

An update after some testing:

I manually opened the scene, took the mesh that was reused in each of the lod levels and made a duplicate of it in the hierarchy, so that there was original_mesh, original_mesh_1, original_mesh_2, and assigned each of them to the lod levels, even though they were the same mesh, just different instances, and then closed the scene and loaded the entity representations, and it worked as one would expect.

I am hoping that this behavior is overall unexpected. It would be a shame to have to manually duplicate additional instances of the same mesh for ever LOD for no reason other than it doesn't work otherwise.

I think this behavior is a bug, and there should be a fix for it coming in a future release of the Entities Graphics package.