I made an example (attached). Get ready for some vertex shader fun!
Usage:
The ParkingLines scene contains a ParkingLines object. The ParkingView Script on the ParkingLines object has a trackWidth property that is just a helper to position the tracks based on the vehicle’s track width in the editor. Under this, you can find two instances of the “Track” prefab, referenced in the ParkingView script.
The “Steering” Property works in play mode and can be used to set the steering direction every frame.
There is also a “Test” object that you can turn on using the checkbox in the inspector next to the object name. It’s just a simple scene I made that I used to test the distortion. The lines on the test objects don’t look amazing and that’s because there isn’t enough geometry to distort, but it’s sufficient for testing purposes.
Explanation of how it works:
The Track prefab uses a ParkingLines script that generates a simple mesh that looks like a ladder that can be distorted. You may experiment with the “sections” property of the ParkingLines script that allows you to modify the number of subdivisions the mesh has.
The ParkingLine material uses the ParkingLine shader. It has some properties you can modify in the editor. When Play mode starts, this material is instantiated for each track, so we have two tracks with different material properties. You can, however, edit the width, length, color and distortion properties to your liking since these aren’t changed during runtime via script.
The ParkingLine shader does the following things with that mesh that standard unlit shaders don’t do:
- It takes the generated mesh and bends it to the left or right based on the steering value. This is happening in world-space coordinates.
- It uses a custom Distort2D function after the transformation from object-space coordinates to screen-space coordinates happened. This function comes from the Distort.cginc file I also added. The reason I put it in an include file is that this way I can test the same function with both my line and my test shaders.
- It generates a gradient between two color properties along the length of the line. That one is easy.
For you convenience, I marked the place in the Distort2D function where the actual screen-space distortion happens. In my example, I’m simply shifting vertices based on their distance to the center (so the distortion gets greater towards the edges). If you want to go down this vertex route, you’ll need to replace this with code that is tweaked for your specific camera’s properties.

This will work for simple distortion. If you have very complex distortion parameters, we’ll need to render the lines into a texture and then distort this based on a “baked” distortion texture. That is much heavier on the GPU, though, let’s see if the vertex solution is enough.