Search Unity

Rendering Sub Meshes with different materials

Discussion in 'Graphics for ECS' started by Celes_Eternal, Jan 20, 2019.

  1. Celes_Eternal

    Celes_Eternal

    Joined:
    May 18, 2018
    Posts:
    18
    Hello guys :)
    I'm wondering about the good approach of my current problem.
    I'm creating a LOD system which looks this way :
    - LOD0 have 5 materials
    - LOD1 have 2 materials
    - LOD2 have 1 material

    Well in fact there is other parts but it's out of the scope of the question.
    If I'm right the MeshInstanceRenderer can have only one material. And btw all my meshes (not really everything but a lot, really) are unique (procedural generation). So instancing dosen't make sense but the system seems okay even for that, and shared components are probably packed by type so it should be okay.
    But my problem is the lack of multi meshes support by the system (or maybe I just didn't see it).

    I saw that I could rewrite my own Mesh struct and use GL Api, but it may be a bit extrem and I guess I won't be using the HD Rendering pipeline like this. Or maybe it depend of the material?
    I could also rewrite the Entities API to fit my needs but I don't really want to do that. Or maybe just write a shared component with a kind of array for meshes and materials and rewrite a new rendering system?
    Or I could simply create a component that is going to create one entity by mesh I need and delete then on remove.

    For a long and complex project, what should I do? Something I said, something I didn't even think about?
    Would be nice to have your inputs guys :)
     
    EG-Cookie likes this.
  2. EG-Cookie

    EG-Cookie

    Joined:
    Dec 12, 2018
    Posts:
    6
  3. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    EG-Cookie likes this.