none
Losing Anti-Aliasing on a Rotated Border when DropShadowEffect Applied

    Question

  • Hello,

    I am seeing something very odd.

    I have a rotated (2 degrees) Border, stroked with a solid color and no fill. I have applied a drop shadow effect. The problem/odd thing is that the border is no longer anti-aliased! It is not smooth. I am using .NET 3.5 SP1 (obviously since I am using an effect and not a BitmapEffect).

    What's weird is that if I go in and change the ShadowDepth in the VS 2008 designer, it all of a sudden anti-aliases the Border, but when I build it, it flashes back to the un-anti-aliased (and ugly) Border in both the running application and the VS 2008 designer.

    What is even weirder is that my fellow developer doesn't see this behavior ... and he has SP1 of .NET 3.5 installed as well. I have installed the latest video drivers on my machine ... and that didn't help at all. I have a 3 monitor setup with an NVIDIA GeForce 7300GT for two monitors and a NVIDIA GeForce 6200 for my third monitor.

    Does anyone have any ideas what is going on here?

    Would love any ideas/thoughts,
    Cory

    p.s.
    Here is the code:
    <Window 
        x:Class="TransformAntiAliasingTest.Window1" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Title="Window1" 
        Width="700" 
        Height="500" 
    > 
        <Grid> 
            <Grid.RowDefinitions> 
                <RowDefinition Height="20" /> 
                <RowDefinition Height="*" /> 
                <RowDefinition Height="20" /> 
            </Grid.RowDefinitions> 
            <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="20" /> 
                <ColumnDefinition Width="*" /> 
                <ColumnDefinition Width="20" /> 
            </Grid.ColumnDefinitions> 
     
            <Border 
                BorderBrush="DarkGreen" 
                BorderThickness="5" 
                Grid.Row="1" 
                Grid.Column="1" 
                CornerRadius="25" 
            > 
                <Border.Effect> 
                    <DropShadowEffect ShadowDepth="25"/> 
                </Border.Effect> 
     
                <Border.LayoutTransform> 
                    <RotateTransform Angle="-2"/> 
                </Border.LayoutTransform> 
            </Border> 
        </Grid> 
    </Window> 




    Monday, September 22, 2008 9:30 PM

Answers

  • Apologies for not seeing this thread earlier, I'm not sure how I missed it.  This isn't a driver issue, it's a bug in the platform that was fixed for the next version.  Some DirectX rendering state wasn't being set correctly, so the rendered output of the Effect could vary between looking aliased and anti-aliased, depending on what else was being rendered in the application.  It's unfortunate that we were unable to fix it before we initially shipped the Effects, but it's a tricky thing to run into since if you render something that is anti-aliased (Button, text, etc) inside the Effect, the state will be set-up correctly.  That's the best workaround until the next version ships, since most common scenarios will use Effects in this manner anyway.  This bug only affects the built-in hardware-accelerated DropShadow- and BlurEffect, not the custom ShaderEffects or any Effect rendering in software.
    Thursday, February 26, 2009 7:12 PM

All replies

  • Anyone? Bueller? Bueller?
    Tuesday, September 23, 2008 2:20 PM
  • Here is a screen shot of the issue:
    http://www.flickr.com/photos/cplotts/2881737199/

    Tuesday, September 23, 2008 3:39 PM
  • I cannot reproduce this issue with my stale integrated video card (Intel(R) 82865G Graphics Controller).
    I've heard that some of the GeForce family video card has problem correctly rendering WPF content, but updating the video driver could mostly solve this problem, could you please check if the newly updated driver is available for the your card?

    Thanks
    Thursday, September 25, 2008 6:55 AM
  • Ok, I have verified that I have the latest drivers from NVIDIA ... and the problem still exists. Both for my GeForce 7300 GT and for my GeForce 6200 cards.

    What is interesting, is that a different fellow developer was able to reproduce the same problem. He has an NVIDIA GeForce 8800 GT with the latest drivers.

    So, it's not just me anymore! <grin>
    • Marked as answer by Cory Plotts Friday, September 26, 2008 7:58 PM
    • Unmarked as answer by Cory Plotts Thursday, February 26, 2009 7:44 PM
    Thursday, September 25, 2008 7:52 PM
  • An update ... we've found that disabling hardware acceleration causes thing to work right ...
    [HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics]
    "DisableHWAcceleration"=dword:00000001
    Unfortunately, of course, that isn't a solution ... just confirmation that something is wrong ... and likely with the NVIDIA drivers.
    • Marked as answer by Cory Plotts Friday, September 26, 2008 7:58 PM
    • Unmarked as answer by Cory Plotts Thursday, February 26, 2009 7:44 PM
    Thursday, September 25, 2008 8:28 PM
  • Now that we have confirmed that this is likely an issue with the NVIDIA drivers ... what's the process here for getting someone to fix it? Do we need to contact NVIDIA?

    I would assume that you guys (Microsoft) would be bringing it to their attention. Is that a good assumption or no?
    Friday, September 26, 2008 7:56 PM
  • Apologies for not seeing this thread earlier, I'm not sure how I missed it.  This isn't a driver issue, it's a bug in the platform that was fixed for the next version.  Some DirectX rendering state wasn't being set correctly, so the rendered output of the Effect could vary between looking aliased and anti-aliased, depending on what else was being rendered in the application.  It's unfortunate that we were unable to fix it before we initially shipped the Effects, but it's a tricky thing to run into since if you render something that is anti-aliased (Button, text, etc) inside the Effect, the state will be set-up correctly.  That's the best workaround until the next version ships, since most common scenarios will use Effects in this manner anyway.  This bug only affects the built-in hardware-accelerated DropShadow- and BlurEffect, not the custom ShaderEffects or any Effect rendering in software.
    Thursday, February 26, 2009 7:12 PM
  • Thanks for your reply, Brendan! It's nice to see that it will be fixed in the next version.
    Thursday, February 26, 2009 7:32 PM