Search Unity

TurboForest: Unity fast billboard forest rendering

Discussion in 'Assets and Asset Store' started by Alekxss, Jan 23, 2014.

  1. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    You could run some tests to compare, and see how bad the change is.

    Some people are developing for mobile and some for desktop, so maybe two different shader solutions are needed.
     
    twobob likes this.
  2. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Is this product still supported ?
     
  3. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    yes
     
  4. brue

    brue

    Joined:
    Jun 5, 2015
    Posts:
    2
    Hi there.

    Well, i can confirm, as someone already said in comment> tested scene, relief terrain, with over 500.000 trees and it has almost none impact on fps. Very nice job, and well spent money from my side :)


    I have question, but i ll need to describe situation:
    - relief is with hexes grid over it
    - each hex has objects container, so it can influence objects on the relief (turn it off, on, change status etc)

    Is there a way to for example have in one hex (on relief terrain ofc) 10 trees of one set (those default 3 trees for example), and then after some effect happened in the game, make Turbo forest to recast/regenerate in that same hex 10 trees of other set (for example destroyed trees or any other billboard)?
     
    Last edited: Sep 14, 2015
  5. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    After generation TF have simple mesh per chunk\material.
    In TF.cs there have public List<Chunk> chunks = new List<Chunk>();
    Each chunk have mesh property which store it.

    If you have some experience with C# you can generate 10 trees in your Hex, and after generation add some code to save meshes as prefabs.

    Next create manualy empty object, add mesh filter with TF mesh and add mesh rtenderer with one of TF materials.

    But as you guess - many hexes = many draw calls = low FPS.

    Second issue, is generate TF only for selected hex in game, next rebuild all forest.
    It will lag on rebuild, but will render same speed as on simple terrain.

    But it require some C# coding too, TF not supported such stuff.
     
    twobob likes this.
  6. brue

    brue

    Joined:
    Jun 5, 2015
    Posts:
    2
    Thanks.
    And is it possible to just delete some part of pre-generated trees, for example something as "in this spot, in diameter of 10 units, delete all TF billboards"? As your integrated delete option V, just during the game. Its Turn based, so its nice for using that "pause" between turns for some things.
     
  7. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    It must work in game mode too.
    If i was you, i've added hex tile id to TF chunk object and store it on generation step.
    And added litttle methods - delete per hex, generate per hex.
    It must be easy.
     
  8. Image3d

    Image3d

    Joined:
    Jun 20, 2008
    Posts:
    155
    Hi Aily. Glad to hear the product is still supported. I am trying your links, but I get an Error 404: Page not found. Can you fixed it ?

    Also I understand that your system is faster and better then Unity 5 terrain routines. Can you explain why ? Thanks.
     
  9. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Will fix soon
    Technique is billboards packed to big mesh chunks, so with 500 000 trees you spend only 10-20 draw calls and not loose speed on culling many instances (as with dynamic batching).

    I,ve compared TF2 speed with builtin trees and get not big perfrormance difference, but:
    1. TF trees drawing far then 2000 units (builtin terrain limit)
    2. TF billboards casts shadows
    3. If use only TF trees (discard to use mesh trees) for aerial project performance is better.
    4. TF distribute trees above colliders, so you not need to use terrain (if all scene come from MAX for example) and paint forest is only select "forest area" mesh and press generate. "Turbo" here mens not only render speed, but and placing trees in scene.
     
  10. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    apk size look big or it's me
     
  11. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Fixed. Aware, free version is not supported, it contains Unity4x package, which work in Unity5 but with incorrect attenuation. Maybe shadows artefacts, not checked.
    But you still can see main concept and with little experience with Unity scripting - modify it for u5 and your needs.

    If you feel lame :) or want to get stuff faster and easier, you can always buy paid version, wich contains "legacy" pack with free version features but better trees and fixed for u5, and main pack, with editing, different tree modes etc....
     
  12. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Blarg. This tool is amazing. Will be getting my bosses to purchase this pronto! Has the tree generation process been more streamlined or is it still about 15 min to setup a new tree?
     
  13. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    yep, need some time to setup tree, its not easy at first 2-3 trees, but when you be accustomed to, each tree will take ~1 minute to setup.
     
  14. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Great to hear! Also, playing with the free version I noticed that fog doesn't work, has that been fixed in the paid version?
     
  15. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    yes, demos from assetstore have fog, you can try it yourself :)
     
  16. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    I imported the paid version, but all of your .asset files did not import correctly for me. I am using Unity 5.0.0f4
     
  17. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Documentation is quite lacking right now, no idea how to use your tools right now or how to generate a new tree in the editor, it is all rather unintuitive
     
  18. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    You are the first one who had such errors.

    Did you tryed to import to empty project?
    Its not accepteble for you to update Unity?
     
  19. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Just checked it, last TF tools made with 5.0.1, so it cant be roll back :(
    you can use this doc for render your trees
    https://docs.google.com/document/d/1yNn18b0T4Sme940GGXoYTKRrWoXVlbtwUzeo0cL4xrc/edit
    but warning you, on last step you need to press "Render all" button 2 times (fixed it in latest update, coming soon)
     
  20. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Ah, thanks, yea it can be frustrating trying to use a new tool with sparse documentation, especially since this is such a clever tool. Thanks for the help though, really appreciate it
     
  21. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    Also, upgraded Unity and it fixed the .asset files. Sorry if I got a little frustrated
     
  22. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Hey, awesome asset, I was playing around with the free version and I've got a small problem!

    The shader does not seem to work correctly when you roll the camera. Is there a fix for this? If we buy the pro version will we still see this issue?

    See here:

    http://i.imgur.com/wkkYwzc.webm
     
    hopeful likes this.
  23. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Yes, TF now not support camera roll, im working on it but still dont have good results.
     
  24. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Cool - if this issue is solved, this will be an instant by for us :)
     
  25. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    How does this work with Terrain Composer and SpeedTrees?
     
  26. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    I dont worked with Terrain Composer. But if it generate in result builtin Unity terrains with builtin trees system, then you can grab trees positions from it. Its not very handy, but possible:
    1. Render your trees in TF atlases
    2. Assign each TF tree object type with corresponding your tree gameobject (it need to place same TF trees as your trees)
    3. Place TF object, select your "forest" with your trees in it.
    4. Press "Grab from terrains"

    It works with Speed Trees but need some skills from you and understanding.
    Heres the doc how to render any tree (Speed or builtin) in TF atlases, after this done you can use your tree in TF.
    https://docs.google.com/document/d/14fWdIGU1qBcwMvLpQTCfryEI_IYtzvSEclpGCOucdAM/edit

    But as you guess free version cant do it ;)
     
  27. Skolstvo

    Skolstvo

    Joined:
    Dec 21, 2015
    Posts:
    107
    I was hoping to both use Speed Trees and TurboForest. Speed Trees for trees nearby and TurboForest for billboards. Would there be any performance benefit to this?
     
  28. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Not realy. Culling and rendering of mesh trees are most FPS impact.
    So will render same speed:
    Unity terrain + SpeedTrees + builtin trees billboards without shadows up to 2 km view
    and
    Unity terrain + SpeedTrees + TurboForest with shadows up to 4 km view
    But warn you again - TF not easy to ajust with such technique, TF made primary for aerial forest view - for fast place massive forests and render it without FPS impact on PC.
    All another features was added later for user wishes.
     
    Last edited: Feb 2, 2016
  29. vincespeed

    vincespeed

    Joined:
    Mar 8, 2014
    Posts:
    70
    Hey there Aily! I was about to purchase your asset, but before that I must be sure that the plugin fully works across several android devices. I downloaded the free version to have an idea, and it's great, even if I will need the full one for fog compatibility and to have more trees. The problem is that on galaxy s3 and a number of other devices I tested it on, trees behave weirdly. It is like quads are Enormously distorted, or maybe textures goes along the normal instead of going on the triangles. Is there a quick fix for that?
     

    Attached Files:

  30. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Demo APK seems lost from google drive.
    Here is demo from last version, can you check, do you have such bugs in latest version?
    https://drive.google.com/open?id=0B4YY3BeumSecb2Fwb0xKeG5mbWM

    Realy dont remember what ive done to fix such srtifacts :) it was long time ago.
    And now i cant recomend to use TF in mobile projects, better to have own forest system, or model it manualy.
     
  31. vincespeed

    vincespeed

    Joined:
    Mar 8, 2014
    Posts:
    70
    Okay, after cross testing almost every line of the code I found the culprit of the "artifacts". In this part of the code:
    Code (CSharp):
    1.         for(int i=0;i<tfQuad.quads.Count;i++) // fill arrays
    2.         {
    3.          
    4.             tfQuad q=tfQuad.quads[i];
    5.             // AABB calc
    6.             min.x=Mathf.Min(min.x,q.pos.x);
    7.             min.y=Mathf.Min(min.y,q.pos.y);
    8.             min.z=Mathf.Min(min.z,q.pos.z);
    9.          
    10.             max.x=Mathf.Max(max.x,q.pos.x);
    11.             max.y=Mathf.Max(max.y,q.pos.y);
    12.             max.z=Mathf.Max(max.z,q.pos.z);
    13.             int ii=i*4;
    14.             // vertices of tree
    15.             verts[ii]=qv0*q.scale;
    16.             verts[ii+1]=qv1*q.scale;
    17.             verts[ii+2]=qv2*q.scale;
    18.             verts[ii+3]=qv3*q.scale;
    It is like on Android the list is somehow "shifted", and quads are not created between the vertices of each triangle, but between the vertices of a triangle and the following one in the list. Actually, if I change
    Code (CSharp):
    1. //int ii=i*4 to
    2. int ii=i*3
    I can see the artifacts appear on editor, but on Android Device triangles are rendered (instead of quads) without distortion. Do you have an idea about why this happens? I'm just going nut about it...
     
    hopeful likes this.
  32. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
  33. vincespeed

    vincespeed

    Joined:
    Mar 8, 2014
    Posts:
    70
    thank you Aily, I am grateful to you for all of this!
     
  34. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    I have read through all the posts and although I have been here before I just want to ask again, is this still placing the trees by using a separate mesh?

    My issue in my project I include a scenery editor which lets users import a height map, textures and splat/color map for trees and objects using TerrainComposer (as it has runtime features)

    CanI use TF (paid version) this way, so i can generate trees at runtime based on a splatcolor map loaded in?
    Thanks
     
  35. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    TF not support this directly, but both versions works like this:
    1. foreach random point on mesh creating quad and store this quads in lists
    2. collect quads to chunk meshes
    so for splatmap you need to little modify TF, part where it placing quads: foreach random pixel on splatmap if its trees area - place quad.
    second step is same - chunks will be packed as usual.

    one of users of TF paid version asked me how to add trees manualy, and this is method, which place 200000 trees in rectangle with simple random positions, using all another TF features

    Code (CSharp):
    1.  
    2. Open TF.cs, comment main Generate() method and add this:
    3.  
    4.     public void Generate(float density)
    5.     {
    6.         if (HaveErrors())
    7.             return;
    8.  
    9.         Clear();
    10.      
    11.         InitSources();
    12.  
    13.         TFUtils.ShowProgress("Generating", 0);
    14.  
    15.         int count = 200000;
    16.  
    17.         Vector3 pos;
    18.  
    19.         for (int i = 0; i < count; i++)
    20.         {
    21.  
    22.             pos = new Vector3(Random.Range(-1000, 1000), 0, Random.Range(-1000, 1000)); // read your positions here
    23.  
    24.             AddTree(pos);
    25.  
    26.             TFUtils.ShowProgress("Generating", i, count, 1000);
    27.         }
    28.  
    29.         TFUtils.ShowProgress("Building meshes", 0);
    30.  
    31.         BuildMeshes(false);
    32.  
    33.         TFUtils.HideProgress();
    34.     }
    if you look at free version code, its very easy to modify too.
     
    hopeful likes this.
  36. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Awesome asset great work!

    I created a forest but the trees do not stay oriented to the Unity terrain when I fly my player turns/banks above the forest.

    i.e. the trees seem to rotate with the player and lose terrain orientation alignment.

    Any ideas?

    Attached is an image showing the effect. I hope it is clear.
     
    vincespeed likes this.
  37. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Hi, ill check it nearest time.
     
  38. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    I was going to check this asset out but this product is no longer on the asset store. Is that removal permanent?
     
  39. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Yep, TF2 is deprecated now, someday ill make 3 version, but current dont have time to work on it.
     
  40. StevenPicard

    StevenPicard

    Joined:
    Mar 7, 2016
    Posts:
    859
    Okay, thanks for the answer.
     
  41. vincespeed

    vincespeed

    Joined:
    Mar 8, 2014
    Posts:
    70
    Yep! I was trying to solve this problem too. I've looked around if there was some sort of "only-y-axis" billboard shader, in order to adapt math, but all I found is the "camera look at" code, which does not make the trick. Did you find any solution? Also, I guess I'd settle for fixed-on-all-axis orientation but still did not have any luck in coding it...
     
  42. Devpack

    Devpack

    Joined:
    May 23, 2016
    Posts:
    3
    Anywhere I can get the TF2.0? I'd like to try the version which works with SpeedTree but I can't seem to find a link for it and the asset store says the package is removed. I don't mind if it's deprecated and that there's no support.
     
  43. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    New version is coming soon
    Features:
    splatmaps:
    https://i.gyazo.com/2d4607a667bd154938df90ac6f9f6bf2.gif

    "Real" lookat billboards
    https://i.gyazo.com/89498a1191ba754d5d06aed42c84223c.gif
    https://i.gyazo.com/2e28e3fcf3995360d87a81964b28e38c.gif

    multiple lights with shadows
    https://i.gyazo.com/9463811e8837f2cf6d5f5d151b1e014f.gif

    render to atlases will be removed and will not support anymore, TF will contains only own trees and will be target primary for arch-viz and PC, non-billboarding rendering will be removed too.

    sorce will be more simple, and more targeted for exteds by coders
    primary idea - fill and use fores fast as possible will be keeped
     
    elias_t likes this.
  44. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    So ... how does this update compare to the original TurboForest?
     
  45. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    It will be separate version, old version users will have it for free. There is a lot of changes, better performance in all cases, better attenuation, much clear code, less code, less prefabs, etc.
     
    hopeful likes this.
  46. Devpack

    Devpack

    Joined:
    May 23, 2016
    Posts:
    3
    Any way to get notified when the new version is released?
     
  47. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Yes, ill tell it here.
     
    Last edited: May 11, 2017
  48. Tropobor

    Tropobor

    Joined:
    Mar 24, 2014
    Posts:
    73
    I do agree with "Better is enemy of Good"
    (IMHO) Last version wasn't better than the one before, and ... at the same time the first simple version seemed very promising... So... Looking forward for something ... different and simple...(like earlier version)...;)
     
  49. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Attenuation types added, switched simple from materials
    https://gyazo.com/730e68b0eaf3dff1e46c43bd2a5dbf75

    examples:
    1. Same like Unity (like it was in first TF version)
    https://i.gyazo.com/cc289f3ff863a6fc754458d7cfb3dc57.gif
    2. Smooth (like translucency, it was in 2.0 version)
    https://i.gyazo.com/9a96456f63e15912ea7ef492e1090976.gif
    3. Flat (no normalmap lookups used)
    https://i.gyazo.com/7e27517029140edacc25a65db8925043.gif
    4. Upnormal (no any normal calculations used, fastest for mobile)
    https://i.gyazo.com/91c188a7e3fe1f2e77fba2e451d79e93.gif
     
    Tropobor likes this.
  50. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170