Search Unity

SpeedTree and Unity tree billboard problems

Discussion in '5.3 Beta' started by Todd-Wasson, Oct 10, 2015.

  1. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,063
    There are a couple of obvious problems with Unity trees and SpeedTrees related to billboards. There are two situations here and the problem is opposite for Unity trees versus SpeedTrees:

    1) When the whole tree is a billboard. This is correct on the SpeedTrees but not correct on the Unity trees. On the Unity trees the entire billboard changes direction with the camera. Just do whatever you're doing for the Speedtrees there and the "whole tree billboards" will be perfect.

    2) When you're up close and the leaves/branches are billboards. This is correct on the Unity trees but wrong on the SpeedTrees. On the Speedtrees the billboards change direction with the camera. So here too, just do whatever you're doing for the Unity trees and the "individual leaf group billboards" will be perfect. (EDIT: This only happens on some of the SpeedTrees. I was using broadleaf which does it, but just tried American Elm from the Speedtree Desktop Tree Package and it worked correctly.)

    Performance: Just tested and I'm seeing something like a 70% increase in performance on large scenes composed of nothing but SpeedTree billboards. This is a big improvement, the batching is now comparable to what it is on the Unity trees, but the Unity tree billboards are still something like 10 or 15 times faster. So while I was happy to see an improvement, it's a little disappointing that batching things up differently didn't bring SpeedTree billboards into the same ballpark as Unity trees. Speedtree billboards are still not fast enough for me to use in my project, sadly, even with wind and all the fancy stuff turned off.
     
    Last edited: Oct 10, 2015
  2. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,063
    There's also a very noticeable pop on transitioning from SpeedTree billboards to the next LOD just due to the color change. Not sure, but I think this was mostly present when shadowing was turned on (nice touch, by the way). This used to be really seamless. As long as the transition was at a distance that was reasonably far away, I could barely see the transition.

    Are there more serious performance improvements in the works for SpeedTree billboards? I'm about to give up on the whole tree thing and just go old school for far away trees. My game is a boat game where you never get close enough to most of the trees for them to be anything but billboards. At this point I'm considering writing up a little system to do a couple of billboards per tree at right angles to each other with a few hundred of them in each mesh. I've been playing Flight Simulator X with FlyInside (Oculus Rift, it's really mind blowing even though the frame rates aren't really high enough) and just marvel at the vast forests stretching about as far as you can see in every direction. You could do that with Unity Trees if the darn things wouldn't rotate when you turn your head, but with SpeedTree, even with the improvements in the beta it's just not possible, I think.

    That might be an idea for the whole "top down view" thing too. What they did was throw in a third billboard that was horizontal right in the middle of it all. From even a few hundred feet away the trees look pretty good from all angles just as little three-billboard units. Not good for walking through forests of course, but for games like mine or flight sims it'd be good enough.
     
    Last edited: Oct 10, 2015
  3. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    166
    Hi Todd,

    Thanks a lot for valuable feedbacks.

    Unity tree billboards are always aligned to camera's direction, while SpeedTree billboards can be set aligned to camera's position. It might be possible that you grab the TreeCreator tree shaders into your project (from built-in shader package) and somehow modify it to align to camera position, or if your game has a fixed view then align to some pre-defined plane.

    SpeedTree has facing-leaves which are always a quad on screen. It's recommended to use Leaf instead of Facing-Leaf.

    As for performance, we will be very happy to work on better speedtree billboard performance once we have time. Maybe you will be interested in submitting your scene in FogBugz to help us on that? We can profile your scene and make improvements from it :)

    Cheers,
    Yao
     
  4. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,063
    I appreciate the response, Yao. The test scenes are each just a flat terrain quad with 10,000 trees mass placed and the camera set up far enough away to make everything a billboard.

    Any idea why Unity tree billboards are lined up with the camera direction? I've never heard of a billboarding system working that way. Is that really by design? Ugh...

    As for modifying the shaders to make them work like billboards do in every other system on the planet, I have no idea where to begin. I thought those shaders were not accessible to users. Am I wrong on that?
     
  5. alebasco

    alebasco

    Joined:
    Apr 26, 2014
    Posts:
    5
    Every patch comes with a built-in shader download link. You can then copy and change the speed tree shaders from there, then assign your new shaders to new materials, and apply those to the trees.

    That being said, writing shaders is not an easy process, so good luck!