1
$\begingroup$

I'm making a racing game. I am able to make a track with kerbs easily:

I can create this road with an array and curve modifer

I can create this road with an array and curve modifer, however I'm struggling to join it flush with/add surrounding terrain so my car doesn't just drive off the edge. I dont just want the road to be perfectly flat, I want there to be hills and terrain etc.

I have tried just filling in the gaps but that takes ages and I cant do it in a nice way. I also tried cutting a track sized hole in a plane with boolean, but I cant get it to work. Any help or methods to do this would be great!

$\endgroup$
2
  • 1
    $\begingroup$ Possible duplicate of Create a road along large terrain $\endgroup$ Sep 28, 2018 at 18:08
  • $\begingroup$ I noticed the possible duplicate but decided to answer this because it seemed sufficiently different to have a pre-constructed road you want to fit to terrain. My answer ends up being a bit different than the answer to that question, and I think there are lots of valid cases where you might have a road that's been generated by means other than a curve that can be shrinkwrapped. $\endgroup$ Sep 28, 2018 at 18:40

1 Answer 1

5
$\begingroup$

You can do this using the shrinkwrap modifier. Add a Shrinkwrap modifier to your road, set it to Project mode, limiting the axis to Z and checking Negative under Direction. You will need some offset to keep the road from overlapping with the terrain. There will be a gap that can be filled by extruding the entire road downward on the Z axis or using the Solidify modifier if you want to do it non-destructively.

enter image description here

While doing this I noticed that with any kind of steep terrain the road looks weird because it's ungraded, following the terrain too closely. If this is a problem you can shrinkwrap the road to a smoothed copy before solidifying it. Create a copy of the terrain, add a Smooth modifier, limit it to the Z axis, set the intensity to about .5 and the iterations to around 20. Play with these settings until you get something that looks right in your case.

Shrinkwrapped road Graded road

My example graded road has to stick out the ground to avoid overlapping with the terrain and it's a little taller than I'd like. To get it any closer the underlying terrain has to be smoothed where the road will be. To do this, manually select the vertices under the road using circle select, assign them to a vertex group, add a smooth modifier to the actual terrain and set it's vertex group to one you created. You can use similar settings to the ones above. Now the graded road can be moved further down. In some cases we won't need a second terrain and can just shrinkwrap to the partially smoothed terrain, but by using both we get fine control over how the road and terrain meet each other.

Road Improved

$\endgroup$
0

You must log in to answer this question.

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