On Low-Poly Foliage

Happy holidays, everyone.

(I wasn’t sure if this thread belonged in Discussion, General Graphics, Game Design, or Aisle 3 at my local grocery. Hopefully I chose correctly).
It has been my understanding that it is fairly standard practice to model low-poly foliage by creating and overlapping several (possibly subdivided) planes until the desired volume is achieved. I understand this in the context of game optimization. However, after importing a plant I modeled last night and spending several hours trying to get it to display properly in Unity, I can’t say I understand it in the context of rendering.
Because my leaves were one-sided planes, it was of course necessary to use a shader that would not ignore normals when they pointed away from the camera. This unfortunately seemed to make it difficult for Unity to decide which faces should be drawn in front and which faces should be drawn behind. The result was that leaves from the “upstage” portion of the plant would occasionally (frequently) be rendered in front of leaves from the “downstage” portion.

I am curious to know how others are modeling foliage that can potentially be viewed from several angles by the player in-game. When using the “planes method”, is it normal to duplicate each plane and simply reverse the duplicates’ normals? It seems like this would really tax a polygon budget (those extra faces could be used to add more detail to other parts of the plant). What are your preferred methods?

I started this thread mostly out of wondering how other modelers were going about constructing their plants. I imagine there are many different approaches. The two that immediately came to mind were what I called “plane method” plants, and the more stylized plants in games like Super Mario 64 (which seem to fall under the billboard category, since they’re always facing the camera no matter how the view actually rotates). I did not start this thread hoping to solve a problem, but rather to find out how other artists like to model their plants. The issues with the normals inspired the topic of discussion for me, but those issues themselves were not the intended focus.

For reference, this is what I mean when I refer to the “planes method” of modeling foliage:

(Please note that it is not my model.)

Have a nice day.

The problem with this approach is it requires the renderer to work out the exact order to display each plane. This can create a lot of work, and doesn’t always mean the planes are rendered in the correct order, particularly if they are overlapping in some way. Whilst I know you can obtain foliage like this, I’m not sure it’s the right way. The trees that are used on the terrain renderer are real models, and Unity converts them into billboards when they are far from the camera.

@Graham-Dunnett Thanks for your reply. I could tell from the way the model was displaying that the sorting of the planes was an issue (and I did assume that this was because of the normals and not because of some Unity-related glitch).

I suspect modeling trees this way is meant more for games where the views don’t change very dramatically, when you’d be able to guarantee that the player does not see it from the wrong side (or perhaps for prerendered graphics). Also, some plants (like some conifers or willows) probably lend themselves better than others to this kind of modeling. I started this thread mostly out of wondering how other modelers were going about constructing their plants. I imagine there are many different approaches. The two that immediately came to mind were what I called “plane method” plants, and the more stylized plants in games like Super Mario 64 (which seem to fall under the billboard category, since they’re always facing the camera no matter how the view actually rotates).

That’s only if you’re using a blended transparent material. If you use a cutout instead this isn’t an issue, because pixels can be depth tested as per opaque geometry.

@Merman , there’s two things to consider here.

The first is how the leaf polygons are drawn into the scene. You need some form of transparency, of which there are two types to choose - “cutout” and “blended”. You should look up the difference for yourself, particularly with regard to “depth testing”, but for the kind of tree model you’re talking about “cutout” is the only viable approach because of how it uses the depth buffer.

Next, you need to show both sides of the leaves. There are two ways to achieve this, both of which are to do with “back-face culling”, which you should also look up. The first approach is to use a custom material which doesn’t do back-face culling, but this will obviously have the performance hit involved with not doing back face culling. The other approach is to manually add in flipped faces where you need them. This sounds like it’s more expensive, but it isn’t necessarily - for starters you’re only using the extra faces where needed, instead of for everything using the tree’s texture. (Without back-face culling, for instance, if the tree’s trunk uses the same material as its leaves then the far side of the trunk will also have its pixels rasterized at least up to the depth test, rather than being culled earlier at the polygon level.)

I believe that Unity’s provided foliage stuff is intended for the tree generator, which does things differently and uses alpha blending. This requires trees to be made in a different way, because it means that the problems Graham mentioned need to be designed around at the modelling level rather than at the rendering level.

The rendering of trees and foliage is a particularly good place to learn about the stages of the 3D rendering pipeline. They force you to pay attention to all of it and sort out a lot of subtle and complex issues.

1 Like

Thank you for your reply, @angrypenguin .

I want to start my reply by stating that I tested several different (default) shaders on my plant model (including both forms of transparency) the night that I first imported it. I understood the differences between them, at least on a superficial level (as a graphic designer, I knew what was happening visually). I also modified several shaders to turn off the culling (though apparently I didn’t try this with a cutout, specifically. I don’t mean to sound pompous. I knew that things were being “sorted” improperly, but I did not know that cutout and transparent shaders regarded depth differently … and the idea that they do gives me several ideas). I should specify that I was not using Unity’s provided foliage materials or settings. I saw them as being related to Unity’s built-in terrain and tree tools and, as I was not using those, I did not feel inclined to use the materials that “went with” them.

I certainly appreciate your input, but I’d like to reiterate that I did not start this thread hoping to solve a problem, but rather to find out how other artists like to model their plants. I know that the method I described is but one of several ways to go about it. The issues with the normals inspired the topic of discussion for me, but those issues themselves were not the intended focus.