Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
140 stars 2 forks source link

UI Circle Segment material has uneven border size #3036

Open JackTheFoxOtter opened 1 month ago

JackTheFoxOtter commented 1 month ago

Is your feature request related to a problem? Please describe.

When using the UI_CircleSegment material with rounded corners and a border, currently, the inner and outer corner radius are identical. This results in unpleasant visuals, as the border now has a wider thickness near the corners than it has near the rest of the arc.

As this is the shader used for the context menu, this is a rather visible detail that's been bothering me for a while.

Image

Describe the solution you'd like

I would like the shader to compute the inner border radius separately from the outer to ensure an even border thickness around the corners.

Describe alternatives you've considered

Not doing this. It's ultimately a small detail, but I think it would help make the context menu look a little bit better.

Additional Context

Adjusting the inner border radius separately from the outer is actually a common thing I do a LOT when designing custom user interfaces. If there is an elegant way to compute this, exposing that as a ProtoFlux node would be cool since then I could automate this process.

Requesters

Myself

Frooxius commented 1 month ago

I don't think this will be a priority anytime soon unfortunately. The math for this kind of thing can be very finicky and take a fair amount of time to get right, which ultimately leads to a very small detail.

JackTheFoxOtter commented 1 month ago

Would it help if I figure the math to calculate the border radius for the given input parameters out?

Frooxius commented 1 month ago

It could. If it's a formula we can just plug into the shader that saves the majority of the work on our end.

But that might also be tricky to do without the shader's source to see how it handles the calculations.

5H4D0W-X commented 1 month ago

If/When the shader for this does get adjusted, it would also be great if the z-test (or the UIX equivalent) was adjusted so it works with culling. OutlinedArcs currently show through canvases while images don't. Should I make a separate issue for this request?

shiftyscales commented 1 month ago

@5H4D0W-X - yes. You are highlighting a separate problem, please make a separate issue.

shiftyscales commented 1 month ago

From our reporting requirements:

  • Do not hijack issues for another feature/bug, Make another issue instead.
    • Issues should never have comments similar to "While you're at it, can you also do this?", it will not be considered and will get lost.
JackTheFoxOtter commented 1 month ago

But that might also be tricky to do without the shader's source to see how it handles the calculations.

Hrm, yeah that's likely the biggest issue. Is it possible to get access to that part of the shader's code?

art0007i commented 1 month ago

Hrm, yeah that's likely the biggest issue. Is it possible to get access to that part of the shader's code?

@JackTheFoxOtter you can get access to the full shader source, simply go to https://skyfrost-archive.ydms.workers.dev/assets/7d3a386e900cabd15ff79e25878facef9fdf81fea42208eecb4ad95baae1fcab it links to a .tgz archive (you can use 7zip to open this) then inside the archive is a "Sources" subdirectory.

I've created a UnityPackage which can help you debug and fix this issue. This package contains the shader source like mentioned above. And a mesh which behaves like a real uix circle segment mesh (basically has weird uvs and tangents, because the circle segment shader reads that data to compute how it should look)

rename .zip to .unitypackage, I used unity 2019.4.19f1 but it should work on most versions since its just a shader and a mesh CircleSegment.zip