I am trying to draw an outline on a collection of quads in Direct3D. I have three intersecting quads on the same plane in the following configuration:
(The different colors here are just to visually break out the quads). Using two pixel shaders, one for the longer segments and another for their intersection (the purple quad), I am rendering this as a single color:
I would like to outline this shape, something like the following (please excuse my Paint skills):
My first approach was to write a pixel shader that would calculate the distance along the y-axis (before the transform) from the center of the quad and colorize based on that. However, when I render this, there is a problem where the quads overlap:
What is the best way to achieve my desired result? Is this possible with a texture and a clever use of blending, perhaps? What about somehow stenciling the non-outline areas?
I should mention that my outlines need to be thicker than one pixel, and that I'm working in DirectX 9 with shader model 4 level 9.1, and C++.