Execution Order Problems

Node-based Shader Editor
Post Reply
HellGate
Posts: 7
Joined: Wed Nov 29, 2017 3:53 pm

Execution Order Problems

Post by HellGate »

i was wondering how screendepth / surfacedepth can create values <0 untill i looked into the generated code.

it turns out that the surface depth is calcuated in the vertex shade before the vertex offset is applied

Example:

Code: Select all

o.eyeDepth = -UnityObjectToViewPos( v.vertex.xyz ).z;
v.vertex.xyz += float3(4,4,4);
i think this problem can occur on multiple occasions and might need some special execution priority.
(for example passing world position before and after vertex offset into the pixel shader using vertex to fragment node)
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Execution Order Problems

Post by Amplify_Borba »

Hello HellGate, thank you for bringing this to our attention, we're going to investigate it on our side and fix it as soon as possible!

Please don't hesitate to get back in touch if you run into any further issues, 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!
Amplify_RnD_Rick
Posts: 40
Joined: Wed Mar 01, 2017 6:33 pm

Re: Execution Order Problems

Post by Amplify_RnD_Rick »

Hey HellGate,

We first would like to apologize on our delay in providing you a fix.

On our latest build we added a new input port to both Surface Depth and Camera Depth Fade so you can place a custom vertex position and it will do its calculation according to that instead of the current vertex position.

You can download it over here:
https://amplify.pt/download/

So, to use Screen Depth with a custom vertex offset you can do something like this:
CustomVertexOffsetDepth.jpg
CustomVertexOffsetDepth.jpg (145.7 KiB) Viewed 3816 times
Please notice that we changed the Vertex Output option on the Node Properties from Relative to Absolute as we are specifying a final vertex position and not an offset.

Please don't hesitate on reaching us if you stumble into any issues.
HellGate
Posts: 7
Joined: Wed Nov 29, 2017 3:53 pm

Re: Execution Order Problems

Post by HellGate »

Sorry for the late reply. The fix worked fine for me so thanks a lot for that.
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Execution Order Problems

Post by Amplify_Borba »

No worries, glad we could be of assistance!

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.

Please don't hesitate to get back in touch if you run across any further issues, 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