Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question How can I scale the mesh used in DrawMeshInstancedIndirect

Discussion in 'General Graphics' started by dccoo, Nov 4, 2022.

  1. dccoo

    dccoo

    Joined:
    Oct 3, 2015
    Posts:
    157
    The question is pretty straightforward. I'm executing DrawMeshInstancedIndirect using Unity's default quad as the mesh.

    I want to know if it's possible to scale this mesh (so I can test the quality of the results with bigger and smaller mesh size) to execute the instancing.

    If possible, I prefer not to change the original geometry of the mesh, since it is used in some other places. Maybe there is a good way to create a copy of it and scale? I'm opened to suggestions on the best approach for that.
     
  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    289
    Hey, if you would like to create a copy of default quad mesh in Unity Editor, I suggest installing FBX Exporter in the Package Manager.

    After installing, select the GameObject with quad mesh in the scene hierarchy.

    Right click and select something like "Export to FBX" in the right click menu.

    After exporting, select the exported fbx, then you may change the "scale" in fbx import panel. (and apply)
     
  3. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    289
  4. dccoo

    dccoo

    Joined:
    Oct 3, 2015
    Posts:
    157
    I just cloned the mesh in the Start method and multiplied all the vertices positions by the scale I wanted.
     
    wwWwwwW1 likes this.