Fix draw rectangle in BufferedDrawNode not being aligned with framebuffer rectangle#6670
Fix draw rectangle in BufferedDrawNode not being aligned with framebuffer rectangle#6670minetoblend wants to merge 2 commits intoppy:masterfrom
Conversation
|
Maybe I'm just unsure of what I'm looking at, but it's still looking weird at low speed/0.25 scale (on my MBP as this is resolution dependent). Before: 2025-11-17.13-56-52.mp4After: 2025-11-17.13-57-34.mp4The before one is behaving more like what I'd expect here where the box is centred but not aligned to the pixel grid, same with the diagonal lines being more stable. |
I'm honestly not 100% sure what it should look like at lower framebuffer scale either. renderer.PushOrtho(screenSpaceDrawRectangle);
var topLeft = new Vector4(DrawRectangle.Left, DrawRectangle.Top, 0, 1) * renderer.ProjectionMatrix;
var bottomRight = new Vector4(DrawRectangle.Right, DrawRectangle.Bottom, 0, 1) * renderer.ProjectionMatrix;
Logger.Log($"{topLeft.Xy}, {bottomRight.Xy}"); |
|
Right... Looks like while the draw rect is rounded to whole pixels now, the drawbles are still drawn at their original coords which just moved the misaligned somewhere else. |
BufferedDrawNode rounds the frameBufferSize to int, but uses the original draw rectangle to do futher rendering with. This caused the content being misaligned with the pixel grid when the containers bounds weren't integer coordinates.
With
pixelSnapping: falsethis would cause the content to become blurry due to the framebuffer texture being drawn with linear interpolation. A common workaround in osu for this is to use aFrameBufferScalegreater than 1.With
pixelSnapping: truethis would instead result in the content randomly shifting around when the container changes position/size.With this change it will first compute the frameBuffer size and base the draw rectangle off of that. At frameBufferScale=1 there should be no discernible difference between having the content in/outside a BufferedContainer, with both pixelSnapping being on or off.
Before
2025-11-17.05-35-06.mp4
After
2025-11-17.05-35-39.mp4
Was briefly discussed on discord