Merge pull request #363 from Unity-Technologies/fix-checkerboard
Fixing AA of procedural checkerboard node
This commit is contained in:
Коммит
308fd91f11
|
@ -32,15 +32,15 @@ namespace UnityEditor.ShaderGraph
|
|||
return
|
||||
@"
|
||||
{
|
||||
UV = UV + 0.25 / Frequency;
|
||||
UV = (UV.xy + 0.5) * Frequency;
|
||||
{precision}4 derivatives = {precision}4(ddx(UV), ddy(UV));
|
||||
{precision}2 duv_length = sqrt({precision}2(dot(derivatives.xz, derivatives.xz), dot(derivatives.yw, derivatives.yw)));
|
||||
{precision} width = 0.5;
|
||||
{precision}2 distance3 = 2.0 * abs(frac((UV.xy + 0.5) * Frequency) - 0.5) - width;
|
||||
{precision}2 scale = 0.5 / duv_length.xy;
|
||||
{precision}2 blend_out = saturate(scale / 3);
|
||||
{precision}2 vector_alpha = clamp(distance3 * scale.xy * blend_out.xy, -1.0, 1.0);
|
||||
{precision} alpha = saturate(vector_alpha.x * vector_alpha.y);
|
||||
{precision} width = 1.0;
|
||||
{precision}2 distance3 = 4.0 * abs(frac(UV + 0.25) - 0.5) - width;
|
||||
{precision}2 scale = 0.35 / duv_length.xy;
|
||||
{precision} freqLimiter = sqrt(clamp(1.1f - max(duv_length.x, duv_length.y), 0.0, 1.0));
|
||||
{precision}2 vector_alpha = clamp(distance3 * scale.xy, -1.0, 1.0);
|
||||
{precision} alpha = saturate(0.5f + 0.5f * vector_alpha.x * vector_alpha.y * freqLimiter);
|
||||
Out = lerp(ColorA, ColorB, alpha.xxx);
|
||||
}";
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче