implot icon indicating copy to clipboard operation
implot copied to clipboard

Pixel gaps in line plots

Open nuuSolutions opened this issue 2 years ago • 2 comments

I'm drawing ImPlot::PlotLineG with a width of about 4 here. At each kink there are small gaps like here: Screenshot_20230208_174355 The problem gets worse when points are very close together (and the gaps flicker on moving) here I draw about 1 point per pixel Screenshot_20230208_180143

As I workaround, I added a scatter plot of points over the lines - see the red line in the last picture - looks much better I wonder if something like this could be done in the original PlotLine

I just checked that the same pixels appear when using the original ImGui::PlotLines with width 4.0f hacked in

nuuSolutions avatar Feb 08 '23 17:02 nuuSolutions

Can you have a look at the list of draw commands and check if the graph lines are individual line segments or if this is drawn as line strides (list of line segments)? If this is individual lines the GPU might opt to "terminate" each line and thus cause these "gaps". The effect should be even more pronounced with even higher widths of e.g. 32.

BenBE avatar Feb 08 '23 18:02 BenBE

I'm using out of the box ImPlot::PlotLine or ImGui::PlotLines which calls ImDrawList::AddLine which calls PathLineTo Not sure what more you want me to check

nuuSolutions avatar Feb 08 '23 19:02 nuuSolutions