DrawingBrush as Material

Feb 18, 2012 at 9:19 PM

Hi objo,

I have another question for you, this time it is around an issue I'm having with applying a DrawingBrush as the Material for a Tube.  I'm using the Meshbuilder.AddTube function to create a Tube that is 2000 units in length and has a diameter of 5.0.  I've created a DrawingBrush that has a width of 2000 and a height of Math.PI * 5.0.  The DrawingBrush also includes a small Blue rectangle with a Black border.  I've uploaded a copy of the rendered model here:


As you can see in the screenshot, both sides of the Rectangle are faded and the top and the bottom are not.  I would like the rectangle to display without any fading of any sort.  I have tried using an Ambient light, as well as setting RenderOptions.EdgeMode to Alias, but still can't get it to render without fading.  I noticed that if I make my Tube and my DrawingBrush much smaller in width, the fading is much, much less.

Thanks again for your help.


Feb 21, 2012 at 7:34 PM

Is your texture too wide? And the blue rectangle too small? Which means your left/right edges will be 'smeared away' to invisible? The fading is hard to avoid when using a texture to draw the rectangle. 

But I think you could create a texture with a rectangle that spans from e.g. 0.1 to 0.9 in texture coordinates. Then use texture coordinates 0, 0, 0, 0, 0, 0, 0.1, 0.9, 1, 1, 1, 1... along your pipe. This would probably improve the resolution. If you want the width of the edges to be the same both horizontally and vertically you need to do some calculations.

And if you need to show more than one rectangle maybe the following texture coordinates could work: 0,0,0,0,0,0,0.1,0.9,1,1,1,1,1,0.9,0.1,0,0,0,0,0,0,0.1,0.9,1,1,1,..... 

Sorry if I don't understand the problem properly, a tiny compilable example could help :)

Feb 22, 2012 at 10:44 PM

Hi objo,

I'm remapping the TextureCoordinates to be exactly the same dimensions as the material I'm using, but the behaviour you describe is exactly what I'm seeing.  Here is a small example that illustrates the problem I'm using.  This is using HelixToolkit build 74172.



Mar 10, 2012 at 3:37 PM

thanks for the example project. sorry, I was not able to find a solution to this yet...