-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Use screen-aligned quads for origin lines to avoid issues on NVidia #83895
Conversation
While we are add it, use alpha-antialised lines to make them look nice
Why are the lines always antialiased? |
The linked issue comes from the lines aliasing. The solution is to antialias the lines. But since we don't want to force the viewport to always use an antialiasing solution, we apply one directly to the lines |
Just curious, the ~0.5ms increase in GPU time comes from this new method? |
@PZerua It's probably just random jitter, so I would not worry about it. It's a line, it should be nearly instant to render. |
No. It's just random. You can see that the performance actually increases when using MSAA compared to MSAA on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on a RTX 4090, it works as expected (including when FXAA, TAA or FSR 2.2 is used). Using camera presets or orthogonal camera keeps the expected appearance.
That said, resolution scales lower than 1.0
will appear to make the lines thicker (this is also an issue with hardware-based lines, such as grid lines).
Regarding performance, it's pretty much identical (tested with identical ~4K viewport resolution, Prefer Maximum Performance power profile in nvidia-settings and Update Continuously enabled in editor settings):
Before | After (this PR) |
---|---|
![]() |
![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks! |
Cherry-picked for 4.2.2. |
In my opinion, it looks very much better than before this PR. Can it be extended to other things? |
While we are at it, use alpha-antialised lines to make them look nice
Fixes: #37016
I can't reproduce the issue on my device as it is a driver bug. But this PR should avoid it completely as it doesn't use rasterized lines.
Importantly, this PR does make the lines slightly thicker in order to antialiase them. That is a tradeoff that we have to pay.
CC @aaronfranke please try it out and let me know if you are happy with the solution
For posterity, the technique is based on the one described here: https://wwwtyro.net/2019/11/18/instanced-lines.html
Master: no antialiasing

This PR: no antialiasing

Master: MSAA 8X

This PR: MSAA 8X (note how this looks the same as no antialiasing)
