Search Unity

Why does setting a non-zero Bound.center move meshes?

Discussion in 'General Graphics' started by b0nes123, Apr 6, 2021.

  1. b0nes123

    b0nes123

    Joined:
    Nov 6, 2019
    Posts:
    28
    Hi all, I've been playing around with Graphics.DrawMeshInstancedProcedural, but I've ran into an issue with the Bounds parameter. Whenever I set the Bounds.center to any non-constant amount, the mesh is moved by a corresponding amount. To illustrate this, here are 64 chunks rendered with GraphicsDrawMeshInstancedProcedural.

    bounds no mid.PNG

    Each quad is rendered with its own separate call of the Graphics.DrawMeshInstancedProcedural method, and each Bound.center is set to zero. However, when I set the Bound.center to the midpoint of each chunk this happens:

    Bounds.PNG

    Since, as I understand it, the Bounds parameter is only telling the GPU if the mesh should be rendered not where the mesh should be rendered, why does Bounds have any effect on the position of the mesh being rendered?
     
    Last edited: Apr 6, 2021
    deus0 likes this.
  2. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    Any luck on this?
     
    THJSmith likes this.
  3. b0nes123

    b0nes123

    Joined:
    Nov 6, 2019
    Posts:
    28
    No, I originally planned on using Bounds as a sort of culling method, but I realized I could just do that myself and stopped looking into it. Looking back on my post, I think the issue is that I was setting the Bounds center vector3 to the midpoint of the chunk instead of the chunk's origin.
     
    THJSmith likes this.
  4. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Interesting.