Hello,
I’m currently working on a stratergy game where you build houses and stuff. When you build a house in game the player should be able to connect it to other buildings with roads. My Idea was to paint these roads directly on the terrain using TerrainData.SetAlphamp but i couldn’t get it working properly. My main problem is the low resolution of the texture you are able to paint. Is there any way to fix this. Does anyone have another idea to make (smooth) roads or even has a script for that?
Thank you for your response
Edit: What I currently have is a list of vector3 points the road should go through.
I would look at generating splines or meshes in runtime in order to achieve this effect and ignore users who recommend assets unless it’s for a specific reason they’re recommending them.
Thank you for your reply, but I already have that. I can generate smooth curves that go through the points I want them to. My problem is, that the roads I can show (using a Line renderer) dont align to the terrain (if the road is in a steep spot of the terrain, one side of the road goes into the terrain, but the other side floats in the air). My idea was to paint the roads directly on the terrain ( to avoid the previos issue). But I couldn’t get that working and thats why I asked here.
It’s a difficult topic this one, no two ways about it, another option you could try if you’re looking for some kind of texture paint option is to try displacement mapping, but then you have the issue of how to keep track of what’s been generated, maybe decals as another option as well? That wouldn’t look as good though.
Painting road as terrain wouldn’t work anyway, mostly since the texture won’t rotate with the road direction. I mean, your road would want to have dashed lines in the middle, or some sort of curb. That’s always going to align north-south, even when the road turns east-west.
Terrain painting also limits you to following the squares. That’s fine when you have big blobs of overlapping natural terrain, or even dirt paths that can get wider and narrower. But with a road it will scream out “I’m on a grid”, unless you’ve got very small terrain squares.
Hey Bergschaf, Could you possibly elaborate on how you did this? i’m facing a similar issue. I have a big unityterrain on which I paint certain textures according to real life data. While this is already rather inefficient for area’s (since you have to access each individual pixel en set it to the right alphamap layer, making it low resolution and time consuming), it is worse for patingin roads, since they appear way more jagged and can only have uniform textures. I imagine you create a new mesh for every road and as as much vertices as there are on the mesh that is underneath?