Search Unity

Question Is there a way to manually fill rasterization buffers to optimize grass and leaf rendering?

Discussion in 'Editor & General Support' started by uraniumb, Sep 5, 2022.

  1. uraniumb

    uraniumb

    Joined:
    Apr 9, 2021
    Posts:
    5
    Graphics cards fill buffers of connected geometry, 32 or 64 vertices at a time depending on the hardware.

    If two disconnected pieces of geometry are in the same mesh unity will send these pieces separately because rasterization uses 2d bounding boxes to group geometry together and if these pieces were far apart it would really slow down rasterization.

    For this reason, rendering grass and leaves on trees that have less than 32 vertices is very slow because thread groups are not being completely utilized.

    Is there a way to force unity, Or is there a way in the direct X pipeline, To say that all vertices in a given mesh should be submitted in order regardless of how disconnected they are? I know that also for example even if UV coordinates are split, for example, if each triangle had its own UV Island that would destroy rendering performance.

    I thought that maybe using geometry shaders and using numvertices(32) would help but it causes performance to become even worse.

    Im thinking maybe there is a solution with RestartStrip in the geometry shader but im not sure.

    Any pointers for low level rasterization control or input assembly or a software rasterization approach built specifically for these kinds of disconnected meshes would be great.