Hello,
Line drawing is disturbed on Mac.
The video below shows a new Built-in RP project in Unity 2020.3.20f1,
just imported ALINE 1.5.2 and opened the Example4_Styling demo.
The same problem occurs in the URP project.
It renders beautifully on Windows with no problems.
I need line thickness adjustment on Mac as well.
Could you please fix this problem?
My Environment
Mac OS 12.3.1, CPU Intel, GPU Intel Iris Plus Graphics 655,
Unity 2020.3.20f1, Graphics API Metal, Build target Standalone for Mac
I found the cause of this problem.
It is the “decodeLineJoinOffset()” in “aline_common.cginc”.
If this function is forced to return 0, the automaticJoins will not work, but the drawing will be undisturbed.
It seems that the bitwise operations are not working correctly on Metal.
Thank you for digging deeper.
Would it be possible for you to test to change the decodeLineOffset method to this:
int decodeLineJoinOffset(uint joinHintInstanceIndex, float2 uv) {
// Which other line to try to join with.
// The joinHintInstanceIndex is encoded as two 16-bit integer offsets
// for which half of the range (<32768) indicates a negative offset from
// the current line, and the rest indicate a positive offset.
// The upper 16 bits is the offset for the backwards direction
// and the lower 16 bits is the offset for the forwards direction.
uint joinIndex = joinHintInstanceIndex;
if (uv.y < 0) joinIndex = joinIndex >> 16;
return (int)(joinIndex & 0xFFFF) - 32768;
}
Hi, That function is exactly the same as the function in 1.5.2, right?
It was the same result.
Instead of one uint contains two values, why not use two int or short?
Two ints will use more memory, and drawing is actually limited quite a lot by the upload bandwidth to the GPU. Shorts cannot be used because glsl don’t really have support for that without extensions.
Anyway, you can try the latest version of ALINE (1.5.3), I have added a workaround there.
That’s weird. Would it be possible for you to select the aline_outline shader in the inspector and click the “Compile and show output” button (making sure Metal is selected as the target), and send me the output of that?