How to Export SpeedTree as FBX file and Fix Material in Unity?

Hello everyone,

I’ve encountered a problem when trying to export SpeedTree models in FBX format for use in Unity. I understand that using the .st format directly allows me to take advantage of LOD and wind features in Unity, but due to project-specific requirements, I need to use static FBX files in Unity.

However, when I export the model using the “Generic FBX” option from the Game Export settings and import it into Unity, the materials have significant issues. I’ve tried this with multiple plants, and the problem remains the same. I also attempted to export an FBX file for Maya, where the materials appear fine, but when re-exporting the model from Maya to Unity, the material issues persist.

Is there a way to fix this material problem? And is using the .st format the only reliable method for getting proper materials in Unity?

Any help or suggestions would be greatly appreciated! Thanks!

Hello,

Yes, the ST importer does a lot of the work for you in setting up the materials on the tree. FBX files have a few material slots in them (as you can see, Unity finds the color channel), but not everything that you’d probably want in an optimal fashion.

You’ll probably want to use a Lit material or set up your own material in shader graph. At the very least it needs to be a masked, two-sided material and hook up color, opacity, and normal. Opacity is the biggest thing missing from your screenshot. It should be in the color texture alpha channel.

You can also affect the texture channels coming out of SpeedTree, using texture packing. The Lit material probably needs a slightly different setup from the SpeedTree materials.

I don’t recommend using the Maya preset to get to Unity, as that is a VFX export type. The geometry won’t be batched for real-time use, it won’t make game atlases, and the texture maps will all be separate files rather than packed together.

Hope this helps

Thank you for your reply.

Does this mean that if I import an FBX(“Generic FBX”) file into Unity, I will have to manually set up the Lit material (and may need to adjust texture channels through texture packing) or modify the shader graph to ensure my asset displays the correct materials?

Additionally, after importing the .st file into Unity, is it possible to unpack it in order to separately use the materials and models contained within?

Hello,

Well it has some material on it that the FBX importer added. It might just mean you need to tweak it a bit rather than start from scratch. Going the FBX route means that the tree is coming in like any other static mesh.

after importing the .st file into Unity, is it possible to unpack it

Sure. For materials, click on the prefab and in the inspector go to the materials tab and click “Extract Materials”. This is how you would edit the materials even if you were using the ST file prefab. You can also unpack the prefab and get at the LOD meshes. Instantiate the prefab in the scene, then right click on it in the hierarchy and choose “Prefab / Unpack Completely”.

But just to note: you wouldn’t want to use the materials from the ST file on an FBX file, as they contain a lot of shader code for wind that won’t work on the FBX. Just dragging the various textures into a Lit material and enabling alpha clipping is probably your best bet.