top of page
Writer's pictureDan

Polygon Planet: Post 6 - Woods for the trees...

Should I create trees as GameObjects or use the built-in Unity Tree System?

This game is set on an alien world so the normal notion of trees is not quite what I have in mind.


I want 'trees' on Polygon Planet to be exceedingly low-poly shapes similar to the characters themselves - i.e. composed of cubes, pyramids, rombuses and other simple primitives.

To follow my intended ethos of "beauty thru movement" the trees must either be animate or at least appear to be animated by means of a suitable Shader. The kind of animate qualities I have in mind include:

  • sway in the planetary wind.

  • respond to pollination or visits from insects/birds/fauna/npcs therefore they need trigger colliders.

  • uproot and walk/relocate themselves

  • grow (change shape)

  • yield fruit

  • be chopped down

  • open to reveal an elevator down to the subteranean complex.


Since I am developing this game by myself I want to avoid the time-burden of manually painting them on to the landscape and tweaking them to look slightly different, so I plan to write a script that will place them on the landscape in accordance with rules such as terrain gradient, terrain height, proximity to water, proximity to each other etc.



Built-in system:

Pros:

- handy brush for painting them on to the terrain.

- built in shader for making them appear to move with the built in WindZone system.

- built in LOD system and billboarding for managing large numbers of trees on screen at once.


Cons:

- no individual colliders because trees combined with the terrain into a single collider.

- not easy to remove, reposition or change the shape of a built-in tree at runtime.

- standard tree system isn't that performant

- LOD switching is discrete bands causing tree details to "pop" into existence rather than smoothly transition.

- wind sway is a shader trick and the actual tree meshes are not animate which could cause discrepancy with collision detection for something such as a bird landing on a branch.



There are indeed other packages available such as SpeedTree etc which seek to remedy the issues above but I am first trying to do everything using the free packages that ship with Unity if possible.


GameObjects:

Pros:

- Meshes of each tree can be completely customised and can be a totally custom hierarchy of GameObjects.

- Collisions with trees can be identified easily since each tree can have it's own collider.

- Branches and tree trunks can potentially have their own colliders.

- Wind sway and motion can potentially be genuine mesh animation affecting the colliders rather than just shader trickery.


Cons:

- I will have to manage billboarding or LOD etc myself in order to maintain framerate and performance in areas with many tree GameObjects.

- I will have to manage animation and sway myself either as a custom shader or real GameObject animation.

- I will have to think of a way to manage performance of tree animation myself if there are many GameObjects to animate at the same time.


4 views0 comments

Comentários


bottom of page