No announcement yet.

Customizing Speedtree Shader

  • Filter
  • Time
  • Show
Clear All
new posts

  • Customizing Speedtree Shader

    I work with a mobile game using Unity.
    I'm testing Speedtree 8 so the default shader is Nature/SpeedTree8.
    I want to replace the built-in fog solution by a custom solution that I use into my other shaders but Nature/SpeedTree8 shader uses surface shader instead of fragment shader so I don't have access to this sort of method.
    Additionally, I don't think that I should use all the textures into all my shader variants, instead, makes much more sense to use shader LODs to use different shader variants depending of the target device. There's any SpeedTree implementation that gives me access to a Fragment shader instead of a Surface?


  • #2

    First, be sure to download the built-in shader archive for the version of Unity you are using from

    Between that and the files you have in the shader includes, you will get the whole picture as far as the SpeedTree shader goes.

    You might be able to do what you wish by editing SpeedTreeSurf() or the lighting functions. But if not, you can specify a fragment shader with #pragma fragment frag

    Once you do this, though, it tosses all the lighting out the window and you'll have to reimplement it

    Hope this helps


    • #3
      Hi Greg! Thanks for the answer. Btw... it's possible to use the speedtree shader into a non-speedtree model? What Enables the Wind?


      • #4
        Wind is accomplished through a combination of data packed into the vertices, and a cpu component that computes the wind effects each frame and maintains the state. So SpeedTree wind will not work on anything else.