Trees in Unity

The Unity engine has a built-in terrain system that’s been around for ages. It’s honestly pretty great actually, but it has a few quirks. The tree system is maybe the quirkiest part.

There’s a special system for trees, separate from the one for placing glass and other detail stuff. Your trees must use two specific built-in shaders. Your trees must reside in a folder with the text “Ambient-Occlusion” in the name. They may have colliders, but other components on them will be ignored.

I tried the tree system out, I haven’t used it before. It’s got some nice features – for instance it’ll automatically turn your trees into billboards at long distances to save rendering work (much like Jurassic Park: Tresspasser did way back in 1998). Although even that has its quirk – the billboards have a slightly different perspective to the meshes so they do some weird bending as they switch over.

I had it all working actually quite well, but the killer was the lack of support for custom components. The trees would have to be permanent; immovable. Scraps with indestructible trees? It wouldn’t do.

destroy_tree

Look at that realistic tree-smashing action (pls don’t destroy trees IRL).

So anyway I added some trees.

madison_pike_trees

(not to SandyBridge – I was just testing them there)

They’re not using the special tree system. They’re just meshes with a couple of LODs. LODs being levels of detail – showing the lower LOD at far distances. Works fine.

The trees I have actually came with two LODs already, but I wasn’t exactly impressed. Does this look like a seamless transition to you?

tree_lod

The branches are fine. The leaves not so much. So I made my own low LOD versions that aren’t particularly great either but everything looks OK.

trees

I’m still adding level content. Each “world” in Gauntlet mode is big – but at least it does get reused for three levels. My new job is taking up a lot of time as I knew it would, but I’m still managing to get a little Scraps work done. See you next time.

 

Bookmark the permalink. Both comments and trackbacks are currently closed.

2 Comments

  1. cupid the conqueror
    Posted September 26, 2016 at 1:28 pm | Permalink

    Im impressed as always! keep up the good work!

  2. Posted September 30, 2016 at 7:56 am | Permalink

    Feels a bit DayZ-like.