Amplify Shader ZTest

Your feedback is very important to us. We are listening.
Post Reply
londonstevey
Posts: 4
Joined: Tue Oct 09, 2018 10:15 am

Amplify Shader ZTest

Post by londonstevey »

Hi, I've just downloaded the Amplify Shader for Unity and am loving it its so easy to use!
I'm creating a skiing game, where I have a slope with one material on a mesh, I've placing another mesh with a track on it over the top.This sits flush with the slope mesh, and has no collider. Because its so close to the below mesh I get flickering from the ZTest. Is there a way of creating a shader that will use the ZTest less than... but shift the test value by a small amount, so the track will always be on top? I've tried using the Offset Factor and Units but this seems to move the rendered material up. I want it to stay in the same place, but just always win the ZTest fight with the below mesh.
Thanks!
Attachments
You'll see my attempt using offset, which then moves the material above the gate a bit
You'll see my attempt using offset, which then moves the material above the gate a bit
amplifyshadertest.JPG (59.16 KiB) Viewed 5245 times
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Amplify Shader ZTest

Post by Amplify_Borba »

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

Have you tried setting the different Render Queue values for the track and the mesh on the material?

The track would have its value set higher so that it would be rendered later on, and you can offset it through the shader using the 'Queue Index' parameter or set it in the material itself:

Image

Image

In the above setup, setting the shader's 'Queue Index' to 1 and compiling would in turn have the material's Render Queue value set to 2001, for example.

You could also consider slightly moving the track away from the mesh, in a way that it would be nearly unnoticeable.

Please let me know if this helps, thanks!
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!
Post Reply