Page 1 of 1

SpeedTree template

PostPosted: Wed Jan 16, 2019 2:20 pm
by cAyou
Hi there !
In our project we would like to take the advantage of the speedtree base shader for our foliage bought on the asset store (from the speedtree library) but add more stuff into it.
At first I thought I would simply need to call the same function they call on their base shader (which is SpeedTreeVert) but it looks like it's too custom to use it normally on an ASE base standard.
So I'm trying to create a custom template to use on all various kind of speedtree custom shader we would like to make.

On the template documention, you specify that we have to set the keyword "ase_vdata" on the vertex data struct, but it looks like the one that speedtree uses is inside an include file (SpeedTreeVertex.cginc). How do I do then?

I would appreciate some help here :D
Thanks !

ps: Every cginc and shaders from speedtree can be found on the built-in shader archive for any Unity version.

edit: if it's impossible to achieve this, I would understand, and we will just write a custom shader by hand, as we don't want to add anything too fancy. But it would be cool to have a speedtree template to shader with the community :)

Re: SpeedTree template

PostPosted: Wed Jan 16, 2019 3:45 pm
by Amplify_Borba
Hey there, in order for you to be able to use the template in a correct manner, you'll always have to place the required vertex function(s) within the template.

This is of the utmost importance since many nodes perform calculations in the vertex function for efficiency purposes, and send values to the fragment function through interpolators.

Re: SpeedTree template

PostPosted: Wed Jan 16, 2019 5:54 pm
by cAyou
Hum, because the shader has multiple pass, I would have to add the speedtree vertex struct (and every else I need) for each pass manually (instead of using #include SpeedTreeCommon.cginc). Looks horrible haha :D
I think we will just make our own custom shader by hand, if at some point you want to make a template that will use speedtree, that will be great !

Re: SpeedTree template

PostPosted: Thu Jan 17, 2019 10:04 am
by Amplify_Borba
You are correct, it would take considerable effort to implement.

We do have the request for a Speedtree compatible template registered, hopefully we can tackle it in the near future, thank you for your feedback!