Problem with depth fade

Node-based Shader Editor

Problem with depth fade

Postby mossman » Tue Dec 26, 2017 1:47 am

Hello,


I'm having a problem with using the depth fade node to create a intersection detection between meshes. The intersection detection is on a Unlit shader (I use the trasnparent unlit template). The intersection only appears when de Unlit shader with the intersection detection intersects with a Surface shader but not when the Unlit shader intersects with another Unlit Shader.

This image ilustrates the problem.
https://app.box.com/s/sp1piws00zht78ihhr5gc6xnpy79c9oa

Thanks
mossman
 
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Problem with depth fade

Postby Amplify_Borba » Tue Dec 26, 2017 8:08 pm

mossman wrote:Hello,


I'm having a problem with using the depth fade node to create a intersection detection between meshes. The intersection detection is on a Unlit shader (I use the trasnparent unlit template). The intersection only appears when de Unlit shader with the intersection detection intersects with a Surface shader but not when the Unlit shader intersects with another Unlit Shader.

This image ilustrates the problem.
https://app.box.com/s/sp1piws00zht78ihhr5gc6xnpy79c9oa

Thanks


Hello mossman, thank you for getting in touch!

Not quite sure if this is an expected behavior, our developers are currently taking some time off for the holidays, but rest assured that we'll get back to you as soon as possible on this matter.

Apologies for any inconvenience caused.
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: Problem with depth fade

Postby mossman » Thu Dec 28, 2017 11:42 pm

Hello,

Thanks for the quick answer. I will waiting the final answer.


Bye
mossman
 
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Problem with depth fade

Postby mossman » Tue Jan 02, 2018 6:32 pm

Hello, any help?

Thanks
mossman
 
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Problem with depth fade

Postby Amplify_Borba » Tue Jan 02, 2018 6:55 pm

Apologies for the delayed support response but we are a bit overloaded at the moment as our developers have just returned from holidays and have been sorting through all the support requests.

Do rest assured that we'll review your issue as soon as possible, thank you for understanding!
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: Problem with depth fade

Postby Amplify_RnD_Rick » Wed Jan 03, 2018 6:30 pm

Hey mossman,

We apologize again for the delay on providing you support, thank you so much for your patience!

What Depth Fade internally does is to calculate the difference between each pixel's current depth and the value fetched from the depth buffer on that specific location.

So, in order for this node to get correct results its object must not be written on the depth buffer but the other object it intersects should. That is what happens when you intersect the unlit shader box with the surface shader box, the unlit one is not being written on the depth buffer but the surface one is.

When you intersect two unlit boxes, neither of them is being written into the depth buffer thus the Depth fade is unable to calculate correct values.

Please let us know if you need further clarification and don't hesitate on reaching us if you stumble into any issues.
Amplify_RnD_Rick
 
Posts: 40
Joined: Wed Mar 01, 2017 6:33 pm

Re: Problem with depth fade

Postby mossman » Wed Jan 03, 2018 9:32 pm

Thanks for the clear description is very useful.

Now, the question is:
How I detect the intersection between two meshes with a unlit shader? Using Surface depth node?

Thanks
mossman
 
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Problem with depth fade

Postby Amplify_RnD_Rick » Thu Jan 04, 2018 11:17 am

Hey mossman,

I know this is not the answer you are looking for but we think that unfortunately it may not be possible using only shaders.

Intersections on a shader can only calculated via the difference between the current fragment depth and what is written on the depth buffer.

Since Unlit objects are not written on the Depth buffer there's no way for them to see each other when each is rendered.

We'll try to figure out a possible solution and let you know if we do find something.
Amplify_RnD_Rick
 
Posts: 40
Joined: Wed Mar 01, 2017 6:33 pm

Re: Problem with depth fade

Postby mossman » Thu Jan 04, 2018 5:14 pm

Hi,

I see... I found a post of the Unity's manual that explain something interesting about de depth buffer.
https://docs.unity3d.com/Manual/SL-Came ... xture.html

Is possible achieve the intersection betwen two unlit shaders with this?

Thanks
mossman
 
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Problem with depth fade

Postby Amplify_RnD_Rick » Fri Jan 05, 2018 12:23 pm

Hey mossman,

What this link is referring is on how to configure your camera to create the depth texture from the depth buffer I mentioned earlier.
I understand your frustration but unfortunately this doesn't have any extra info that would help solving your issue.
Amplify_RnD_Rick
 
Posts: 40
Joined: Wed Mar 01, 2017 6:33 pm

Next

Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 16 guests

cron