FCanvasLineItem doesn't draw with line thickness > 0

I’m using FCanvas and the various FCanvasItem structs to draw things to a render target. Most things work but if I try to draw a FCanvasLineItem (or FCanvasBoxItem) with a line thickness > 0 then nothing is displayed.

I’m using this code to draw them:

FCanvasLineItem line(position, nextPosition);
line.SetColor(FLinearColor(1.0f, 1.0f, 1.0f, 0.5f));
line.LineThickness = 2;
canvas->DrawItem(line);

position, nextPosition, and canvas are all set up elsewhere. I know this code should work because if I change line.LineThickness to 0 then it does get drawn.

I’ve had this code in my project for a while but only just noticed thick lines aren’t drawing recently. I went back and it looks like they were working in 4.13. Doing some more digging if I comment out the call to PrepareShaders on line 906 of Runtime\Engine\Private\BatchedElements.cpp in a source build of the engine then the lines do get drawn but I assume that line is doing something else important.

Hey -

Where exactly are you adding/calling this code? I presume “position” and “nextPosition” are FVectors, what is the data type for canvas? Is there anything else that would need to be added to test the behavior you’re seeing on my end?

position and nextPosition are FVector2Ds and canvas is an FCanvas. I decided to just make a repro project (attached, should open to the level with my UMG widget that displays the canvas) which I should have done in the first place. The one issue I discovered while making this is it only fails to render when your material’s blend mode is set to “Translucent” regardless of what the line’s alpha is. Works fine if it’s “Opaque” instead. I even tried setting the thick line’s blend mode to SE_BLEND_Opaque and it still didn’t render (except where it intersected the non-thick line for some reason).

Hey -

Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here Unreal Engine Issues and Bug Tracker (UE-44448) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers