3

Say that I have a mesh and a curve. Then I can shrink-wrap the curve so it follows the mesh. Is it possible to flatten the mesh in the perpendicular direction to the curve to make space for a road along the curve.

Original cross-section:

Original cross-section

New cross-section:

New cross-section

The road is supposed to go on the shelf.

Notice that this is a cross-section. The cross-section has a flat segment, but it may still have a gradient into the screen plane. This "Bulldozer" may use surface average, surface min, or surface max, computed along each cross-section the road passes, as reference for where to build the road.

In mathematical terms:

Let the initial elevation be z(x, y), and assume that z is differentiable. Then its gradient is

$$ \nabla z = \frac{\partial z}{\partial x}\hat{\boldsymbol{x}} + \frac{\partial z}{\partial y}\hat{\boldsymbol{y}} $$

Without loss of generality, assume that the road is going in the $x$ direction. With this choice of coordinates, the figures shows the $yz$-plane. After the modifier, I want

$$ \nabla z = \frac{\partial z}{\partial x}\hat{\boldsymbol{x}} $$

because there should be no slope orthogonal to the road. While the original solution fulfils this criterion (in fact, it sets $\nabla z = 0$ along the road), I do want to keep a non-zero $x$-derivative. You wouldn't push away an entire mountain to keep the road flat in all directions, would you?

Here is a picture: https://www.epikdrives.com/grossglockner-high-alpine-road, notice that the road keeps flat in one direction, but still has a non-zero derivative in the other direction. The "bulldozer" is required because any road as a non-zero thickness.

user877329
  • 1,378
  • 3
  • 14
  • 30

1 Answers1

6

You can try ...

  • Add a Curve - ShrinkWrap modifier to Landscape, Smooth modifier. Apply them.
  • Add a Cube - Array > Fit Curve modifier, Curve Deform modifier

enter image description here

  • For Landscape add Boolean modifier Target > Cube

enter image description here

Notes:

  • Position Cube's origin at bottom face so you can easily scale road (be wider or cut higher)
  • Delete Cube's front/back faces to avoid errors in boolean operation
  • By changing Curve's Tilt you can fix or adjust road angle
  • Moving some Curve's control points inside you can easily create a tunnel :)

enter image description here

vklidu
  • 36,165
  • 1
  • 61
  • 135
  • When I shrink-wrap a beveled curve, it becomes flat. Otherwise, I think it should work. – user877329 Jun 25 '22 at 06:01
  • 1
    Yes ..sorry for that ... Shrinkwrap was Apply before beveling ... I will edit answer later. – vklidu Jun 25 '22 at 06:07
  • What about "Modifier only changed to CV points" – user877329 Jun 25 '22 at 06:12
  • https://blender.stackexchange.com/questions/77390/why-shrinkwrap-making-the-tube-flat. Enable that, remove interpolation, and subdivide curve. – user877329 Jun 25 '22 at 06:22
  • Sorry didn't worked for me, but ... I rewrote answer - Cube with single Array and Curve Deform finally works the best for me ... and stay flexible for road adjustments. Origin moved at bottom face of Cube let me delete two other Array modifiers (used before) and simple scale Cube if needed road wider or cut higher. And relax some dramatic curvatures of road eliminated overlapping cubes array, so Remesh and Decimate (that was heaviest calculation I could delete as well (road is more also natural to real road to keep car's speed. – vklidu Jun 25 '22 at 16:11