Tree Chopping - Masking Cuts and Falling Trees - Survival

I am looking to implement Tree Chopping mechanics for my survival game.
Requirements:

  • When player uses its axe and does swipe animation, the tree gets chopped and cut is made incrementally (like a hole in the mesh)
  • After certain amount of swipes the tree gets chopped at the cut and falls using Physics.
  • The cut is made always at fixed height from the bottom point of the tree and during animation the player controller capsule adjusts so that the cut is made at the the given height.
  • Similar kind of tree chopping system can be seen in The Forest game. Following is the screenshot:

My Approaches and Problems I am facing:

  1. Creating a Depth Mask Object at the Cut position:
  • In this approach I place a rectangular mesh at the point of cut. I set its ColorMask to 0 making it invisible and setting its ZWrite to On so it writes to Depth Buffer. I set the render queue of the alpha mask to Geometry - 1
  • I then add a rectangular mesh in the void created by the alpha mask and set its render queue to Geometry - 2 so that it is drawn before the Mask void is drawn.
  • The problem with this approach is that Anything behind the tree is not rendered in the groove of the tree and directly the skybox color is displayed.
  1. Placing a Replacement Tree mesh
  • Hiding the tree from terraindata and putting a new tree prefab (which is similar to the existing tree but has additional submesh of the groove) in place of the tree. Then gradually hide the groove outer face renderer to show the inner groove which is modeled in the Tree mesh.
  • As the tree size changes the cut height from the ground changes creating problems as for each size I have to create new meshes with groove mesh near the trunk.
  1. Using Shader Clip function
  • I know we can use clip function inside the shader of the tree to clip meshes or put some dark color at the cut.
  • I don’t how to do this. I think the problem with this is then all the trees have a new shader and don’t know if Unity allows for changing the shader of the tree in the terrain system.

None of the above ideas work very well, some in fact just don’t work.I would be grateful if you can share any ideas about how I might achieve this kind of chopping system.

Maybe just slice the mesh at first chop, deform the vertices near the chop a bit more with each swing …emit some particles for dust/woodchips/barkchips(?), project some kind of decals, could have a procedural mesh between the pieces if you want it to look better or use some prefab chunks… I don’t know just thinking out loud.

As for mesh slicing itself, there are probably free approaches around but here’s an example of what I mean that I grabbed some time ago - I haven’t actually used it / can’t vouch for this in particular.

6130265--668354--time_saver.jpg

Hello!
You can check this asset: Cut Trees | Utilities Tools | Unity Asset Store

It works with Unity trees or SpeedTrees with a standard Unity wind. Also can be useful for any other tree (check the description of the asset about limitations).
Have a nice day!