Straight from the twilight zone of my mind at 2:30am
- Get points of the trench curve
- Create an array of Line3 objects from (1)
- Find the shortest distance between a point of the terrain geometry and lines in (2)
- Do the stuff to make the point lower
- Iterate through all the points in the terrain geometry with (3) and (4)
Before:
After:
Demo: https://codepen.io/prisoner849/full/MWPeWEZ
PS This is just an example, not the ultimate solution.