-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Triangle is only half as thick as other shapes with the same thickness value #4053
Comments
Hello, It's not specific to Metal, I can see the same in DirectX11 and OpenGL and that tesselation is entirely done in imgui_draw.cpp anyway and unlikely to be related to rendering backend. We have known issues with sharp angles, e.g. #3366 #2964 #2183 and I'd like to merge #2964 (maybe I can dig into that now...) so I would treat this issue as duplicate, but.... I admit I got very surprised to learn that 1.67wip (screenshot you linked to) got this triangle right.... I dug and I realized that 9ad3419 which was intended as a simple "dumb optimization" actually broke this. Investigating this now... |
Had a breakthrough "doh!" moment, thanks to the 1.67 WIP screenshot you linked to.....
Restoring that code to use same logic as before the breakage: Original code had a scaling limit which ihmo is best increased. By increasing the limit, thickness is better preserved for sharp angles on thick polylines, with the side-effect that the geometry ends up reaching farer than one would expect by e.g. the polygon bounding box + half thickness. Depending on what the polyline is supposed to intend it might be a problem or not at all. As an experiment I changed this limit to 500.0f (pictured above) and I think it is a better tradeoff this way so I'm enabling this. A bevel (#2964) would be required to guarantee not extruding out, and I suspect we'll eventually introduce two runtime thresholds: threshold for bevel, threshold for limiting normal extrusion when not beveling. The following issues #4053, #3366, #2964, #2868, #2518, #2183 were related and I'm going to add commentary on them now. Issue #2183This was the first submitted issue. Further confusion coming from the fact it was posted in Nov 2018 before I made the Jan 2019 breakage, then most of the discussions happened AFTER that. The original issue related to that threshold which today I've increased (see second gif above). While not technically fixed, I believe today's revert of old code + increase of the threshold is a fairly good mitigation of the issue. Full conclusion would come from either providing option of beveling (#2964) either providing the option of having that normal extruding the geometry as far as it needs (which is only a matter of increasing that 500.0f scaling limit). Issue #2518This was the fix by @rmitton attempting to fix my error.
to
The change of threshold from Pushed fix fdda8b8 now! |
While reviewing the different issues I ended up reverting the scaling limit extent back. While both have merit, based on #3366 for now I think it is more important to preserve the property of not straying far off intended bounds. So effectively now we are closer to a full revert of logic from pre-Jan 2019, and I've identified that we might want one or two configurable thresholds later. (
) |
That was super-quick, thanks! |
Version/Branch of Dear ImGui:
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_osx and imgui_impl_metal
Compiler: Apple clang version 12.0.0 (clang-1200.0.32.29)
Operating System: macOS Big Sur 11.2.3 (20D91
My Issue/Question:
Thanks for creating IMGUI, I am having fun with it! However I think I discovered a small bug:
See screenshot below, the thickness of triangles is only around half of other shapes. Interestingly this also happens when I draw the triangle with
AddPolyline(...)
(a polyline with 3 points in clockwise order and closed set to true) and it's not a problem with the example screenshot on the main github page. So it might be related to Metal rendering on the Mac.Screenshots/Video
Standalone, minimal, complete and verifiable example: (see #2261)
Just run the examples on a Mac with the metal backend.
The text was updated successfully, but these errors were encountered: