0
\$\begingroup\$

EDIT: I have tried opening the shader in an empty project to test if there were some strange settings in the project, but it is the same issue.

I am creating a power bar which wipes from left to right. I have created it before very simply in a previous project but in this new project the alpha clip threshold value does not correspond to the amount of alpha in the texture.

I have taken the textures directly from the old project and even tried taking the exact shader graph from the old project but the threshold still does not work like it does in the old project. As far as I can see all settings are the same across both projects. Is there anything obvious below or anything I should be looking for?

The old project is v2021.1.22f1. The new project is v2021.3.5f1.

You can see the graph below.

enter image description here

When the AlphaWipe value is 0.5, the amount of the texture visible should be half but it seems to be around 0.2.

enter image description here

At value 0.8, it looks to be about half.

enter image description here

Value of 1 does fill the texture.

enter image description here

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Note that RGB colour intensities are not perceptually linear. A gradient made to appear linear may actually spend longer in the low values and shorter in the high values. How did you generate the alpha gradient you're using? Have you considered using the UV.x coordinate instead of an extra texture channel? (Both cheaper and guaranteed to be linear) \$\endgroup\$ Commented Nov 28, 2022 at 0:13
  • \$\begingroup\$ The UV0 input may be scaled,therefore scaling the output. \$\endgroup\$ Commented Nov 28, 2022 at 3:09
  • \$\begingroup\$ @DMGregory Is UV.x guaranteed to be linear? I understand that it will be linear in UV space, but not everyone understands the UV inverse is usually a non-linear projection warped by world-space scaling. \$\endgroup\$ Commented Nov 28, 2022 at 3:25
  • \$\begingroup\$ @dmgregory It doesn't matter about the RGB colour. Even if it is white it still looks like this. And the alpha gradient is guaranteed linear, don't worry about that. It is working in another project as expected but for some reason not here, I'm just wondering what the reason could be. I may have missed some settings between the 2 projects but haven't been able to find any differences thus far. \$\endgroup\$ Commented Nov 28, 2022 at 8:35
  • 1
    \$\begingroup\$ @Storm: it's linear in the space of the polygon, which is what matters here. Any non-linearity comes from perspective projection if this polygon is viewed obliquely, in which case you'd want your linearly spaced gradient to become non-linearly spaced in screen space, packed tighter in the portion farther from the camera. The transformation from UV space to world space is always affine, so it can't introduce any bending within a triangle. anothershrubery: did you check the texture's import settings to make sure it's not being read as sRGB when it should be linear or vice versa? \$\endgroup\$ Commented Nov 28, 2022 at 12:16

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.