PC gaming graphics question

dal

dal

Associate
Joined
10 Sep 2005
Posts
905
Location
Lincolnshire
Hi, I've had a search online & can't seem to find anything out about this.
What I want to know is how are the graphics to road building games ( like cities skylines )
made.
I'm making a game & I've got a couple of splines to represent roads now I need to make the graphics / mesh for them, see photos :

So from this
thITm8C.jpg

I want to get somthing like this :

tnfYsdm.jpg

If you can point me in the right direction that would be a help.
I've googled :
how are road systems in games made
render road from spline
& a number of others.
 
NP, ah okay I see what you mean. So you've gotten the mesh generated and there is a problem where the spline diverges, or are you anticipating the problem? I would have thought that the generation should take care of any divergence since it's merely following the spline but it may need to be extended to check for splits, and then different mesh generation rules when two splines are in close proximity to one another.

I've tried to find some literature but as you say it's difficult to find a lot on the subject!
 
Yes I'm anticipating the problem. The only way I can think this could be done is by creating a mesh from interpolations of the splines, but as you can see from the diagram below there would be a area where
the spline would overlap. I could place the yellow centre line slightly above the rest of the mesh but I think I'd still get problems with z fighting - although it might be worth a try to see.
The other option with this approach is to calculate where the quads will intersect the yellow line and only draw them down to there.

I'm still wondering how the hell do all those AAA game devs do this sort of thing, I'm sure this is not the only way to do it.


ipmbj5q.jpg
 
Two solutions really :

1) Draw the road base, and the center line separately. Just draw the line slightly above the road base. Bit of a fudge, and you might need to also offset the base a little to avoid Z-fighting. Not very efficient either as you're wasting polys.

2) Treat the junction segment separately, and have different code for generating the mesh in the junction section (which you'll probably want anyway, to make it look like a proper junction, not just two diverging lines.

I'm still wondering how the hell do all those AAA game devs do this sort of thing, I'm sure this is not the only way to do it.

To answer that question....we sit and do the math! You'd be amazed how much head-scratching and whiteboard scribbling goes into solving what on the face of it is the most mundane and trivial issue :)
 
Thanks for your reply, I'm considering both options. I've been thinking a lot about how to make a mesh around the road section since getting into game dev yes I would believe how much work goes into
what looks like something mundane.
 
Back
Top Bottom