Racing Line - draw mesh part by float
Posted: Fri Aug 03, 2018 7:59 am
Hi,
I need to create a racing line shader. It should show arrows where to go right before the car and fading after and in distance. You've surely saw some of them in racing games.
Material with this shader would be placed on a mesh, which is a simple line in a 3d space. Line have an out-of-bounds UV, which is going from bottom 0,0 - 0,1 uv space all the way up, passing 1,0 - 1,1 and tiling itself. Like in the picture:
The trick part is that racing line mesh is crossing itself on occasions, which means shader should take that into consideration and not show the part where player have already been or yet to come. I guess, I can find current player position on the mesh on scale of 0 to 1, where 1 is the finish. So I might be able to pass this float to shader.
The thing is I have no idea how to work with local surface. Or even where to start looking.
Would be glad if anyone shares any ideas on where to start. Thanks!
I need to create a racing line shader. It should show arrows where to go right before the car and fading after and in distance. You've surely saw some of them in racing games.
Material with this shader would be placed on a mesh, which is a simple line in a 3d space. Line have an out-of-bounds UV, which is going from bottom 0,0 - 0,1 uv space all the way up, passing 1,0 - 1,1 and tiling itself. Like in the picture:
The trick part is that racing line mesh is crossing itself on occasions, which means shader should take that into consideration and not show the part where player have already been or yet to come. I guess, I can find current player position on the mesh on scale of 0 to 1, where 1 is the finish. So I might be able to pass this float to shader.
The thing is I have no idea how to work with local surface. Or even where to start looking.
Would be glad if anyone shares any ideas on where to start. Thanks!