Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    161
    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:
    761
    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:
    761
  4. dccoo

    dccoo

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