If I understand you correctly, then you do not want to see through the rectangles.
In this case I would recommend you to use PlaneVisual3D objects to create a rectangle with a border. To render a rectangle with a border you actually need 3 PlaneVisual3D:
- the biggest will use border material (for example black) - note that for this rectangle both Material and BackMaterial are set so it is visible from above and below.
- then you will also need 2 rectangles that will fill the interior of the rectangle - those two rectangles need to be rendered just slightly over and below the border rectangle to prevent z-fighting artifacts; the Normals for those two rectangles are flipped so one is visible from above and the other from below.
See example:
Code:
<visuals:PlaneVisual3D CenterPosition="-150,49.99,-50" Size="100 100" HeightDirection="0 0 -1" Normal="0 -1 0" Material="White" />
<visuals:PlaneVisual3D CenterPosition="-150,50,-50" Size="110 110" HeightDirection="0 0 -1" Normal="0 1 0" Material="Black" BackMaterial="Black" />
<visuals:PlaneVisual3D CenterPosition="-150,50.01,-50" Size="100 100" HeightDirection="0 0 -1" Normal="0 1 0" Material="White" />
<visuals:PlaneVisual3D CenterPosition="-150,64.99,-50" Size="100 100" HeightDirection="0 0 -1" Normal="0 -1 0" Material="White" />
<visuals:PlaneVisual3D CenterPosition="-150,65,-50" Size="110 110" HeightDirection="0 0 -1" Normal="0 1 0" Material="Black" BackMaterial="Black"/>
<visuals:PlaneVisual3D CenterPosition="-150,65.01,-50" Size="100 100" HeightDirection="0 0 -1" Normal="0 1 0" Material="White" />
It is not possible to use a PlaneVisual3D and a RectangleVisual3D because the LineThickness in RectangleVisual3D is specified in screen space units - so its actual thickness in 3D space varies depending on the distance of the camera.
If you do not want to offset two PlaneVisual3D objects slightly above and below the middle PlaneVisual3D and would like that all objects have the same y position, then you will need to manually construct the MeshGeometry3D for the rectangle border- define the positions and triangles that form the rectangle border. This is a more proper solution but requires much more work and understanding of how 3D objects are defined. If the above solution with 3 PlaneVisual3D works well for you, then there is no need to define the border MeshGeometry3D .