Hello everyone,
I am new to Silverlight and I got a small problem with effects in combination with polygons. I want to achieve that the rendering of the shader is only inside the edges instead of also outside the edges. As you see the brush is doing this, but not the output of the shader. Anybody knows a solution to fix this? Is there a way to get the output of the pixel shader and push that into the fill property of polygon?
Result: http://img64.imageshack.us/img64/2831/achieve.jpg
This is my xaml code:
<Polygon Name="TestPolygonWithEffect" Stroke="Black" StrokeThickness="1">
<Polygon.Points>
<Point X="100" Y="0"></Point>
<Point X="0" Y="200"></Point>
<Point X="200" Y="200"></Point>
</Polygon.Points>
<Polygon.Fill>
<ImageBrush ImageSource="Roof.jpg"></ImageBrush>
</Polygon.Fill>
<Polygon.Effect>
<f:TestShaderEffect>
<f:TestShaderEffect.Overlay>
<ImageBrush ImageSource="OverlayTest.png"></ImageBrush>
</f:TestShaderEffect.Overlay>
</f:TestShaderEffect>
</Polygon.Effect>
</Polygon>
This is my shader in HLSL
sampler2D input : register(s0);
sampler2D overlay : register(s1);
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 returnColor = tex2D(overlay, uv);
if(returnColor.a == 0.0f)
return tex2D(input, uv);
else
return returnColor;
}