Search Unity

pure ecs LOD meshes

Discussion in 'Entity Component System' started by Shiv2k3, Jun 14, 2021.

  1. Shiv2k3

    Shiv2k3

    Joined:
    Jun 30, 2019
    Posts:
    118
    So I have created a planet by making multiple chunks which form a sphere, that works, I also added a chunk loading system that loads and unload the chunks depending on their distance form the camera, that was even easier, but now I'm trying to add a LOD system on top of the chunk loading system. I'm trying to implement this by creating 3 other meshes at increasingly lower resolution, but the problem is IDK how to store that information, so I tried to create another system that created 4 new child entities under each chunk, since I don't need the children to have any transforms, I have only added a RenderMesh and Parent components to them, I now I need to fill up that RenderMesh up, so I go ahead and
    Code (CSharp):
    1. eManager.SetComponentData<RenderMesh>(eManager.GetComponentData<Child>(ents[chunk]),
    2.                         new RenderMesh { mesh = mesh, material = material });
    , but that doesn't work, so what do I do?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    You have two options here.
    Using CullingGroup, to build own custom LOD, or is Unit (DOTS) LOD system.
    Checkout Unity samples, for LOD examples.
     
  3. Shiv2k3

    Shiv2k3

    Joined:
    Jun 30, 2019
    Posts:
    118
    Could you show me a code example if you can please
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    As I mentioned, please look into DOTS samples on github.
    You can also search for LOD on Unit DOTS subforum. There are number of discussions and you should be able find some examples.
     
  5. Shiv2k3

    Shiv2k3

    Joined:
    Jun 30, 2019
    Posts:
    118
    ok