end segment of circle arc scissoring #4419

Closed
opened 2021-08-10 22:32:20 +00:00 by rollraw · 7 comments
rollraw commented 2021-08-10 22:32:20 +00:00 (Migrated from github.com)

version: 1.82
branch: master

at first, i noticed that with dx9 renderer strokes are always anti-aliased even if imgui anti-aliasing is disabled
using following code in a fresh imgui example:

ImGui::GetStyle().AntiAliasedLines = false;
ImGui::GetStyle().AntiAliasedFill = false;
ImGui::GetStyle().AntiAliasedLinesUseTex = false;
ImGui::GetForegroundDrawList()->AddCircle({ 300, 600 }, 50.f, IM_COL32(243, 104, 224, 255), 12, 1.0f);

we will see this next with dx9:
dx9
and next with dx11:
dx11
i guess it could be related to bugs of dx9, because i tried to set dx9 renderstates to disable anti-aliasing but nothing changes

at second, circles (no sense filled/stroked) last segment looking scissored with magic '12' number as segments count (that will look for precached points), due to reduced segments count by 1 due to closed primitive drawing

version: 1.82 branch: master at first, i noticed that with dx9 renderer strokes are always anti-aliased even if imgui anti-aliasing is disabled using following code in a fresh imgui example: ```cpp ImGui::GetStyle().AntiAliasedLines = false; ImGui::GetStyle().AntiAliasedFill = false; ImGui::GetStyle().AntiAliasedLinesUseTex = false; ImGui::GetForegroundDrawList()->AddCircle({ 300, 600 }, 50.f, IM_COL32(243, 104, 224, 255), 12, 1.0f); ``` we will see this next with dx9: ![dx9](https://user-images.githubusercontent.com/15694466/128942900-1ee9ece1-1c0f-4199-9740-7e20226f7fcd.png) and next with dx11: ![dx11](https://user-images.githubusercontent.com/15694466/128942957-15eea55c-98f8-49e8-9736-223a78b0f2ca.png) i guess it could be related to bugs of dx9, because i tried to set dx9 renderstates to disable anti-aliasing but nothing changes at second, circles (no sense filled/stroked) last segment looking scissored with magic '12' number as segments count (that will look for precached points), due to reduced segments count by 1 due to closed primitive drawing
ocornut commented 2021-08-11 10:17:25 +00:00 (Migrated from github.com)

Thank you for the report.
There are two distinct issues there.

With dx9 renderer strokes are always anti-aliased even if imgui anti-aliasing is disabled

First question: even if it was fully the case, would you have an issue with it?
I did that

ImGui::GetStyle().AntiAliasedLines = ImGui::GetIO().KeyShift;
ImGui::GetStyle().AntiAliasedFill = ImGui::GetIO().KeyShift;
ImGui::GetStyle().AntiAliasedLinesUseTex = ImGui::GetIO().KeyShift;

dx9_aa
It doesn't look particularly "more" anti-aliased but I think the perception might vary depending on colors.

However it is possible there is something else in your app, e.g. multi-sample AA done by the app or by the GPU driver could alter that perception.

About the circle missing one segment:
Confirmed. I'm quite confused as 89685b346c (for 1.75) was explicitly intended to fix something and it appears it did the opposite. I think possibly the fix made sense before we switched to the new adaptive algorithm in 1.78 or a further change? Tagging @thedmd (or I'll check next time when I get back from holidays).

Thank you for the report. There are two distinct issues there. **With dx9 renderer strokes are always anti-aliased even if imgui anti-aliasing is disabled** First question: even if it was fully the case, would you have an _issue_ with it? I did that ``` ImGui::GetStyle().AntiAliasedLines = ImGui::GetIO().KeyShift; ImGui::GetStyle().AntiAliasedFill = ImGui::GetIO().KeyShift; ImGui::GetStyle().AntiAliasedLinesUseTex = ImGui::GetIO().KeyShift; ``` ![dx9_aa](https://user-images.githubusercontent.com/8225057/129011915-3aeaac32-de7f-4cf1-aa77-6d21040c4983.gif) It doesn't look particularly "more" anti-aliased but I think the perception might vary depending on colors. However it is possible there is something else in your app, e.g. multi-sample AA done by the app or by the GPU driver could alter that perception. **About the circle missing one segment:** Confirmed. I'm quite confused as 89685b346c7b02b7d557678fd9d5d11a80967f83 (for 1.75) was explicitly intended to fix something and it appears it did the opposite. I think possibly the fix made sense before we switched to the new adaptive algorithm in 1.78 or a further change? Tagging @thedmd (or I'll check next time when I get back from holidays).
thedmd commented 2021-08-11 10:22:21 +00:00 (Migrated from github.com)

@ocornut I will take a closer look at the missing circle segment.

@ocornut I will take a closer look at the missing circle segment.
thedmd commented 2021-08-11 11:23:49 +00:00 (Migrated from github.com)

@ocornut It is fixed on PR. I think this is how it should be from the begging, not patching AddCircle was my oversight.

Commit and PR have an extra comment, which I hope make the change clear.

@ocornut It is fixed on PR. I think this is how it should be from the begging, not patching AddCircle was my oversight. Commit and PR have an extra comment, which I hope make the change clear.
rollraw commented 2021-08-11 14:18:17 +00:00 (Migrated from github.com)

However it is possible there is something else in your app, e.g. multi-sample AA done by the app or by the GPU driver could alter that perception.

it's not a my own app, just imgui example from latest commit, i also tried to explicitely disable multisample AA with

presentParams.MultiSampleType = D3DMULTISAMPLE_NONE;
presentParams.MultiSampleQuality = 0UL;

in the d3d device creation, but seems it doesnt helped, so yes could be related to gpu/drivers, but weird it happens only with dx9

> However it is possible there is something else in your app, e.g. multi-sample AA done by the app or by the GPU driver could alter that perception. it's not a my own app, just imgui example from latest commit, i also tried to explicitely disable multisample AA with ```cpp presentParams.MultiSampleType = D3DMULTISAMPLE_NONE; presentParams.MultiSampleQuality = 0UL; ``` in the d3d device creation, but seems it doesnt helped, so yes could be related to gpu/drivers, but weird it happens only with dx9
thedmd commented 2021-08-11 14:57:00 +00:00 (Migrated from github.com)

Is AA forced in driver settings?

Is AA forced in driver settings?
rollraw commented 2021-08-11 15:50:51 +00:00 (Migrated from github.com)

Is AA forced in driver settings?

you're right, found in nvidia docs about this, overriding of application antialising working only till dx10, it's so weird but ok i'm calm now

> Is AA forced in driver settings? you're right, found in nvidia docs about this, overriding of application antialising working only till dx10, it's so weird but ok i'm calm now
ocornut commented 2021-08-19 15:10:20 +00:00 (Migrated from github.com)

Should be fixed by cb00972b87
Thanks @thedmd !

Should be fixed by cb00972b878a0a4722c9214e6f7d46d97f092c3f Thanks @thedmd !
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#4419
No description provided.