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

Still no SpeedTree support

Discussion in 'Universal Render Pipeline' started by o1o101, May 19, 2020.

  1. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    While there is probably endless amounts of higher priority issues that need fixing, would still like to see this fixed as SpeedTree was heavily promoted for use inside Unity, and my subscription is going to waste.
     
    Last edited: Apr 18, 2022
    camta005 likes this.
  2. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,237
    As far as I could tell SpeedTree is supported in URP, but the shaders for some reason don't sample ambient lighting, resulting in black shadows. There's a code comment that reads "Currently no GI", perhaps it was created very early on when GI wasn't yet implemented.

    I agree that this has been a long standing issue (well over a year), while the fix requires to add 2 lines of code. On the left is the corrected shader, on the right the current URP version.
    upload_2020-6-6_11-7-3.png

    I've attached the fixed shader, since I now very much needed this in a project.
     

    Attached Files:

    cxode, Rallix, Rich_A and 5 others like this.
  3. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hah, 2 lines, cheers for the upload, will try it out when I come back around to SpeedTrees.
     
  4. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    I had a big kick off about this here with lots of testing/examples which were easy to set up. If you can, please vote for it on the issue tracker here

    ** Also how can I nondestructively use this edited shader in a project with URP? I tried overwriting the original with it in Package Cache folder and it gets overwritten by the editor always. If I put it in another folder it just errors out and says that it can't access Speedtree7Passes.hlsl.
     
    Last edited: Jun 30, 2020
    camta005 likes this.
  5. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    Thanks @StaggartCreations for the fix, I can't believe it still hasn't officially been fixed.

    I have no idea how to override the shaders in the URP package. It used to be so simple to override a built-in shader with an edited version.

    Adding the updated shaders to the package cache just get changed back automatically and adding the the updated shaders to the assets folder has an error because it can't find Speedtree7Passes.hlsl. So I copied Speedtree7Passes.hlsl from the package cache and added it to the assets folder and it works (after changing the shader for every material to the fixed version because you don't seem to be able to just override the original shader).
     
    Last edited: Jul 1, 2020
    ROBYER1 likes this.
  6. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    I like how if you look at line 89 here, it says
    Code (CSharp):
    1. inputData.bakedGI = half3(0, 0, 0); // No GI currently.
    Edit: Someone has already made a wonderful pull request for this as I was figuring out how to do one myself, please go and give this some love:
    https://github.com/Unity-Technologies/Graphics/pull/720
     
    Last edited: Jul 1, 2020
    camta005 likes this.
  7. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Last edited: Apr 18, 2022
  8. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    900
    I have the same problem today with SpeedTree8 shaders in Unity 2021.3.0f1 and URP 12.1.6. Which two lines did you change in that SpeedTree7 shader? I've tried comparing yours with the SpeedTree7 shader but it has already changed a lot since you made that change, so the comparison is just noise.
     
  9. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,237
    That's possibly a different issue. The shader code in SpeedTree8Passes.hlsl differs slightly from LitForwardPass.hlsl, in the sense that they've unrolled some functions in order to do some specifics like hue variation.

    There's some hints in the shader code that suggests not every GI feature is supported:
    Code (CSharp):
    1. inputData.bakedGI = SAMPLE_GI(NOT_USED, input.interpolated.vertexSH, inputData.normalWS);
    2. inputData.shadowMask = half4(1, 1, 1, 1); // No GI currently.
    When I bake realtime GI, shadows on SpeedTree8 materials simply turn black. So it's best to file a bug report for that. Otherwise using the SpeedTree8_PBRLit shader works as expected.