ForesightMiningSoftwareCorporation / bevy_polyline

Polyline Rendering for Bevy

Home Page:https://crates.io/crates/bevy_polyline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Depth test bypass

nicopap opened this issue · comments

Hi. Thank for the great library.

I've been using bevy_polyline for a debugging library. And one feature I would really like is the ability to draw some polyline on top of everything else.

Given that often time, in a debugging context, you'll have your debug lines inside or very close to polygons, they are often occluded. Therefore, it would be very useful to be able to tell bevy_polyline to draw some lines on top of the rest of the geometry.

It would probably work by uploading a toggle (or a value saying how closer to the camera the line should be drawn) to the shader through a uniform (I'm very new to shader programming). On the user side, it would just be an additional field to the PolylineMaterial.

I'm going to experiment with this, see if I can come up with something clean enough to open a PR.

Yeah, we could maybe add a depth_bias field to the PolylineMaterial and access that in the shader. I've played around with a fixed offset to mimic the lines having thickness, and that worked okay - the only issues were that the meaning of that value was different depending on if perspective was enabled.

the only issues were that the meaning of that value was different depending on if perspective was enabled.

Maybe an enum could solve that? I'm not sure, but I'll try that out in my experimentation.