Wrong way implementation using material gradients for streets

I have a spline which is used for creating streets that share a single material for the ground. For performance matters, I want to achieve the cheapest solution for checking if a car is going wrong way or not. I thought about volumes to check the direction, but later I thought about using the own ground material with a special gradient that specifies flow direction. Is there any way to retrieve the color at any point on the street using line tracing or something like that? I would be using red for the right side of the road, blue for intersections and green for the left side. About the UV, I know it’s going to create gaps because of the gradient being repeated along the axis, but I think this can be easily treated on code.

So, is there any way to create that separate material layer and raycasting/line tracing to get it’s color on any given point?