Closed CaseyHofland closed 1 year ago
Unfortunately I don't have time to investigate this right now. If you find the solution, please share it.
Could you explain more about what OutlineColor.URP does? I'm getting really confused.
The above code throws an error, and when it does, the outline works as expected.
But when I fix the error by providing my own Varyings implementation (from URP Drawing a Texture) the outline doesn't show up.
Even when I do this:
half4 FragmentAlphaTest(Varyings input) : SV_Target
{
//half4 c = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv); // error occurs here
//clip(c.a - _Cutoff);
return 1;
}
Still nothing. How can a shader only work when it doesn't work?
So a quick update (I really try to keep all my projects error free so I couldn't help it)
The new ShaderAPI uses input.texcoord
(not sure when this was changed)
half4 FragmentAlphaTest(Varyings input) : SV_Target
{
half4 c = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.texcoord);
clip(c.a - _Cutoff);
return 1;
}
New code, no errors. But again, when you don't get errors in this shader outlines disappear. Could you perhaps share an insight into why this happens so I may investigate it?
I managed to fix this issue in my project with the following steps:
Outline Resources
fileRender shader
in the created resources file to the created shaderOutline shader
to Outline.URPOutline resources
of all Outline feature
render features in the Universal Renderer Data
to the created resources fileWorks perfectly! Instead of making a shader graph I just used the URP Unlit shader which works as well. Thanks for the fix!
@Arvtesh I'd love to create another, very simple, PR for this, but you haven't accepted my first one yet. Like I said before, I really like this outline implementation and I hope you'll find the time to approve them so that it stays supported for everyone.
Possibly related to #59
Alpha testing does nothing and is seemingly always enabled with a cutoff value of 1. The only cause I can think of is that
OutlineColor.URP
has a shader error sayinginvalid subscript 'uv'
.It's about this line of code
Which is... stupid, why would Varyings not have uv, it has always had uv!? Am I crazy?!
Not sure what to do yet, Varyings is taken from
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
and it will have to be investigated.