Home Technical Talk

UE4/Blender How to correctly vertex paint tree meshes for even wind??

cooljay156
polycounter lvl 3
Offline / Send Message
Pinned
cooljay156 polycounter lvl 3
Hey guys i have had this issue for a long time now and i see games where the 2d plane branches will all sway all together on an
absolute world position and the tree base its self also sways with the 2d plane branches with none of them disconnecting from the tree base.

I can find absolutely 0 tutorials on how to do this, what is it that keeps all the branches from disconnecting and swaying in their own pattern
i have setup currently the 2d plane branches to be gray from the bottom to white at the top and the bases where those 2d branches sit on the tree base itself to be gray and the bottom of the tree base to be black.

With that all setup i thought that the weights setup evenly would of stopped branches swaying inside each other and all move globally together
but it doesn't.

Is the way other people doing this script related or material related??

If someone knows please help thankyou.

Replies

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    You don't necessarily need vertex colors for this. You could just take the bounds, offset it by -0.5 on the x and y, take the absolute value of it, and measure the distance of it compared to 0,0. Then apply some contrast to better control the falloff, and use that instead of the vertex colors. This would give you a 2d gradient that is bleck in the center of the object, and goes towards white as it gets further from the center. So the trunk and the beginning of the branches wouldnt move at all and the tip of the branches would move more and more depending on their length/distance from the center.

    Like this:


    You could also have a uv channel, just for this. And all the branches would be laid out in a way that they go from left to right or right to left, and their start is on the edge of uv 0-1 area so if you would simply apply the x channel of those uvs as a gradient, it would do the same thing.

    If you really want it with vertex colors, you could also have a gradient texture that is mapped on the mesh based on like a third uv channel. And then, I guess you could bake that into the vertex colors in Blender. This way it would have a linear gradient without a need to painfully paint it with a vertex painting tool.


    If you would want the trunk too to move, you could just build up an another chain and mask for the movement of that, and add it to the branch movement. That way, the branches would be affected by the trunk movement and mask as well.
  • cooljay156
    Options
    Offline / Send Message
    cooljay156 polycounter lvl 3
    Obscura said:
    You don't necessarily need vertex colors for this. You could just take the bounds, offset it by -0.5 on the x and y, take the absolute value of it, and measure the distance of it compared to 0,0. Then apply some contrast to better control the falloff, and use that instead of the vertex colors. This would give you a 2d gradient that is bleck in the center of the object, and goes towards white as it gets further from the center. So the trunk and the beginning of the branches wouldnt move at all and the tip of the branches would move more and more depending on their length/distance from the center.

    Like this:


    You could also have a uv channel, just for this. And all the branches would be laid out in a way that they go from left to right or right to left, and their start is on the edge of uv 0-1 area so if you would simply apply the x channel of those uvs as a gradient, it would do the same thing.

    If you really want it with vertex colors, you could also have a gradient texture that is mapped on the mesh based on like a third uv channel. And then, I guess you could bake that into the vertex colors in Blender. This way it would have a linear gradient without a need to painfully paint it with a vertex painting tool.


    If you would want the trunk too to move, you could just build up an another chain and mask for the movement of that, and add it to the branch movement. That way, the branches would be affected by the trunk movement and mask as well.
    thankyou for the that explanation and example :) i have already fully vertex colored my tree mesh, i see what you mean about just generating a gradient and i might messes around with that soon, using a panner on the materials with the vertex color input to make the materials wave works correctly with the vertex color bending the branches nicely but the tree base material (tree bark) doesn't warp/wave in in line/time as the plane branches do since both are different materials, i use a absolute world position offset material for the panners but that is not in the same timing as the one used for the tree bark material so the branches and tree swaying don't align.
Sign In or Register to comment.