3
\$\begingroup\$

In theory would it be faster to render a lot of grass patches that would dynamicly batch or big meshes of combined patches, too big for batching? Rendering chunks should be faster because unity doesn't have to combine them and it avoids some overhead but smaller patches will make it easier for culling.

\$\endgroup\$
  • \$\begingroup\$ What exactly is your definition of "small" and "big" in this case? Both extremes are bad (each blade of grass an own game object vs. the whole terrain being one mesh), so the optimum must lay somewhere in between. \$\endgroup\$ – Philipp Mar 21 '17 at 14:45
  • \$\begingroup\$ Patch would be about 5x5 blades and chunk 64x64 \$\endgroup\$ – Werem Mar 21 '17 at 15:03
  • \$\begingroup\$ Like many questions of "which would be faster" the most surefire way to know is to test it. Make a quick & sloppy example mesh and scatter a pile of it, profile your game, and see how it compares. That way you get an answer you know is accurate for your use case and target hardware, not some internet stranger's armchair pontificating. ;) \$\endgroup\$ – DMGregory Mar 21 '17 at 16:48
1
\$\begingroup\$

With batching, the fastest - performance-wise - is to do your own batching that is tailor made to the problem. Built-in batching is much faster to implement, and usually not that much slower in terms of performance.

So what you do is:

  1. Make it work. Implement it in the simplest way because simple solutions are simple to replace later.
  2. Measure if the performance is acceptable.

    2.5 If you can, estimate how much performance would increase if you made it "better"

  3. Make a note.

Once the game is mostly done, look at all of the performance related notes, sort them to by how much estimated performance gain per development work they will yield, and then decide which one you want to work on.

To answer your actual question:

Either can be faster, depending on additional technical details, such as how big the patches will be on screen, and how complex the vertex and pixel shaders are, respectively.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.