News for hackers. Stuff that matters.
Re:Instanced Line Rendering Part II: Alpha Blending by bsder on Friday October 08, 2021 @02:21AM (#28796273)
How do you handle two lines drawn on top of one another?

The first line sets a bunch of pixels in the stencil buffer that somehow then need to get unset before drawing the next line, no?

I'm actually really interested in this as I'm having a really complicated time doing what should be relatively simple 2D CAD-type stuff with any of the modern graphics APIs (Vulkan or DirectX 12). Any time I want to draw a world-coordinate vertex thing with a device pixel width dimension life just gets horrible.

Re:Instanced Line Rendering Part II: Alpha Blending by pcwalton on Friday October 08, 2021 @04:12AM (#28796855)
You could try using the Z buffer instead of the stencil buffer. Give each object a different Z coordinate and use GL_LESS/GL_GREATER depth tests to avoid overdrawing.
Re:Instanced Line Rendering Part II: Alpha Blending by thomasikzelf on Friday October 08, 2021 @12:52PM (#28801309)
I tried this but it rules out doing antialiasing in the fragment shader.
Re:Instanced Line Rendering Part II: Alpha Blending by pcwalton on Friday October 08, 2021 @02:59PM (#28802807)
It shouldn't if you submit the paths from back to front and enable blending. You can then use analytic AA (distance-based or whatever you'd like) to blend with paths behind the one you're currently drawing.