2
$\begingroup$

I am trying to create a curved castle wall using the array and the curve modifier.

This works fine for a wall on a flat surface. I'd like to add some terrain by also changing the curve on the z-axis.

Castle Wall using 1. array modifier and 2. curve modifier for the path

As depicted in the image above this seems to work fine. However the merlons (extended part on the wall) start to lean and follow the curve as well.

Question: Is there a way to restrain the deformation on the merlons? I would like to keep all the vertical lines vertical. (See handmade mesh below) Maybe anyone has an idea for a better workflow?

All vertical lines remain but moved on the z-axis

$\endgroup$
2
  • $\begingroup$ Should the merlons on a sloping hill look like stair steps to overcome the height difference? $\endgroup$
    – Blunder
    Commented Feb 24, 2023 at 19:33
  • $\begingroup$ Not necessarily. I would be happy with a wall that could follow soft hills and terrain differences. Similar to this photo of Yorks townwall ichef.bbci.co.uk/news/976/cpsprodpb/BC50/production/… For steep hills I guess I would model a specific mesh. $\endgroup$
    – Maurice
    Commented Feb 24, 2023 at 19:53

1 Answer 1

4
$\begingroup$

I think it's easier to use a flat curve and than displace the wall based on the terrain. The starting setup I would use has mesh object with an array modifier and curve modifier pointing to a 2D curve. Then we have the 3D terrain as a separate mesh:

enter image description here

Pick the castle wall object and add a node modifer. First thing we need to do is to "apply" the modifier stack to the geometry of the object, so we add the Realize Istances node:

enter image description here

Then we need to displace the geometry of the wall up above, so we add a "Set Position" node that has as input the position field:

enter image description here

The offset value can't be a single value, or the walls will go up all by the same amount. We should sample wall geometry points to find the nearest point of the surface and transfer the only the Z value (see the position field multiplied by 0,0,1).

enter image description here

Sampling node may introduce some imprecisions whit this simple setup. You can achive better results by taking into accounts only the projection of the surface like this:

enter image description here

Finish by adding another node setup to check for faces that looks up (normal = 0,0,1) and scale them by zero on the Z axis

enter image description here

Final result:

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you for the detailed answer. I will give this a try! $\endgroup$
    – Maurice
    Commented Feb 25, 2023 at 10:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .