Question

My goal is to draw white lines over an asphalt road. Since the properties of the road change, there cannot be just a texture representing both asphalt and white lines. The current approach is to apply the asphalt texture and code some information in the other two texture coordinates. In a pixel shader, reading those coordinates, I decide whether that fragment should be white or not.

This results in high levels of aliasing. And that’s the problem I want to try to solve.

I have been changing the “whiteness” of the line applying smothsetp or linear interpolation. I have also changed the width and color according to distance from camera. This helps a little bit, but at far away distances, there are still ugly aliased lines.

How would you go on doing this? Would it be better to have a texture representing an smoothed white line and accessing the texels? Should I implement an bilinear filter accessing neighboring texels?

Was it helpful?

Solution

You should simply use 2 textures with 2 coordinates.

  1. Small seamless asphalt texture tiled on the road polygon.
  2. Mark texture with alpha that you will place on the middle of this polygon (with texture coordinate offset)

Or you can create extra polygons in the middle of the road for marks to avoid any aliasing.

To make it all looks real you can apply Texture Bombing with dirt and cracks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top