Still no SpeedTree support

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.

1 Like

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.

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

5946692–636809–SpeedTreeURP.rar (2.97 KB)

8 Likes

Hah, 2 lines, cheers for the upload, will try it out when I come back around to SpeedTrees.

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.

1 Like

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).

1 Like

I like how if you look at line 89 here, it says

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

1 Like

Hi @Elvar_Orn

In this thread is the fix to the issue that you mentioned you guys were still working on back in April( IS URP mobile production ready? ).

Will this at least be included in the next URP release so the average user doesn’t need to seek out this thread to have SpeedTree support?

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.

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:

inputData.bakedGI = SAMPLE_GI(NOT_USED, input.interpolated.vertexSH, inputData.normalWS);
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.