Search Unity

Question How Can I use multimesh for LODs and custom index behaviour at the same time?

Discussion in 'Visual Effect Graph' started by Danielsantalla, Jul 7, 2022.

  1. Danielsantalla

    Danielsantalla

    Joined:
    Jan 7, 2015
    Posts:
    75
    So, In my effect I’m using “set mesh index” and a world space texture to determine which mesh is going to have each particle.
    How can I mix this logic with the LOD behaviour?

    I want to replace all the particles that are far from the camera with my mesh3 (a simple cube) and the ones that are near to the camera with my mesh1 and mesh2, but those should follow some custom logic to choose which one to use (the texture I mentioned above). Using the LOD and set mesh index don’t seem to get along nicely, either I use the LOD or I manually set the indexes. Any ideas on how to do this?
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,307
    You need answer from devs, but I belivie it can't be done. Even if you can combine both functionalities you need another set of LOD meshes anyway, so in result amount would be equal to
    LOD_LEVELS * MESH_COUNT
    , what is 9 for 3 meshes with 3 LOD levels. Each mesh is rendered separately and this is the reason why it's limited.

    You might need separate it into 3-4 systems to get it work, or use single mesh with parameter (in shader) used to discard pixels based on vertex color or UV, but I am not sure how it would look performence wise.
     
    Danielsantalla likes this.
  3. Marie_G

    Marie_G

    Unity Technologies

    Joined:
    Mar 9, 2021
    Posts:
    76
    Hello, you can try using distance comparison and branch logic to achieve your goal, by setting mesh index depending on the result of the branch. I hope this helps.
     

    Attached Files: