Shader complexity vs mesh density

Ive just been watching this tutorial about foliage: UE4 Tutorial: Foliage (Advanced) - YouTube

Between 8:00 and 8:30 he mentions that rather than using alpha on the foliage why not just model it.

So I have a foliage asset (a grass clump), after complete processing (baking the individual models onto fewer planes). it is about 16 Tris, Modeled it was in the region of 140

Is just using the whole mesh (the 140tri version) really a viable option? and how does this balance in performance vs using alpha masks? obviously the modeled foliage would provide a noticeably better visual but it seems like a lot of polys to be drawing considering there could potentially be hundreds of instances being drawn at any one time.

I’m going to go out on a limb and say the reason having more polys on screen vs having more complex shaders is because how ue4 handles foliage. It uses instanced static meshes, so you can have a small army (1 million plus) instanced static meshes on screen without a huge problem. Granted, if those meshes don’t have LODs you will begin to have a problem. The only thing that puzzles me is that instanced static meshes work as well as they do because there’s a lot less draw calls, which means they share shaders, so you’d think it wouldn’t be a huge problem.

I’m not sure, and the best way to be positive (other than someone more experienced than me answering this) is by testing it out. Trial and error is how I learned a lot of what I know.

People have already tried it out (see here). Summary:

  • The extra triangles hurt more than the overdraw, unless you’re looking only at nearby foliage (which is what you would expect, if you think about it*)
  • Don’t use the foliage painting tool
  • Use the grass tool, as it can handle way more foliage with good performance

The reason why you would expect that to happen is simple. The further away the mesh is, the smaller it gets. Therefore it covers less of your screen and produces less overdraw. The extra cost of the increased poly count does not decrease with distance. So what ends up happening is that you lose the benefits of having less overdraw, as you display more and more grass, because the number of vertices explodes. Here, straight from the thread: “[…] a few extra triangles per mesh will start to add up when you have millions of them in the scene.

That’s a special case I could see go either way. The best would be to just try it out. It’s not like you need actual grass meshes/textures for testing. You can use placeholders that have about the right dimensions for that purpose. That being said, the 140 tri version has way too many polygons. The question is how low you should go. You can look at what the guy in the thread I posted did for reference.

So in the case of a top down game wouldit be better/equally efficient to go for geometry based assets rather than texture based? As there would be no distance viewing.

thanks for the assist. Ill do some testing and take another look at that post with fresh eyes in the am.

Thanks again.