So let's all get together and make the bestest trees everrr

Hey guys. I and a coupla others have been in the process of making a game, deets are sparing till we do an announce, but I’ve been the one doing all the assets and lighting and well… everything not coding. Since I’m pretty new to the Unreal Engine, and am kinda past my skill level, I’d like to get some impressions, share what I’ve learned, and in the process, maybe you guys can help me make my stuff, in this case the trees, better, faster and prettier.

So without further ado, here’s some screenies of what’s been achieved so far, bear in mind we’ve rebuilt the map many times.

Going back a bit. The first time I made trees that I liked.

Further development and understanding of UE4 lighting led me to this:

We kinda switched the fully dynamic global illumination around this time, as we have day night cycles as a part of the game and gameplay. This also helped with build times as there wasn’t any. The quality drop off in shadows was perfectly acceptable.

After those initial tests, I made a master texture and implemented instances for each of the leaf types, effectively reducing the overhead in controlling lots of tree species. After that, it was time for a full forest test:

Those have all been culled now as I needed to work on the map itself, and understand more about tree making. We’re also in the process of trying to update from 4.4 to 4.6. I managed to get the latest build going with a much earlier version of the game and with a lot of broken bits (we’re having crippling crashes on the main build, which are generating c00005 errors seemingly isolated around map building and generation… It’s wierd). I was blown away by the new lighting improvements, though there really wasn’t any noticeable perfomance boost in foliage:

And of course, the latest work is in corridor style trees:

The main material is as so:

It’s not terribly complex as you can tell, but I’d certainly welcome any advice. Of course, feel free to use it in your own projects. I’d certainly love to see whatever you do!

I should note. The hit in performance is somewhere in the ten fps range. I’m not terribly accustomed to the profiling tools yet. And it fluctuations quite a bit. But yeah. In terms of performance, the foliage is quite heavy.

Cheers all, Happy Unrealing.

Moving to WIP section

These truly are some of the best trees ever. Remarkable progress given that your fairly new to the Unreal Engine!

Aww thanks man. I have a vfx and 3D rendering background, and am a photographer at the moment, so I’m not inexperienced with 3D world concepts. In fact, I’m finding the photography is the point of call I go to for a lot of unreal stuff now. Understanding how light works in the real world and how cameras actually work turns out to make a huge difference.

I used to use unreal 3 back before it became udk, and then udk for a while but never really got anywhere without coders willing to use the engine or time to properly sit down and do more than tinker. So this marks the first time I’ve actually sat down and tried to learn these things.

The frustrating thing is that standard tree generation techniques for games don’t work when you have to climb the trees in first person. They just look like butt up close, so optimisation is a pain and I have no idea how to go about it. Still… we’re getting there! more updates when we solve the 4.6 crisis.

Only way to solve your optimization problem is to make a LOT of LOD’s; up-close one would need to be in the 10-15k range excluding leaves minimum, with like 3-5 LOD’s in decreasing detail, and I would recommend using high texture resolution (2k+) because the performance hit of textures is fairly low, as long as you can balance out the memory side of things. But in general, these look pretty solid; the engine upgrade made a massive difference!

Also, you’ll probably find that the subsurface calculations you’re doing in the leaves material are pretty expensive, but, in my opinion, are well worth the cost. Still it is something to consider, as you can fake it with some clever emissive shading.

@fragfest:

LOD’s are good, and honestly, it just goes to show how little time I have that they haven’t been implemented properly yet. But it would have to be closer to 3 at the most, as having lots of LOD calls can be a problem, especially for a forest that has a few thousand trees. The calculation to figure out whether an object needs a LOD change has a performance impact, the point is that you want that performance impact to be less than having no LOD. So that’ll be something I’ll have to deal with at some point.

The emissive lighting idea is good, I’ll have to look into that, maybe wrangle the dot product and maths stuff to fake a localised emissive value on the underside of the leaves that approximates light scattering based on the direction of the main light. Subsurface is awesome enough that the visual improvement is worth it but it’s still expensive. I’ve been looking into a way to blend it over distance, but I have no idea how to do that. All the techniques I found involved landscape or broken old tutorials which didn’t transfer well. So if anyone knows a basic way to do that, I’d love to see it.

Picture for the day:

3717fbc58eeeb716c276396620f3519923f6c7e8.jpeg

