Hey, I’m trying to do 2D UI drawing using Vulkan, so I need precise control as to which pixels are rasterized when drawing my triangles and lines. I’m on an Nvidia RTX 5000 and I have a triangle whose right edge is located at pixel X=3432.47437 after sending it through an ortho projection matrix and transforming it by the viewport transform.

What is confusing to me is that this results in pixel X=3432 being rasterized by this triangle. I would expect since the triangle edge isn’t over the midpoint of this pixel, it shouldn’t be rasterized. Even with a subpixel precision of 8 bits as given by the card, I wouldn’t expect this value to be rounded up past the midpoint of the pixel.

Can anyone that knows more about rasterization help me understand what’s going on here?

Thanks!

Should probably be so. I am assuming you have MSAA off? Why don’t you share the output in lossless format (PNG?) and show all the parameters (viewport creation, and the shaders). Maybe we could go through the math manually for didactic purposes…