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,685
    The TF Legacy scene isn't working for me (shows no trees), and I'm not sure what the 5 TF terrain trees scene is supposed to be showing, but the trees have "a few" white pixels on the leaves. ;)

    Happy to see the update, though. :)

    (White pixelated trees only on deferred.)
     
    Last edited: May 5, 2015
  2. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Occasional error
    upload_2015-5-4_22-26-4.png
    Error when trying to use a gameobject as a target
    upload_2015-5-4_22-48-15.png
    .
    What does that mean?

    hmm
    Code (csharp):
    1.  
    2. if (forest.raycastLayers.value == 0)
    3. {
    4. TFUtils.Notify("Raycast layers in Turbo Forest component not set.");
    5. return true;
    6. }
    7.  
    Did I miss a readme?

    EDIT:

    Found it

    upload_2015-5-4_23-10-21.png

    with a bit more love...

    upload_2015-5-4_23-23-42.png

    Time to do some performance testing.
    Enjoying the new placement thingy. Not the fastest but certainly easy once you find the sub-setting in the forest types

    Cheers
     
    Last edited: May 4, 2015
  3. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Cylindrical trees.

    1113 trees covering a 1km2 area. Very easy test.

    upload_2015-5-4_23-28-50.png

    upload_2015-5-4_23-29-20.png


    With everything

    upload_2015-5-4_23-30-46.png

    same shot gutted of most things

    upload_2015-5-4_23-32-43.png

    of which about 20 draw calls comprise the shadows and and transparent rendering of the trees
    (Which would remain /almost/ the same for even huge numbers, pretty much, given the batching)

    upload_2015-5-4_23-36-15.png

    Very happy with that.

    Nice one.

    I can't see me using much more than 1000 trees per km2 to be honest. It's a little dense at that.

    Someone else can do some big numbers tests on cylindrical if they want. I am happy with a few thousand

    Total additional compressed cost of 3 tree types to web build 880kb ;)
     
    Last edited: May 5, 2015
  4. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    hmm..

    some odd reflection issues.

    upload_2015-5-4_23-48-49.png

    attractive, but sadly incorrect.

    Looking a bit to the right fixes it

    upload_2015-5-4_23-51-1.png

    Looking further left still has the issue

    upload_2015-5-4_23-51-41.png

    it appears to be "angle" related



    any clues? Standard Water4 used for test. Forward rendering (sadly I have to use that)

    thanks
    EDIT:

    Okay so it doesn't respect the angle of a spotlight cast upon it.
    In the waters reflection. noted. not sure if this is a Water issue or not. Anyways I will avoid it.

    upload_2015-5-5_0-1-17.png

    I'll figure something else out.

    EDIT: Works okay with a "tamed" spotlight value and range EDIT EDIT: Hmm no it doesn't - not really, it's still totally noticeable when it "kicks in"

    upload_2015-5-5_0-19-32.png


    alternately you can dial down the light response in the tree shader
    (I went with 0.00002)

    Cheers
     
    Last edited: May 5, 2015
  5. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Okay, I see some of my difficulty. 3 shaders don't compile when in DX9 mode, but will compile just fine in DX11.

    TurboForest, tfAtlasDistanceCull, tfCylindricalDistanceCull
     
  6. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    ouch. didn't notice that. Good catch.

    To add a bit of slope limiting I went with
    Code (csharp):
    1.  
    2. if (Physics.Linecast(castFrom, castTo, out info, forest.raycastLayers) && info.normal.y > 0.9f )
    3. pos.y = info.point.y;
    4.  
    as a hard coded sloppy hack in TF.cs

    upload_2015-5-5_1-42-28.png

    might be nice to do some slope limiting, maybe I missed it, perhaps it is already there...
     
    hopeful likes this.
  7. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Finally went with 4000 mesh trees, with colliders, which perform very nicely.

    upload_2015-5-5_3-13-38.png

    They look decent in game

    upload_2015-5-5_3-14-12.png

    upload_2015-5-5_3-15-17.png

    It would be nice to get the lighting fixed so that I don't have to set it to near zero for the reflections to work.

    That way the trees would blend in better with other styles for more detailed areas, as you can see here the trees are actually very dark since I had to kill the lighting ;)

    upload_2015-5-5_3-22-6.png

    Enjoying the system though. Really like the new interface, good work Aily.
     
  8. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Ok guys, help for 2.0 is not finished yet, but i'm working on it :)
    TF have legacy TurboForest script with old shader and textures, you can use it as old version (just shadows and trees distribution bugs fixed) but it's not primary now as you guess.
     
    hopeful likes this.
  9. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    TF shaders use ambient color only, not cubemap ambient (maybe later i'll add full new lighting system suport). So open Window->Lighting, switch ambient source to Color, adjust it, switch back.
     
  10. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    I'll check this, thanks ;)
     
  11. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Not has time to check it on deferred. Will see.
     
  12. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Can you show your project settings for graphics?
     
  13. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    And sad news... New TF package no longer supported Unity 4x. If someone will realy need to use it with 4.x, ill see what can do.
     
    twobob likes this.
  14. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    This was because of dx9 not compiling.

    Hi. as you can see here:



    adding any light in that lighthouse (point, spot...) makes the reflections of the trees go REALLY bright. Even one with a TINY range and tiny brightness.

    this only happens from one half of the angles. Looking to the right here would have made it work perfectly.

    To fix this I have to set Lighting to 0 on the individual tree prefabs

    That is the problem.

    (and my ambient source is already a single grey color)

    upload_2015-5-5_4-18-4.png

    I use linear lighting.
     
    hopeful likes this.
  15. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Ok, will check why this happening. If you don't mind - can you share your reflection source (water) with materials and shaders, to check this out?
     
  16. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    its Water4. Daylight water. On Medium Settings. Totally standard. nothing adjusted.

    Happy to share anything you want.
    We don't make "Copyrighted to make fortunes" games here.

    upload_2015-5-5_5-30-47.png

    In the distance it just blends into a flat color. It really is the cheapest I could manage with Water4
     
    Last edited: May 5, 2015
  17. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    I don't have such package :( Default water package is somwhere disapeared from Unity5 at my side (maybe it's excluded now from u5, don't know).
    Or it's separete package from independed developer?
     
  18. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Just to be clear, the legacy TF scene wasn't running on DX9 because the shader wasn't compiling. But I found out later that it did run if I switched to DX11, because then the shader (TurboForest) would compile.
     
  19. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    It's strange, this shaders works same on Andriod with OpenGL2.0 (similar or lower than DX9) and must compile.
     
  20. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Ok, ill try with different shader models.
     
  21. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    If for some reason you don't see this on your end, here's the error descriptions I get:

    Shader error in 'TF/Legacy/TurboForest': variable 'o' used without having been completely initialized at line 155 (on d3d9)

    Shader error in 'TF/CylindricalDistanceCull': invalid ps_2_0 input semantic 'POSITION' at Assets/TurboForest/Shaders/tf.cginc(28) (on d3d9)

    Shader error in 'TF/AtlasDistanceCull': invalid ps_2_0 input semantic 'POSITION' at Assets/TurboForest/Shaders/tf.cginc(28) (on d3d9)
     
  22. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Thanks, it's enough for me.
     
  23. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    @hopeful
    Line 137: UNITY_INITIALIZE_OUTPUT(v2f,o);

    then?

    That certainly gets the shader going at least

    upload_2015-5-5_14-40-25.png
     
    Last edited: May 5, 2015
    hopeful likes this.
  24. CodeMonke234

    CodeMonke234

    Joined:
    Oct 13, 2010
    Posts:
    181
    Aily - Just downloaded 2.0 - Awesome work!

    New placement painting system is great... I am still learning/working with everything - will post more once I make progress.

    So far really really great job :)
     
    hopeful, twobob and Alekxss like this.
  25. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Alekxss likes this.
  26. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    When trying to GENERATE on

    upload_2015-5-7_1-55-30.png

    It's really slow. because:

    Code (csharp):
    1. public void SetMeshFrom(GameObject gameObject, MeshFilter mf, bool clear = false)
    2. {
    3. ...
    4. inds.Add(mesh.triangles[i] + maxIndex);  // Gives us >95k results for a 32258 mesh. Super slow
    5.  
    6. ...}
    which is called later on like

    Vector3 pos = rpm.Get();


    Please can we have a less granular selection of TFRandomPointOnMesh's

    Just "Close enough" would be preferable to taking one hour to put together a list of tri/verts for 10 - not very large - meshes., "Generate" should not take an hour to do anything. Ever.

    I would be happy with ray-casting rather than that.... Heck anything to make it go faster.

    Most terrains are top-down flatish, your current system accommodates any geometry of mesh with trees, which is great, but it's way too slow.

    A "Just use Rays" option would be great for larger meshes



    Finally, I see no logic to prevent that mesh being given an invalidly large list.
    And when you are waiting quarter of a hour to see what the generate button does... Silently crashing half way through is heart-breaking.


    Thanks :)
     
    Last edited: May 7, 2015
  27. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    TF i've maked for myself, as i thought it handy for me :)
    So for me handy - to draw forest area in 3ds max by spline, make it extrude (leave only it cap) just flat forest area.
    Set it as distributor but without colliders.
    Set colliders to terrain under it.
    So each point obtained randomly from this lowpoly mesh, then raycast terrain under it, then put tree.
    And it's very fast, seconds for any terrain :)

    But i guess you not 3d modeller app user. Will think how to remake this technique.
     
  28. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    You just can place builtin plane above your terrain with same size, set as distribution, turn off it colliders, add colliders to your terrain, and TF will fill all in seconds ;)
     
  29. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    The height difference between my lo-poly terrain mesh and the original terrain is very obvious.
    I take very low-triangle slices of terrains, trying to put trees on them via the Terrain positions would be okay if it was a perfect match.

    Your advice to use the built-in plane will probably be best. But those are just the values I would get from Mesh.bounds anyway, and I wouldn't have to resize it myself.

    I did not understand why you simply did not go for "Mesh.Bounds" and then spray some tree onto it. Now I do.

    Setting up 96'000 possible locations via that excruciating long winded mesh building process would /maybe/ make sense if you stored those locations for the next time through. But they are dumped, only to be recalculated again. It makes perfect sense for your low-poly mesh placements idea. Total sense. Just have a "USE BOUNDS NOT MESH LOCATIONS" toggle as an extra

    It's not like this is my first time spraying trees onto meshes. Your current way will not scale well at all with bigger meshes is all I was trying to say.

    Not trying to be hyper-critcial, just to make your tool work faster for the most people.

    I'll see if I can make a non-super-slow tree sprayer myself then.

    Basically, there are no 3d modelling tools inside Unity, no point making a tool that expects an extra bit of software.

    I will work on it
     
    Last edited: May 7, 2015
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hmm I tried the plane thing.

    upload_2015-5-7_15-23-1.png

    But this resulted in no trees being put on the 2nd mesh.
    Whatever Layer settings I tried in the forest and on the objects... I will go review the way you do it in the demo. (I also checked that I was casting from -inf to inf, or whatever)



    However: something like (this is pseudo, unfinished, untested code)

    Code (csharp):
    1. static void createTree(Vector3 place){
    2.    newTree = Instantiate(tree, place, Quaternion.Euler(0,Random.Range(0,359),0)) as Transform ;
    3. }
    4.  
    5. public static void AlignTrees (Transform chosenparent, MeshFilter victimMesh) {
    6.  
    7. Vector3 place = GenerateRandomTreeInArea (chosenparent, victimMesh);
    8. createTree (place);
    9.  
    10.  
    11. // Are these always the same size?   is it helpful to figure out the offsets to put them in the floor properly?
    12. foreach (Transform myTransform in newTree) {
    13.    myTransform.localScale = myTransform.localScale * (Random.Range(55,155)/100f);
    14.    myTransform.parent.SetParent(chosenparent);
    15.  
    16.    RaycastHit hit;
    17.    if (Physics.Raycast (myTransform.position, -Vector3.up, out hit)) {
    18.      Vector3 targetPosition = hit.point;
    19.  
    20.      if (myTransform.gameObject.GetComponent<MeshFilter>() != null) {
    21.        Bounds bounds = myTransform.gameObject.GetComponent<MeshFilter>().sharedMesh.bounds;
    22.        targetPosition.y += bounds.extents.y;
    23.      }
    24.  
    25.      myTransform.position = targetPosition;
    26.      Vector3 targetRotation = new Vector3 (hit.normal.x, myTransform.eulerAngles.y, hit.normal.z);
    27.      myTransform.eulerAngles = targetRotation;// -new Vector3(90, 0, 0);  if we need to hack rotation of rubbish models
    28.      }
    29.    }
    30. }
    31.  
    32. private static Vector3 GenerateRandomTreeInArea(Transform chosenparent, MeshFilter victimMesh){
    33.  
    34. return new Vector3 (Random.Range (10, victimMesh.Bounds.Extents.x) + chosenparent.position.x, 36f, Random.Range (10, victimMesh.Bounds.Extents.z)+ chosenparent.position.z);
    35. }
    Might be helpful.
    I will look at testing an /actual/ version of that code, but that is more or less what I was saying.
     
  31. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    You doing something wrong.
    Let's try from scratch:
    1. create new scene.
    2. add there your terrain and be sure that terrain have collider and it layer=layer setup in forest
    4. set terrain position to zero (to be surely)
    3. Create plane as on your picture, disable it collider.
    4. Press in scene Create->3D object->TurboForest
    5. Add plane to distributors
    6. press generate

    btw for regular terrains to fill all terrain not used all triangles of terrain.
    TF.cs 74 line

    Code (CSharp):
    1.         foreach (var terrain in terrains)
    2.         {
    3.             var td = terrain.terrainData;
    4.  
    5.             var s = td.size;
    6.  
    7.             var a = new Vector3(0, 0, 0);
    8.             var b = new Vector3(s.x, 0, 0);
    9.             var c = new Vector3(s.x, 0, s.z);
    10.             var d = new Vector3(0, 0, s.z);
    11.  
    12.             a += terrain.transform.position;
    13.             b += terrain.transform.position;
    14.             c += terrain.transform.position;
    15.             d += terrain.transform.position;
    16.  
    17.             rpm.AddTriangle(a, b, c);
    18.             rpm.AddTriangle(c, d, a);
    19.         }
    just building 2 big triangles of terrain size, and then distribute in them.

    Realy :) something wrong with your scene, course i can ask you to send me model to check, but again will be talks about licensed property.
     
  32. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hi mate.

    I will make a completely new project.

    Again.

    However...

    Here is another issue:

    upload_2015-5-7_19-28-2.png

    it looks like the gizmo is centered around the wrong place.
    That is WORLD 0,0 not the pivoted offset of my mesh. Which is like 4000 away from there...
    (and it wasn't me that baked a 4000 offset, it is the -very popular- Horizon[ON] tool does this.

    Will think if I can see a way around that.

    EDIT: The quickest way is just to do a plane overlay and limit the results via Normal Y Angle magnitude and of course Y to -Y, it does still make using the tools tricky.

    I may hack in a gizmo offset, may be easier than calculating the pivot offset. Not sure.
     
    Last edited: May 7, 2015
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058

    Okay - I will try again.

    I have read your code from beginning to end now. just so you know.

    EDIT:


    Okay I found the issue.
    The MeshMaterializer was failing to assign the MeshCollider - thus no hits were occurring.

    DOOOOHHH!!!!!!

    (The pivot issue is still outstanding)

    The overlying plane works perfectly now.

    upload_2015-5-7_21-24-34.png

    With slope limiting at 0.9f

    upload_2015-5-7_21-29-47.png

    and then shove the horizon[on] shader on everything

    upload_2015-5-7_21-55-5.png

    Or some water

    upload_2015-5-7_21-24-19.png

    Net result: Very cheap, very large, very cool, very arboreal, neatly tileable mesh square.

    upload_2015-5-7_22-1-26.png

    Awesome

    Many thanks
     
    Last edited: May 7, 2015
    hopeful likes this.
  34. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I do note one other issue.

    I have "Shadows" turned off in the forest settings

    upload_2015-5-8_3-27-11.png

    but it looks like I am still getting shadow planes created?
    you can see the dark areas behind the trees

    upload_2015-5-8_3-24-50.png

    upload_2015-5-8_3-26-33.png

    Any idea why that might be?

    I thought that it just meant.

    if (forest.castShadows)
    mr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
    else
    mr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;

    since

    Find all "forest.castShadows", Find Results 1, Entire Solution, ""
    D:\PROJECTS\test\Assets\TurboForest\Scripts\TF.cs(599): if (forest.castShadows)
    Matching lines: 1 Matching files: 1 Total files searched: 1201

    thanks

    I'll keep digging but something is up

    EDIT:

    Okay. weirdness:.

    upload_2015-5-8_3-38-13.png

    That is the tree with a regular "Cutout" shader on.

    What?

    Will try another model....

    upload_2015-5-8_3-42-32.png
    No weird edging there with the same shader...


    hmm.... could there be actual "dark" values in the trees transparency sheets?
    *headscratch*
     
    Last edited: May 8, 2015
  35. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    upload_2015-5-8_3-46-23.png

    Hmm... there is no /actual/ deviation in the alpha channel...
    Sigh.

    upload_2015-5-8_3-52-16.png
    Another mystery


    Hmmm.. Cylindrical is okay...
    upload_2015-5-8_4-5-48.png
     
    Last edited: May 8, 2015
  36. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    I hope after set "cast shadows" flag you regenerated forest....
    Which shader do you use for postfilter (horizon?)? Where i can read about it? :)
    When cast shadows disabled on light source this black halo disapears?
    This halo apears on both sides of trees? (turn around one tree and look)

    Tip: you can pull down your distribute plane under your terrain - will be works same, raycasting y anyway getting from forest setup raycast from\to.

    i'm not worked on gizmo, sorry, not have time for this. Gizmo is still world-space, as chunk generating too.
     
  37. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Halo on both sides
    regenerated many times.

    When cast shadows disabled on light source this black halo disapears?
    No. it stays.
    They actually cast proper shadows and have that weird halo.

    Which shader do you use for post-filter:
    http://forum.unity3d.com/threads/horizon-on-make-your-horizons-look-real.259733/ No... Not post-filter. It just colors the floor. totally unrelated.​


    I started a new project, works perfectly.
    Eh? What? Why??? weird.

    Ah well. I am pretty certain the only difference was that I had SHADOWS on when I very first made the, very first, mesh forest. Then I turned them off. Could this possibly be a result of the "projections" accidentally applying shadow at some earlier stage? I have no idea.

    Anyway, I think I know how to reproduce it, which would be:
    Use mesh forest and turn on shadows the very first time you use the system.
    However simply never using the shadows radio toggle there and applying the shadow mode myself works fine. (This is what I always did before and did in my new project)

    I will see if I can break it in this way again at some point but I am a bit behind now as I have spent most of the week testing new versions of things... Time for me to actually /do/ something with them ;)

    I will hack the gizmos. it's relatively trivial.

    Much obliged


    Thanks for letting me know the Planes Ray cast is absolute Y, that is helpful.
     
    Last edited: May 8, 2015
    hopeful likes this.
  38. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Hi Aily. I'm using MegaScatter in my current project to scatter SpeedTrees across my terrain. Reading through this thread it seems that Turbo Forest supports SpeedTrees to some extent. I would like to confirm if it would work with my current workflow? Would I still be able to use MegaScatter to distribute my SpeedTree/TurboForest Billboards ?

    Also it would be great if you could put a video up on YouTube demonstrating the process to use SpeedTrees with Turbo Forest! Cheers
     
  39. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Well.. assuming "Grab from Terrain" works for your trees... That would be one way to get the info in.
    I am merely speculating. you would have to check.
     
  40. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    Why not use a single triangle instead of a quad? This way you can push twice as many trees in the same mesh. You just need to stretch the uv a bit, clamp the texture, and make sure the edges are 100% transparent.

    Edit:
    Actually, not twice as many as a quad uses 4 vertices and a triangle 3. But you can still squeeze a bit more out though.
     
    Last edited: May 9, 2015
    twobob likes this.
  41. Sir-Spunky

    Sir-Spunky

    Joined:
    Apr 7, 2013
    Posts:
    132
    @Aily
    Thanks so much for posting this. This is amazing!
     
  42. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Grabbing from terrains works (just checked)

    upload_2015-5-10_3-11-30.png

    Notably you must manually list the terrains

    upload_2015-5-10_3-12-40.png

    Adding the parent object dropped an error about No Terrains found in Distribute Objects, (which leaves the dialog open sloppily) - this can be fixed by cycling Window Layout presets (so always have one ready for this job)

    Hope that helps
     
  43. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    just try v2 now will see perf on mobile
    it's possible to calculate lightmap on it ?
     
  44. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Lightmaps not supported in current version, but i'm working on it and in near update will be.
     
    IsDon and twobob like this.
  45. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Aily, any chance of you doing a step by step - with screenshots - of making new trees please?
     
  46. Mesher

    Mesher

    Joined:
    May 2, 2013
    Posts:
    19
    Will you be adding Unity 5's new spherical ambient lighting to the turboforest shader? I purchased turbo forest but can't make use of it as they trees don't match my lighting which is based on a time of day system. Even switching to color/gradient mode leaves the turboforest trees too dark for my scene. I can't really use it until it supports the new lighting model :(
     
  47. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    will add it near week
     
    twobob and hopeful like this.
  48. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Ok, we have 2 ways to fix your issue:

    1. I will add support of new lighting system to all shaders, wich makes TurboForest not "Turbo", because this light calculation much complex that current exist.

    2. You can control RenderSettings.ambientLight and ambient intensity from script when changing daytime to control forest brightness. (TF affects by ambient light color).

    Realy don't see any complexity with TF attenuation, all current working well, changing only sun color and ambient intensity at night time:

    day.jpg night.jpg

    please put here (or PM me) screenshots with your scene in different time of day.
     
  49. Alekxss

    Alekxss

    Joined:
    Mar 25, 2013
    Posts:
    170
    Realy, it's not big problem to add full lighting support, but i'm afraid to use this code:
    Code (CSharp):
    1.   // Setup lighting environment
    2.   UnityGI gi;
    3.   UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
    4.   gi.indirect.diffuse = 0;
    5.   gi.indirect.specular = 0;
    6.   #if !defined(LIGHTMAP_ON)
    7.       gi.light.color = _LightColor0.rgb;
    8.       gi.light.dir = lightDir;
    9.       gi.light.ndotl = LambertTerm (o.Normal, gi.light.dir);
    10.   #endif
    11.   // Call GI (lightmaps/SH/reflections) lighting function
    12.   UnityGIInput giInput;
    13.   UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
    14.   giInput.light = gi.light;
    15.   giInput.worldPos = worldPos;
    16.   giInput.worldViewDir = worldViewDir;
    17.   giInput.atten = atten;
    18.   #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
    19.     giInput.lightmapUV = IN.lmap;
    20.   #else
    21.     giInput.lightmapUV = 0.0;
    22.   #endif
    23.   #if UNITY_SHOULD_SAMPLE_SH
    24.     giInput.ambient = IN.sh;
    25.   #else
    26.     giInput.ambient.rgb = 0.0;
    27.   #endif
    28.   giInput.probeHDR[0] = unity_SpecCube0_HDR;
    29.   giInput.probeHDR[1] = unity_SpecCube1_HDR;
    30.   #if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION
    31.     giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
    32.   #endif
    33.   #if UNITY_SPECCUBE_BOX_PROJECTION
    34.     giInput.boxMax[0] = unity_SpecCube0_BoxMax;
    35.     giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
    36.     giInput.boxMax[1] = unity_SpecCube1_BoxMax;
    37.     giInput.boxMin[1] = unity_SpecCube1_BoxMin;
    38.     giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
    39.   #endif
    40.   LightingStandard_GI(o, giInput, gi);
    41.  
    42.   // realtime lighting: call lighting function
    43.   c += LightingStandard (o, worldViewDir, gi);
    44.  
    (builtin surface shaders)

    for each forest pixel :) hope you got it.
     
  50. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Dang. That looks pretty "Weighty".

    Maybe a simple HOW TO "Link The Brightness to an external Variable" GUIDE would be cheaper?

    ;)