It may be smart to do material LOD’ing too. I know LOD’s do cost something, but as far as I was aware, it’s mostly in CPU cost. With material LOD’s, you would probably increase the number of draw calls slightly, but doing fake lighting at a distance may save significant resources, so it may be worth it. When I say emissive lighting btw, I mean a simple small emissive value; this would be an unrealistic effect, as you would have emissive on both sides, but if you used it only for longer-distance LOD’s, it should still look OK. Best of luck! I’ve subbed to this thread, so I’ll do my best to keep dropping in when you post new stuff, cause I like helping the community out!

Awesome work Mugluck! Keep up the great work!

@Fragfest - Yeah, good point. I’ll definitely look into that. Already tested out some LODding stuff and it’s helping at distance. So I’ll definitely start implementing them properly.

Cheers man. :slight_smile:

A brief update on the trees, I was testing out optimisation and speed issues in various areas. One of the surprising things I found out was that subsurface scattering has absolutely no impact on performance whatsoever. Or if it does, it’s really really minor. I’m guessing it’s because the leaf meshes are single planes, which makes the lighting calculations simpler than larger volumes.

What I did find was that the performance hit was due to alpha textures. They just pile up and the alpha trace just ruins the performance. I tested out using polygonal leaves and completely removing any alpha casts, which worked, but because of the high poly count that comes as a result, the performance hit per tree ends up being the same. I did figure that having a few of these scattered about could take some of the load off of the alpha calculations though, as the trees themselves have a different look. Or maybe I can do polygonal leaves in addition to large leaf planes, and small clusters.

Basically, whatever reduces the alpha count, without going above 60k tris. Which is the absolute max I’ll allow for a tree. That sounds crazy, but we can’t really take too many shortcuts when the trees are a dominant feature that’s up close all the time. most trees in games are designed to be viewed from one angle and far enough away that all the shortcuts aren’t noticeable. That’s not an option here. Yaaay.

So yeah, maybe I’ll make the White Tree from LoTR just for funsies later. :slight_smile:

Minor update as I’ve been super busy and we’re still trying to unscrew 4.6. I added a procedural colour overal to the leaves that allows for world space mottling, effectively bypassing the issues that limit to per leaf plane colouring. It’s subtle, but no tree is ever uniform in colouring.

For illustration, I made it bright blue. You can see how it’s sorta random where it’ll appear.

But seriously, is no one else working on foliage and trees. Can I see your stuffs? I’m assuming it’s all amazing and you’re disdaining my slovenly attempts.

Good work! I’d love to see a comparison shot before and after this recent change (though with the actual color you would use). I’m not working on foliage right now, wish I had some to share!

Most of these shots are either backlit or in silhouette, harder to get a read on the material. You have any shots in full sun illuminating the trees facing the camera?

Sub surface effects look cool so far.

Well… welll… ummm. But but but they’re soo boooootifuuuuul.

Yeah sure. I just like sunset and my test for realism is always lighting. Here’s a comparison, first is with it applied and second without. Flat lighting, little bit of emissive etc. There’s a looot of control over colour and lighting.

Wow, the shader looks AWESOME! I really love that color effect you used. The leaf planes are kinda obvious though, at least from this angle; they may be fine from the ground…

here is what i came up so far
4d68303f56fe7224aebcabaa8c2a702d5e1dba47.jpeg

simple material unfortunately standard sss shader

@Fragfest - Cheers man! Yeah the leaf planes need work, I’m still working out what the best balance of large to small is.

@Piroman - That’s still not bad work! Still, I’d definitely advise popping a bit more variation and kinking into the branches and trunks as trees never grow straight. From personal experience, controlling the SSS is best done with control over the opacity mask and control over overall opacity. The former allows you to dictate how much the alpha mask affects the leaves and the latter controls overall opacity. Subsurface scattering is powerful, but it should be controlled as leaves have different levels of translucency - which is where the effect is necessary for realism purposes.

How are you finding the performance for large populations of your trees? Say 500 to 1000 or more.

@Zeiten - Much appreciated dude!

Some more work today, we ummm, may have fiddled with the postprocess volume. This is not errr, possible to realistically do at all. But hey, screenies!

780c48b834cf66a90ea29bc3a60ae8038b283fd6.jpeg

ebaab46e5d73edcee2b0dca2c2a17e56527fcb98.jpeg

70a56ad9b8c10a67317b966d7b859872442417f3.jpeg

It may be unrealistic, but the lighting is baller!! Keep up the great work dude!

I love trees!

Incredible work! Keep it up. =)

You may be able to use Imposter Sprites to render distant trees at low cost. Whether that’s a feasible solution mostly depends on the style of play but on of the screenshots suggested it was an FPS which could work decently with that method.