Page 1 of 1

Help with XRay Shader

PostPosted: Mon Jul 09, 2018 10:20 pm
by alex.turner
Hello.

Let me start off by saying I am pretty new to shaders and Amplify Shader. I am trying to modify the XRay shader that comes with the examples in the Unity package. My goal is to make a shader that has the xray effect on objects that are behind other objects, but renders nothing if the object is not behind other objects. I have a non-Amplify shader that works like this, but I'm trying to get better at using Amplify, so I want to replicate this in my Amplify shader.

Any help would be appreciated!
Thanks.

Re: Help with XRay Shader

PostPosted: Tue Jul 10, 2018 9:40 am
by Amplify_Borba
Hello, thank you for getting in touch and for your support!

It's possible to achieve the effect you intend with some tweaks to the XRay sample, however, you must first update ASE to the latest build currently available on our website, due to a recent bug fix that can cause the following setup to throw an error.

Image

You'll have to set the Blend mode to Custom, Type and Queue to Transparent, in order to enable the Opacity port.
Then proceed to remove the Outline node, connect its Color input to the Emission port and the Alpha to the Opacity port.

Make sure that the Blend RGB is set to Alpha Blend, and within the Depth tab set the ZWrite Mode to Off, ZTest Mode to Greater or Equal, and turn off the Extra Depth Pass.

Please let me know if this helps, thanks!

Re: Help with XRay Shader

PostPosted: Tue Jul 10, 2018 2:35 pm
by alex.turner
Thank you so much! That works exactly how I expect it to. I really appreciate the quick response!

Re: Help with XRay Shader

PostPosted: Tue Jul 10, 2018 3:53 pm
by Amplify_Borba
Glad we could help!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback.
Every bit helps, your feedback is extremely valuable to us!

Feel free to get back in touch if you have any further questions, thanks!