Skip to content

Vulkan: Support drawing thin/Bresenham lines on NVIDIA #75654

Open
@PureAsbestos

Description

@PureAsbestos

Godot version

4.0.1

System information

Windows 10, Vulkan, NVIDIA GeForce GTX 1070

Issue description

Not sure if this is technically a bug, but I consider it a regression introduced in Godot 4 with Vulkan. Line rendering (e.g. with draw_line, Line2D, etc.) relies on the graphics backend, and the default behavior for line rendering is different between OpenGL and Vulkan. OpenGL uses the familiar Bresenham style lines, while Vulkan uses something a bit different.

vulkan-opengl-lines
Even in OpenGL compatibility mode, the lines are drawn in the Vulkan style. The OpenGL behavior was preferable for many use-cases, and is especially important for pixel art games and pixel art editors (which is what I'm making at the moment).

It seems that the best solution to this might be to use VK_EXT_line_rasterization to (optionally?) provide this behavior, though as I understand it there might be some portability issues there (I don't think MoltenVK supports VK_EXT_line_rasterization yet for instance).

Update: this problem does not exist consistently everywhere. This new line-drawing style shows up with my NVIDIA GPU but not with Intel Integrated Graphics, which still uses Bresenham-style lines. It really ought to be consistent across devices.

Steps to reproduce

Use draw_line in Godot 3
Use draw_line in Godot 4 and notice that it looks different

Minimal reproduction project

Godot 3 project:
line-test-3.zip

Godot 4 project:
line-test.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions