Page 1 of 2

bad Tangent space when using tesselation

PostPosted: Sat Dec 23, 2017 3:12 pm
by kurzemnieks
When using View Dir (tangent space) or World to Tangent Matrix and turning on tesselation, you get zero on about half of the polygons.
I guess it's something with Vertex Shader + Tesselation ?

Is this anything possible to fix?

Thanks

Re: bad Tangent space when using tesselation

PostPosted: Tue Dec 26, 2017 8:03 pm
by Amplify_Borba
kurzemnieks wrote:When using View Dir (tangent space) or World to Tangent Matrix and turning on tesselation, you get zero on about half of the polygons.
I guess it's something with Vertex Shader + Tesselation ?

Is this anything possible to fix?

Thanks


Hello kurzemnieks, thank you for getting in touch!

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.

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 02, 2018 6:21 pm
by Amplify_RnD_Rick
Hey kurzemnieks,

Thank you for your patience!

First and foremost we would like to wish you an amazing year of 2018!

It's quite strange, tessellation shouldn't influence the View Dir or World To Tangent matrix values.

We did some tests on our end with some Unity native 3D objects and those values were unaltered when switching tessellation on/off (as it should).

If you are working on p.e. android it will turn black because tessellation may not be supported and it will fallback to the default diffuse shader. But on this case everything would go black, not some parts.

Is it possible for you to share your shader, or if possible share a small sample ( scene + shader + material + 3d model ) with the issue occurring?

Also can you let us know your:
- Operating System
- Unity Version
- ASE Version

We're looking forward on your reply so we can solve this as soon as possible!

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 02, 2018 7:43 pm
by kurzemnieks
Hmm, strange. Ok, I will try to provide sample in next few days. Platform is Windows 10, Unity 2017.2, GPU is 1080Ti.
Maybe it was a specific configuration of Unity project or something.. let's see.
Thanks!

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 09, 2018 10:15 am
by kurzemnieks
It seems that the bug is happening only in deferred mode.
I attached the screenshot and link to simple project with stripped shaders.

tessel_bug.jpg
tessel_bug.jpg (110.74 KiB) Viewed 9774 times


Project:
https://ufile.io/sr4om

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 09, 2018 10:56 am
by Amplify_RnD_Rick
Hey kurzemnieks,

Thank you so much for sharing the project with us.

The reason why this project in particular is acting strangely is because you have its shader render path set to forward only and you are rendering your camera in deferred.

In order for you shader to work correctly in both shader paths you need to set the Render Path option to All on your Output node properties.

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 09, 2018 1:16 pm
by kurzemnieks
Oh, I know why - I'm using translucency in the original full shader, and as soon as you turn on translucenty, Shader Editor sets Render Path to "Forward Only". It works fine in deferred mode (If I understand correctly - all forward shaders are just rendered in separate pass, over the deferred pass?) - except when you use turn on the tesselation and use the View Dir node.
Somehow I think this should be fixed in one way or another - because it means I can't use translucency in my case.
Thanks for looking into this!

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 09, 2018 2:35 pm
by Amplify_RnD_Rick
No problem at all, we're here to help.

Yes, translucency only works on Forward so, if you connect something to it we automatically change the render path option.

And yes you are somewhat correct, Unity first goes through the deferred rendering path and after that it goes over the Forward rendering path.

One other example of an effect that only works on Forward is rendering semi-transparent objects.

You can see here what is possible on each of the paths:
https://docs.unity3d.com/Manual/RenderingPaths.html

Please don't hesitate on reaching us if you further questions.

Re: bad Tangent space when using tesselation

PostPosted: Tue Jan 09, 2018 4:19 pm
by kurzemnieks
Ok, thanks. But it means that there still is a bug - you can't use tesselation + view dir node (or World To Tangent matrix) in forward rendering only shaders when project is set to deferred mode.

Re: bad Tangent space when using tesselation

PostPosted: Wed Jan 10, 2018 6:54 pm
by Amplify_RnD_Rick
I don't consider this to be necessarily a bug since, if you set your camera to only render in deferred then all the shaders used to work correctly on your scene must be created with either the Deferred Only or the All option on the Render Path dropdown. Otherwise there will be unexpected results ( not only with tessellation and view dir ) or the object wont be rendered at all.