Suggestions for making modular roads

Howdy y’all. I am seeking for a way to add 2-way single lane roads, and 2-way double lane roads, using UE4.26. The would like to be able attach these modular pieces into a spline component. The 2-way single lane roads will have more lane markings options then the 2-way double lane roads, such as passing from one side, passing from both sides, and no passing at all.
I know how to model the roads, but I am having a difficult time creating an optimized texture atlas, without creating an 8k texture. I was originally thinking that I would not need to have separate materials, one for the road texture and the other materials for the lane markings. However, an 8k texture does not seem optimal either. So, I am kind of stuck in a hard place. Would anybody have any suggestions?

Yeah there’s lots of different ways of approaching that, I went with a system that uses one texture for the road surface and a small texture used as a mask for markings - it’s 128x1 for each different type of road marking (number lanes etc) and the mask is applied using another small texture with dashed lines etc on it (can have various ones with different aging) - it works out pretty efficient, low memory and you can do a lot of different marking types using that system so you’ll need way less decals later…

Hi there,

Have you checked this free asset and tutorial from Coqui Games?

1 Like

Yes, I have tried this tool. It is not that bad of a tool for being free, but I was not that impressed with the texture quality.

This sounds interesting. I will try to give this a shot. Just one question. Did you separate the lane markings from the rest of the mesh, or was this a single polygon mesh?


It’s just a single polygon mesh (kind of, it has sloped sides and is sub-divided for smooth spline flow) - the markings are only drawn where the mask is white in that 128px mask - all you have to do is set the UV’s for each of your meshes (each number of lanes) to align the masks correctly into the mesh…

Got it. No worries.

The one thing that is confusing me, assuming the 128px is the location, then how do you differeniate between solid, dashed lines, whether they are yellow or white, and adding chipped paint to the marking lanes with only 1 pixel high?

the 128px map is just a mask, the values mean different things (also, each RGB channel means different things) - so if Red is 0.0, it’s just the road surface, if its between 0.0 and 0.1 it’s a solid white line, between 0.1 and 0.2 it’s a dashed white line etc - it can be down to about 0.03 resolution from memory so you can have quite a few different types - the lines are stored in another texture and they are rendered on those masks, the U’s need to be manipulated to being between the start and end of the ones, but the Vs are still all good as they should be between 0.0 and 1.0… Those line textures can be nice and high res too as they’re not repeated at all…

… if I have say, 6 road styles, then I would have 6 128x1 masks, and how many UV islands do you have?

I have up to 6 lanes (and also dual carrage roads) - I’ve only done the base solid and dashed white and yellow lines in this version (each in there own island), but here is what they look like: (also, you can merge the 128x1 maps into one 128x128 map to make it more efficient)

RecourseDesign, I do not want to make it look like I am ignoring you, and I really appreciate the help. However, I am still in the middle of figuring this out. So far, I made a RGB mask, which places the line markings as well as if the line marker is solid or a dashed marker, but I still need to work out the bugs in my material. So, I still like to keep this thread opened, before I fully mark it as answered. Once again, thank you for your patients.

1 Like

FYI, so my theory did not work. I though I could compact my roads using just 2 different meshes and use 1 RGBA texture that is 128x8px. The 8 pixels was used to differentiate between solid and dashed markings. I have made each lane to be 7m x 3.5m. However, there are too many possibilities, and it was making a huge noodle mess in the material editor. For now, this is what my mask looks like…

1 Like

Yeah the number of varieties is pretty big, especially for up to 6 lanes… would probably take more VRAM too.
You can change the textures type to something that’s not lossy and 8bit (BC1 will only give you 5-6 bits each channel) and change the filter to “Nearest Neighbor” to clean up the edges (they’ll end up getting interpolated by your mask routine)…

I am not really sure if I should marked this as answered, because it is technically not fully answered. I would like to come back to this some day, but for now, I think I am just going to use Quixel Bridge road textures. And thanks for the help anyways

1 Like

No problem - I’ll be releasing my Road System on the Marketplace at some stage if that’s any use…

I would love to see it