Modify speedtree material without losing animation, is it possible ?

I’ve been trying to add details to my speedtree models in engine for a few days now without going nowhere.
I can’t use vertex colors because that messes up the wind animation.
I managed to add moss using a [world position node][1].
Are there any way to achieve what I want ? even something like this would be nice:

thanks !

Hello,

You can do anything you want, basically, as long as you leave the SpeedTree node intact in the material.

When you import a SpeedTree, the vertex color is only used for the SpeedTree-baked AO value. It has nothing to do with wind. But if you are exporting a tree to Maya or something, painting a vertex color, and bringing it back into UE4, you’ll lose all the vertex data that does pertain to wind.

To do the blend like your picture shows, you could just use the vert’s Z value in an interpolation between two colors. If you wanted to do something fancier, you can set up detail texture coordinates in the SpeedTree Modeler to put an additional texture on the trunk.

Thanks for the help but why does the tree stop moving if I paint vertex colors in engine ? what I do is:
Import tree
place it
put down wind actor - “tree start moving”
paint the tree using vertex colors - “tree stop moving”

also, could you elaborate or link me to that Z value interpolation please ?

thanks !

I don’t seem to be having that problem. The tree keeps moving, even while I paint it. Could the tree just be settling down, and you need a wind directional source in the scene to keep it moving in the wind?

For the “Z value interpolation” try using the material function “BoundingBoxBased_0-1_UVW”

then mask out the B component. That should be a 0-1 gradient from top to bottom of the whole mesh.

For foliage meshes this won’t work since foliage doesn’t have simple access to things like ObjectPosition or localbounds. To get that will require some additional nodes. Here’s an example:

This method requires you to measure and input the height of your mesh scaled to 1.0. You should be able to use the ruler tool to get that. Then enter that value as the scalar parameter in the image. It then will scale correctly even for foliage meshes.

You have to compute the position transform using CustomUVs since it does not work in the pixel shader. Than the TextureCoordinate node index 1 (CUV1 comment) passes the location to the pixel shader.

The function “FoliageScaleFactor” is new to 4.8 so you won’t have it yet. I made it to help make stuff like this a bit easier but clearly it is still a pain. I will try to make a better function for all this soon. Here is what the FoliageScaleFactor function contains:

Well, before I start painting with vertex colors the tree is swaying in the wind and I have a wind actor in the scene. Weirdly enough I found out that if i do this:
Place tree down - Place wind actor (tree moves in the wind)
Paint vertex colors ( tree doesn’t move in the wind)
Place a new instance of the same model of the tree but without vertex colors edited ( both trees move in the wind !)

additionally if I try and store the vertex colors in the mesh, both trees stop moving.

(thank you for your time by the way :slight_smile:

I don’t know if this will help but here is a gif of the problem:


at first the model performs perfectly but then after I tweak the vertex colors it goes all wonky on me. As you can see the other tree is completely unaffected.
Thank you for your time in advance !

That certainly looks crazy. It looks like whatever it is is just affecting the leaves. What changes did you make in the material?

I think is messing up the lods in general.

I just found out that if I upload the modified vertex colors to the main static mesh everything goes back to normal and I get to keep the vertex colors but i lose the ability to tweak a specific mesh (which to be honest is not that important for my project but still annoying re usability wise)

I’m leaving the speedtree node alone in the material, and then I have added a quick and dirty vertex paint that interpolates the Base color, Normal, AO and Roughness nodes :

another thing I noticed is that my trees move even without a wind actor present in the scene which I’ve been reading should be required.

You can get motion without a wind actor, if your tree is set up to oscillate in no wind or if the wind was set up with gusting.

Did this ever get fixed for you? I am having the same issue. Custom vertex painting stops all the wind from working. Removing the custom vertex painting fixes it.