Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

SpeedTree PBL Shader

Discussion in 'Works In Progress' started by Reanimate_L, Apr 8, 2015.

  1. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,427
    This is my attempt to converting the built in Speedtree Shader to Built in Standard BRDF shader in Unity.
    Not sure if the result are correct or not, somehow overall i like how the branch look but not the leaves (might gonna do custom brdf for the leaves). But yeah gotta admit, the speedtree shaders somehow bit confusing.
    Anyway i'll just gonna put it here i'll try to update it, and if anyone willing to help feel free to do so :)
    oh and i haven't touch the billboard shader yet by the way

    Note :
    - Bit Darker in my screenshot caused by bad Occlusion map :/
    - Sometimes there's a weird reflection in the leaves, not sure why but the leaves normal are strange, to hide this use a low occlusion setting for the leaves.
    - I haven't find a way how to get the embedded vertex occlusion in the trees, if there's anyone knows about this please let me know. Is there any speedtree tech people in the forum?


    Built in Speedtree Shaders.
    upload_2015-4-8_14-14-50.png
    upload_2015-4-8_15-54-1.png

    Speedtree StandardBRDF Shaders
    upload_2015-4-8_14-15-35.png
    upload_2015-4-8_15-54-37.png
     

    Attached Files:

    Last edited: Apr 9, 2015
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    8,586
    Looks great !! :)
     
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    I have to wonder why speedtree is supplying bog standard shaders. Is it for fill rate issues?
     
  4. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,427
    Yeah performance reason i think, but still at least they should supply with two variant of shaders. high end and lower end at least
     
  5. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    This looks really good based on your screenshots.
    Do i just extract somewhere in the assets folder or do I need to re-assign all the shaders?
     
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,427
    You need to reassign all the shaders at the moment, i'm still not sure if it's a good idea to override the built in speedtree shaders.
     
  7. Dannyoakes

    Dannyoakes

    Joined:
    Feb 10, 2015
    Posts:
    118
    We should see support for PBR in SpeedTree in an upcoming Unity release. Maybe not the next one, but I've been told that it's in the pipeline.
     
    VertexSoup, one_one, Teila and 3 others like this.
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,856
    i guess it is due to the fact that leaves use single sided geometry which does not allow to calculate correct lighting (especially specular reflections). and in case you want to go fully deferred there is just no better way than using single sided geometry as it at least gives you "some kind" or the impression of translucency.
    would be nice if unity would add translucency officially to the g-buffer layout.
    nevertheless: using lambert lighting in deferred does not safe any bandwidth nor does it speed up rendering: unity will perform fully pbs lighting. just smoothness is set to 0...
     
    OfficialHermie likes this.
  9. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Hm yeah. And having translucency in the g-buffer layout is actually really important, especially if we can get a command buffer event for that. It's affecting the performance of a lot of assets I use and even prevents smooth middleware integration at present (I understand truesky might have to make workarounds because of it).

    So +1 for that.
     
  10. Unreal-Vision

    Unreal-Vision

    Joined:
    May 6, 2013
    Posts:
    58
    Hope to see SpeedTree PBR shader asap supported by Unity natively (5.3 maybe?).
    Meanwhile thanks to REA to share the shader and wait for news by Unity team about translucency and g-buffer :)
    Thanks,
     
  11. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,439
    Is there much point in a PBR shader unless speedtree provide suitable textures?
     
    OfficialHermie likes this.
  12. wheels

    wheels

    Joined:
    Jan 20, 2013
    Posts:
    29
    Yes actually, any artist can manufacture textures for a model and apply them in the unity editor. I would love to see more from this shader personally.
     
  13. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,726
    Alloy has a speedtree shader for what it's worth.
     
    n00body and John-G like this.
  14. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,689
    Have you seen it ? What's it like ?
     
  15. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    232
    AdamGoodrich and John-G like this.
  16. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,689
  17. MornFall

    MornFall

    Joined:
    Jan 11, 2013
    Posts:
    159
    Sorry for digging that post, but since it's speedtree shader related... I would like to know if there is an easy trick to not have that :
    Speedtree.jpg
    That specular effect coming from the sunlight on the leaves is just wrong... it also shows on leaves behind the trunk, which is even more wrong, if at all possible...

    I unfortunatly know nothing about shader programming, so i am looking for some help / pointers, how i coul dmodify that shader to not have that effect.
     
  18. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @rea, Unity is giving me this error:
    declaration of "_DitherMaskLOD2D" conflicts with previous declaration at /UnityCG.cginc(877) in file SpeedTreeCommonBRDF.cginc, line 58

    Do you know what the problem could be? thanks


    @Feydwin: A bit of a late reply, but, you can fix this problem if you set the render path Forward mode. Unfortunately, speedtree doesn't seem to have shaders that work with deferred in 5.3
     
  19. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,427
    wow, i'm surprised that people still using this shaders. I've been staying away from speedtree due lot of stuff are broken with speedtree implementation in unity.
    But i'll see what i can do, bit busy with in my own work at the moment.
    @Flurgle just remove the _DitherMaskLOD2D in SpeedtreeCommon at line 58, since now it supplied in unitycg.cginc
     
  20. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @rea, thanks! looking forward to seeing what you can do.

    I tried removing the _DitherMaskLOD2D but it doesn't seem to make a difference visually from the normal shader.
     
  21. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    409
    Damn it, my post got deleted from the rollback! Anyway, reposting:

    Anyway, thanksfor the shader. Also, maybe you should give it a try along with the Critias Tree system. https://forum.unity3d.com/threads/critias-tree-system-asset-store.437520/
     
unityunity