Racing Line - draw mesh part by float

Node-based Shader Editor

Racing Line - draw mesh part by float

Postby ehWasilii » 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:
Image

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. :oops:

Would be glad if anyone shares any ideas on where to start. Thanks!
ehWasilii
 
Posts: 2
Joined: Fri Aug 03, 2018 6:48 am

Re: Racing Line - draw mesh part by float

Postby Amplify_Borba » Fri Aug 03, 2018 11:05 am

Hello, thank you for getting in touch and for your support!

Although this forum is mostly aimed at technical support, if you could provide a further example of the type of effect you're trying to achieve, such as a screenshot or video, we might be able to point you in the right direction.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Racing Line - draw mesh part by float

Postby ehWasilii » Fri Aug 03, 2018 11:16 am

Hi,
sorry, was taken away with this shader creation, didn't notice this forum for technical issues only/mainly :)

Im looking for this kind of racing line, which shows you where to go
Image

Here is the video it was taken from https://www.youtube.com/watch?v=A49NREwd9zg&t=21s.

But it's okay, Im gonna dig it someday.
ehWasilii
 
Posts: 2
Joined: Fri Aug 03, 2018 6:48 am

Re: Racing Line - draw mesh part by float

Postby Amplify_Borba » Fri Aug 03, 2018 3:10 pm

There are many ways to achieve this effect, most beyond the scope of what the editor provides, it really depends on how comfortable you intend to create it. The shader it self in unaware of it's surroundings, depending on the technique you would likely have to pass it the necessary information to display the effect via scripting and, as such, we recommend looking into the Smear example for additional information on how to pass values directly to your shader.

We recommend looking into 3 possible techniques:

1. Panning your UV's according to the car position in the track, revealing only what is ahead of the car.

2. Using the available Sphere Mask on the arrow mesh to mask it, note that you have to pass your car position to the this shader.

3. Using a custom lighting solution, such as in our UVLightReveal sample, where you're using light data and a conditional case to check whether to hide or reveal a specific texture. In this specific case you could simply place a light in front of the car just for the purpose of revealing the arrows.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 47 guests