My current task as a junior (read: newborn) member of a very small indie team is to make trees for our UE4 project. Heh!
I've read countless forum threads (including Polycount's wiki on foliage) and watched as many YouTube tutorials, and all claim to preach the ultimate method, be it cheap/quick, quite complicated, or a plain shortcut (via 3rd party softwares, that is).
I've been told again and again that a higher polycount is always preferable over the dreaded "quad overdraw" because of how well/awfully UE4 handles them.
Now, as a mere test I've modeled a tree of my own. The main body of the tree (the trunk + the main branches) is as low as ~570 triangles, while the leafs make this number skyrocket above 12k(!!).
Obviously too much, for a tree that is going to be instanced as mere foliage.
Lo and behold:
Please, ignore the absence of a normal map and the abysmal color picked for the very basic shader applied to this mesh.
Everything you see is made of pure polygons, no alpha cutouts at all, the shader itself is set to "Opaque".
The trunk, at the base of the first branches, is about 2.5m tall, and with this notion in your hands you can quickly guess where the main problem with this model lies: leafs are way too big, there should be more of them and they should be like 1/4 of that size.
Each leaf takes 7 triangles, they are clustered into groups of three, then applied 5 times onto a twig (13 triangles), which in turn is instanced 100 times (through Blender's particle system) all over the branches.
Add the trunk's triangles count and you get well over 12k. My first reaction has been "unacceptable!".
The shader complexity/quad overdraw view in UE4 showed some reassuring colors, though, which is nice.
The most obvious workaround (to me) would be using *cards* and alpha cutouts. But I cant go wild with that, I've been taught that too many *blank* areas would paint the quad overdraw view in full white....which is bad, very bad, worse than "crossing the streams".
So, how may I make my tree(s) look lush while keeping polycount and quad overdraw at acceptable levels, levels that would ideally allow me to instance this tree so many times that the amazon forest would bow its head....?
Ok, I'm overexaggerating, here, but you got my point, I believe.
What is the "best practice", which tutorial is the one that depicts the most acceptable industry standard, what guide should be my bible?
Please, no 3rd party softwares, especially *pay-wares*. Beside my utter lack of cash, I want to have full control over what I'm trying to achieve, which means "handmade" should be the buzzword of the day.
Help. =0
Replies
As you lod you can be less precise as the cost is per pixel
I would suggest making some sort of branch with leaves baked down to a plane how, big a branch depends on how far away the trees will typically be. When you cutout the geometry around the branch you should deform it too so it doesn't appear planar, also if you bend the same branch texture in different ways you get variations and a bit more mileage for the same texture. You can have smaller branches and leaf clusters, even a few individual leaves so you can fill out the volume of the tree at closer distances, and those smaller meshes are simple to LOD out.
Unreal comes with a default impostor baking workflow, but it's kind of hard to setup and work with. Still, it does what you need it to, just with a bit more work.
Ryan Brucks has created a new version that is available as a plug-in and it goes far beyond what the old impostor baker could do.
https://shaderbits.com/blog/octahedral-impostors/
https://docs.unrealengine.com/en-US/Engine/Content/Tools/RenderToTextureTools/3
https://youtu.be/Sd1nXiI_ros
If you're worried about perf, impostors are a good way to go.
My real problem is just with close up models, I want them to look good AND be performance friendly.
I got, from the other replies, that using cards is not just an option, so I'm looking for a good tutorial that will eventually teach me how to decide what level of fidelity I should aim to when cutting my cards around branch textures.
How much blank space around a leaf is bad and how much is acceptable to avoid unbearable vertex counts?
It's quite the matter, to me.
I don't have any affiliation with speedtree. I just used it recently for a game project. Saved a ton of time and headache.
Tutorials/guides? =0
EDIT: the "Speedtree for Games v7" requires me to actually fill and sign a contract....are you serious?!
I've been trying to find an article I found on here not too far back... it was a bunch of great tips for natural environments in game engines, focusing on photorealism but still meeting realtime performance needs.... I'll link it if I can find it again. IIRC, some tips included making your "cards" the basic shape of your fronds, making those larger and putting several branches/fronds inside each. This way you can use less cards overall and still get a dense look. So, to put it more clearly : stack several leaf/branch textures into a single "card", have the card follow the general outline of the textures, rather than a million tiny cards holding an individual branch.
Other tips included using a very noisey normal map for distnace LOD's and billboards, and decreasing the alpha falloff to retain a more realistic look from a distance.
This is an 80.LV article with the breakdown of that environment, might have other useful foliage info for you too.
https://80.lv/articles/growing-a-jungle-environment-in-ue4/
Pity he doesnt show how he fixed the quad overdraw, what interested me the most is how much he raised the polycount to overcome that issue.
Cards are usually fairly optimized and don't crunch all that well. It also doesn't understand that the asset is made up of a bunch of sub-components and it won't combine them and render out a new batch of branches.
Branches get shorter, leaf planes are left floating. Textures distort and skew horribly, it just makes a mess... You'll run into it as soon as you start working with anything card related... If you try to crunch your way there, it require more verts to hold the shape and volume than an impostor will.
You want to limit the number of transparent pixels on the screen as possible. Especially if they draw over other transparent pixels, so trim them as close as you can without adding too much to the poly count.
The "trim as close as you can without adding too much to the polycount" is just my point. How much is too much, when it comes to polycount and overdraw? =p
You can see that with the fan palms that there is a decent hit of overdraw on the areas in between the leaves, but the amount of polys you would have to add to the leaves to get rid of that might be too much.
https://twvideo01.ubm-us.net/o1/vault/gdc2018/presentations/gilbert_sanders_between_tech_and.pdf
As a place to start, just make the trees to the quality you want to see. Observe basic optimization guidelines, but don't let any worries hold you back from production. You'll learn the most from seeing. Once you get the basic demo up and running, then you won't have to guess at things anymore.
[spoiler]You seem pretty good at shooting down ideas and turning up your nose at examples or theories that will get you where you need to be.
"I want something to do this really complex thing for me and I want it for free... where is the really simple thing that just makes stuff?"[/spoiler]
If you want high quality at low cost it's going to cost you time.
*switching this to spoiler because it is pertains to the OP's "posting style" and not really foliage
You kind of nailed the main problem: I dont know what I dont know.
I dont live in place where I can get proper courses for this kind of stuff, I have no contacts that can teach me, I have no sources of knowledge other than the Internet.
And the Internet is full of information, yes, but mostly fragmented and, more often than not, contradictory.
I type a question on Google and hope for an answer, but I have no means to know whether the acquired information is complete and still valid.
I have to rely on forums, where people may or may not (almost always "not") have time to go in depth when explaining things, so I get even more fragmented information and plenty of concepts that I didnt even know existed and that most of the time I cant find a use for (because I lack the knowledge to see how they relate to the rest).
I want to learn, but I have not a path to follow, nobody's pointing a finger and telling me to "first of all, go there", so I mostly spin around constantly changing direction while chasing this or that advice to achieve my next (arbitrary) goal.
It's quite frustrating, but I wanna learn, that's what keeps pushing me forward.
What you have to do is find all the info you can, and then start experimenting. Other peoples goodwill information can only get you started. You still have to do the work. It's hardest in the beginning, but you get the hang of things and after maybe 6 months to a year or so, you'll know enough that you can easily make sense of even vague information. You stick with this game project, and you will be taking a major shortcut in learning -- you'll learn a massive amount if you determine to finish your game no matter what issues you face.
It seems like you already know enough to make these vegetation assets. You are just getting hung up with worries about performance. I'm saying, forget all that for a minute and just produce the trees that you want to see. Maybe they come out at 20k tri's, and you just know that is too much. So start looking for ways to reduce the tri count while still retainign that look as much as possible. Just try anything that comes to mind -- thats what everybody does. In my own game project, we found that trees weighing around 2k tri's at LOD0 were about right -- but that's almost an arbitrary number because there is a million and one other factors affecting game performance. We didn't learn this number until I had made like 5 iterations of trees and tested them in the game.
Also, scour the web. Like I mentioned, there was a fantastic article I rfound here on the forum about this exact subject. Sadly, I didn't bookmark it. But it was something I found just google searching. When you are approaching a new subject, spend a solid day or several days just searching. Compile all the informatioin you can find. Skim through it, picking up whatever bits of info you can, then -- whether you fully understand your task or not (you never will) -- just get to work. Trust yourself to figure things out as you go. When you hit a problem, first, be patient, and decide if its worth solving completely, or worth some jimmy rig workaround. Everything is a question of, is it worth the time?
One other thing... get some money. You don't need a lot, but find some way to get $30 from time to time. Basic tutorials, from pluralsight, lynda, 3dmotive, gumroad, etc, are invaluable time savers. If you have access to internet and enough free time to do this sort of thing, I'm sure you can scrounge together a little money to help aid your learning. Don't let poverty hold you back. That is something you can remedy with some ingenuity and hard work.
Or maybe I actually went and started to try that approach?! Which one, to you?!
I wanna learn, is it hard or easy I dont care. But I wanna learn, not get a piece of software and let it do all the work for me.
I'll appreciate automation when I'll have my baggage of practical experience, having it easy from the start aint the best way to learn anything (to me).
Also, I cannot afford any pay-ware, at the moment, so speedtree is still a no-go.
I dont want it "for free", I simply wanna craft it with my own hands. It's gonna be hard and it's going to look like sh*t, at first, no doubt, but then I'll truly know what I'm looking at when working with automated solutions and I might even find manual solutions more suitable for the case; and I'll be able to handle it.
So, you got valuable sources of information for me, or you're only good at shooting ME down?
Take what is useful, ignore the rest.
I think I'll just stick to purely technical talk from now on.
Aaaaand I'm jobless, already spending money on a game design course that unfortunately doesnt cover much, in terms of technical knowledge.
Actually, at this point I might know much more than my teacher, about certain topics.
When you dont know what you dont know, solutions you cant think of by yourself just dont exist.
Same goes for any other knowledge. -.-
Anyway, I'll try to find a good balance between cards and overdraw, although I will probably never know whether I'm achieving a good result; having a powerful GPU is not always a good thing, apparently.
People are kindly helping you, but because it is not what you want to hear, you reject it, and show disrespect. You bite the hand which feeds!
I perfectly know people can make trees manually, it's been like that for ages and it's still a valid method used by a plethora of artists.
What I'm asking is where the sweet spot between polycount and overdraw lies. How to know when you get *there*. Roughly, *ça va sans dire*. What to put more attention into and what to avoid altogether.
I have received both valuable inputs and non-viable solutions. But not once I've shown disrespect toward anybody, I'm pretty sure about that.
Best case, do what you think is working so far, get it in your scene, and profile it. Both kinds of overdraw will be visible in the Base Pass and Pre-Pass, if you calculate the alpha in the Pre-Pass, but I believe the latter is more influenced by triangle count and not wasted transparency.
If you really want to see what is the best, make your asset with different methods and compare individual costs in RenderDoc, or overall times in Unreal.
1st off speedtree isn't a one button tree maker, it helps you make trees, there is still plenty of manual labor that goes into making exactly what you want.
2nd I'm suggesting that you use what it outputs as an example, a guide, to help teach yourself. When I was learning there where very few examples or tutorials around to help me learn, I would have sold my left nut to get a hold of an example. But if you're so freaked out about license agreements and downloading software that you need to find other examples by all means, there are a lot of them floating around, now.
How close do you trim your planes?
This is the kind of a question that veers into "how many polys are in a piece of string" territory, because there isn't a set number of verts or a specific formula to follow that will guarantee prefect results. We aren't being dickheads and withholding the one key you need that is blocking you form greatness. The answer is, trim them as close as you can without adding a ton of polys. Try to limit the number of transparent pixels floating around in your scene as much as possible. There is a balance to achieve and that balance isn't the same for every project.
The balance varies and it depends on a lot of factors, like your target hardware, the style of the game, how dense your foliage is, how important the models are to the overall game, how your engine handles opacity, how complex your shaders are, what else is in the environment, how many resources are being eaten up by other systems, bla bla bla hundreds of factors. That "magical sweet spot" has to be dialed in by you as you work and test it, that isn't for anyone else to dictate to you.
As an artist in this industry you are actually a fireman, you put out fires.
- If overdraw is an issue and you have verts to spare, add more verts to put out the overdraw fire.
- If verts are an issue and overdraw isn't, trade verts for overdraw.
- If both are a problem then start reducing the number of cards in the scene until something else starts smoldering.
- If neither is an issue, good fuckin job, you're onto the next fire.
- If nothing is on fire, just wait someone will start one.
When you get hung up on "how close do I trim my planes, I can't move forward because no one will tell me", you have to understand its frustrating to read shit like that. I and many others read it asThat close, shoot for any one of those rows, go tighter, get lose and sloppy, see how it affects things.
Speedtree could be your north star, but you just looked at this stuff and said "meh, pfft! Bring me more peasants, this cake has displeased me"
Go! Figure it out. Make some horrible, gawd awful, pile of crap, run some test and figure out ways to make it better. That's how you're going to get to the best possible results for what you're working on.
Hopefully now you understand why it is hard to give a specific answer to your question and why you aren't likely to get a hard and fast rule. Its an open ended question that depends on a lot of factors.
No idea what "Base Pass" and "Pre-Pass" are.
No idea what "RenderDoc" is and how to eventually interpret it.
=(
These guys all seem to have it right; with any art, there's no ultimate perfect right or wrong way to do things. It's not at all an exact science, it's an interpretive act. And you can't interpret correctly until you experiment and observe more about how it's done, and try it yourself. Try not to get hung up on the ultraspecifics. I do that myself, but it's not productive, it only gets you bogged down.
My old teacher used to call this obsession with making every vertex perfect "rainmanning", which is offensive now that I think about it, but his whole point was, you need to step back and look at how accurate and perfect you really need to be, because it'll never be as perfect as you'd like. And compulsively trying to get everything perfect isn't productive, beyond a point.
I'd personally recommend stepping away from this thread, reading/watching some good foliage tutorials, and just experimenting for a while. You'll learn way faster that way, and it'll be more practical knowledge.
https://unrealartoptimization.github.io/book/profiling/view-modes
There are also several runtime commands that you can use to call up while playing the game and figure out what is eating up your frame rate.
This is a fairly long talk but a good one for every artist to soak up.
https://www.youtube.com/watch?v=hcxetY8g_fs
~12min he covers the console commands.
~15min he covers the visualizers.
https://docs.unrealengine.com/en-us/Engine/Performance
Alot of that stuff is over my head, but just understand your simple question about overdraw vs polycount is actually a complicated one, and profiling tools are how you figure it out for your particular case.
Now you know a lot, you're basically eligible for teaching in pro classes, but I'm a crybaby because I asked around to give me directions based on you people's experience.
In fact it took *you* 4 replies to give me an answer that fits my questions. Much appreciated, this is beyond dispute.
All I asked for was a practical direction on how to do certain things, something that would sound like "when I do this kind of stuff I start from *here* (visual example) and tweak around depending on *these* factors".
That would've given me a (the!) starting point, and would've spared us all my continuous quoting my own words about 3rd party softwares.
Why am I the ranting kid, if I try to acquire a knowledge that's been built over decades instead of starting from the stone age and going through it all on my own?
Why am I the lazy slacker when I ask for a manual method rather than an automated one, or when I spend many hours trying and then I come here asking for some knowledgeable advice to avoid wasting any more time on the wrong method?
I always thought schools and forums are there just with this purpose in mind.[/spoiler]
*Switching this to spoiler because its useless ranting and distracting from a fairly useful thread. -Mark Dygert
All the info is out there, and it seems much of it is right here for easy pickings. Just go one step at a time. You'll get there. Some stuff, after you dive into it for a bit, may simply be too much too soon. For instance, I don't have any clue how to use a profiler, and yet I've helped to build a game. In my case, there was a programmer who used that stuff, interpreted it, talked to me about what issues he was facing, and I produced more stuff based on that feedback. Sometimes you don't have to understand all the techincal details -- you just have to have a basic understanding of how things work so that you can produce your art, however it's needed.
If you are working on a team where most people have more questions than answers, it may be worthwhile to kind of get the whole team into the same perspective and kind of use each other as leverage to learn from, rather than getting upset that you can't hit your target quality game.
In your own case, if you don't have the time or intention to get into the deep, technical side of things, but you don't have someone to do that (interpret profiler data), just make a really simple game that won't push technical boundaries. Focus on doing the most with the least, as a principle. That's part of "staying in scope."
Everything I made 'til now (the terrain heightmap and weightmaps in World Machine, terrain textures in Substance Designer, grass cards with and without alpha cutout, manual and automatic LODs, shaders that also cause grass to displace around the player, rocks with perfectly invisible UV seams etc etc) is the result of my personal journey through games developing.
And I mostly learned this all through tutorials and articles, but in a couple of situations I had to come here to ask for help.
Crafting performant trees is just the umpteenth step in a seemingly never-ending stair, I cant really set the boundaries of my role in this project and I wanna give my all and learn whatever I stumble on. I'm HUNGRY!!
Most are very cheap, all but in depth, rushed, even showing obsolete or wrong methods. Or they're very in depth, well done....and targeted toward performance independent cases like still renderings or movies.
Or they just use 3rd party softwares, which is a big no, for me. =p
Anyway, since we're here, how do I turn wireframe on, in Skyrim (FO4 mostly has leafless trees, so....)? THAT could be a quick and cheap way to check some production ready examples!
Although I can remember the birch forest around Riften being a damn kick in the loquats for any GPU. I shall investigate that too. =0
Also let's keep it respectful please.
https://polycount.com/discussion/63361/information-about-polycount-new-member-introductions/p1#respect
Here's the badass realistic enviro guy. Check out his 80lvl articles. Lots of goodies.
Here is the specific article which discusses tree cards:
https://80.lv/articles/alireza-khajehali-boosting-natural-environments/
Here is another good collection of knowledge and examples. http://irfancg.blogspot.com/2017/02/foliage-breakdown-tips-and-tricks.html
http://lmgtfy.com/?q=skyrim+wireframe+mode
TLDR: The console command is TWF it stands for Toggle WireFrame.
Second link is not funny, that question wasnt even for you and it was just a *btw* request. -.-
Thank you for the spoiler edit on one of my least useful replies, you should consider applying the same treatment to this one too: [ https://polycount.com/discussion/comment/2651998/#Comment_2651998 ]
This thread is coming up more helpful than I hoped, it might even deserve some consideration. ^.^
I dont know how to interpret what I see here.
The *pure overdraw* amount seems decent, no white and just a few red dots here and there....
But I have no idea how to interpret that "PS", havent found any reference anywhere for the "Shader Complexity & Quads" view. =p
Funny thing, I had actually bookmarked Alireza's artstation, but I didn't remember the name so it didn't register.