Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Terrain trees problem - have I resolved this correctly?

Discussion in 'Editor & General Support' started by Eudaimonium, May 28, 2016.

  1. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    Hello,

    I am working on a game which aims at very low hardware requirements, therefore I am using forward rendering limited to only 1 pixel light at any given time. All other scene illumination is strictly baked in.

    I have recently started building the decoration of a small town we will be having, and I have noticed that the trees I am placing with a terrain paint tool end up being either totally black, or so dark that they as may well be black.

    Unity trees dark.jpg
    You can see the problem here. Funny thing is that the distant sprite representations are either pitch-black or insanely bright. I am yet to determine which causes this.

    I am using a few trees from the "Terrain Assets" bundle, namely scone pines and such. Unlike other people who I googled out to have similar problems to mine, even when I manually drag the tree prefab into the scene it still remains completely dark. Using a new point light does illuminate the tree but to a far lesser degree than it does other scene objects.

    I have found the problem to be the Soft Ambient Occlusion bark/leaves shaders. I have switched the shaders to SpeedTree variant (which are beautifully implemented, by the way, tons of options), however I constantly get warnings in my console that the trees should use Soft Occlusion shaders. Can this warning be suppressed?

    So I finally got me thinking, how much of an advantage really is painting the trees using a terrain tool, versus simply manually placing the trees in the scene? I am aware it would take slightly more time, but given that each tree would be it's own mesh with Lightmap UVs generated, with a baked-in lightmaps it could look fairly beautiful - given that they do not more and are not animated, which in my case they are not.

    Furthermore, I have found that terrain-painted trees do not cast lightmapped shadows in any way, even if their direct prefab equivalent does.

    Unity trees.jpg
    You can clearly see the difference here.

    In any event, using the light probe options at the prefab and terrain settings does not appear to cause any difference in any scenario.

    Am I approaching this right? How can I have optimized and batched trees that cast lightmapped shadows and accept 1 pixel light? This is currently a decoration around a town but later I plan to build several forest setting levels and trees painting tool could really help.

    Thank you in advance for your help!
     
  2. Deleted User

    Deleted User

    Guest

  3. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    Not sure how I missed this, thanks, but the original testing was from 2013, not sure if this applies anymore since latest Unity version?

    In any event, considering how terrain tree shaders appear to be slow (and I'm targeting very low hardware requirements), and how I really like lightmapped shadows, I believe my path can only go one way: Writing a custom editor tool for "painting" prefabs, similar to how terrain tree/foliage painter works, except for general purpose prefab placement.

    And then putting it up on the Asset store for free because for some reason there is no free version for something that is as rudimentary as it is simple.
     
    ROBYER1 likes this.
  4. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Still running into this problem now in 2019.1!
     
  5. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    Hi, yeah I've completely skipped unity's terrain trees feature. The bark and canopy shaders are too tricky to use/modify, they're too slow to render anyway, and overall the workflow is a mess.

    I've since simply used LOD grouped prefabs for all my trees, along with some free online tool for gameobject painting, and it's just so much easier.

    upload_2019-7-26_13-14-32.png

    Both the trees and the bushes/shrubbery are just LOD grouped crossfaded prefabs with easy-to-write shaders. Their shadows and color AO gets baked into lightmaps and probes.

    Seriously just skip terrain trees, and SpeedTree as well (they are impossibly slow to render for some reason)
     
  6. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Ah I see, may have to do that, our scenes are small so manually placing the trees as prefabs is not an issue.

    What solution are you using to create your trees though? Speedtree is preferable so we can build the tress quickly and easily.

    Also what's the tool you are using for gameobject placing?
     
  7. Eudaimonium

    Eudaimonium

    Joined:
    Dec 22, 2013
    Posts:
    131
    Never used speedtree (waaaay to expensive to just F*** around in a personal project), but I did use Unity tree creator. It's HORRIBLE. Inspector is mega-slow, shaders it uses are a total mess, and rendering performance was abysmal.

    I found this a while back:
    http://www.evolved-software.com/treeit/treeit
    It's no longer maintained, it has issues with some specific PNG formats, but for the price of free it's freaking incredible. It spits out simple .obj/.fbx as end result. People are comparing it to speedtree, except it spits out meshes instead of some proprietary formats. It's easy to do LODs in it as well, without ruining the sillhuette.

    There's even a large library made by somebody, here:
    https://forums.unrealengine.com/com...-tools-and-tutorials/82804-free-trees-library

    For placing objects:
    https://assetstore.unity.com/packages/tools/utilities/gameobject-brush-118135

    I use that for mass placement, and then manually tweak individual trees/bushes where necessary.

    EDIT - HOLD UP, TreeIt was updated last month?! 'Aleluyah. I thought it was abandoned (and even then it was working great). So yeah definitely go with TreeIt.
     
    ROBYER1 likes this.
  8. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Found the fix, Speedtree shadows can be baked to the terrain using the Progressive CPU Lightmapper in Unity 2019.1.11f1 but have submitted a bug report for the GPU Lightmapper as the GPU Lightmapper does not like Speedtree trees
     
  9. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    In terms of TreeIt, the author will not be returning to work on it for a while they said here https://www.evolved-software.com/board/viewtopic.php?f=24&t=112