User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Subpixel Rounding Question

06 Mar 2019, 18:32

OK, I submitted a sample to #916. FYI -- I collapsed all code (user controls, etc) into a single XAML file. I changed the background to white so that the artifact is more apparent.

Image
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Subpixel Rounding Question

07 Mar 2019, 17:30

I am reproducing the same issue in WPF, that line appears due to imprecision in GPU calculations when doing wrapping. Unfortunately there is no way to disable Tile in one dimension (we could add an extension here for Noesis). A workaround for now is adding a extra vertical white line in the texture. What do you think?

EDIT1: the imprecision is generated by using the Viewbox. I don't see the lines if I remove the Viewbox.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Subpixel Rounding Question

07 Mar 2019, 19:18

More experiments. It seems that our PPAA (emulation of anti-aliasing algorithm) is also affecting. In the latest versions we added the option to selectively disable PPAA:
<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:noesis="clr-namespace:NoesisGUIExtensions"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    Background="White">

  <Grid x:Name="_LayoutRoot">
    <Grid.RowDefinitions>
      <RowDefinition Height="1*" />
      <RowDefinition Height="8*" />
      <RowDefinition Height="1*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="1*" />
      <ColumnDefinition Width="8*" />
      <ColumnDefinition Width="1*" />
    </Grid.ColumnDefinitions>

      <Grid Width="600" Height="480" Grid.Row="1" Grid.Column="1" UseLayoutRounding="True" noesis:Element.PPAAMode="Disabled">
This way it works (without ViewBox). We need to properly document this noesis PPAAMode property.

By the way, there is also another bug in that XAML, you are using Stretch="None" but it should be Stretch="Fill" (that's the reason the original content does not display correctly in Blend), we are ignoring that in this case. I think we need to move this to a new ticket.
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Subpixel Rounding Question

07 Mar 2019, 22:42

I wouldn't be able to add a white line because the default background contains alpha and it overlays 3D Unity content. I could add a semi-transparent line and then offset by margin as a work-around. I disable PPAA by default (having discovered this as a fix). But I can't get around not using a viewbox since target hardware resolution can and does change.
 
User avatar
stonstad
Topic Author
Posts: 241
Joined: 06 Jun 2016, 18:14
Location: Lesser Magellanic Cloud
Contact:

Re: Subpixel Rounding Question

07 Mar 2019, 22:46

Adding to my previous comment -- if I add a semi-transparent line, I likely need to do that for all boundaries of all repeating sprites that require pixel sharp boundaries. But then I wonder if the leftmost pixel will be blended with the rightmost neighbor? i.e. aliasing at pixel (0,0) is possibly affected by pixels at coordinate (N,0).
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Subpixel Rounding Question

08 Mar 2019, 12:05

Yes, that's possible. If you use ViewBox, the imprecision can make the pixels to wrap around in both directions. This is not an issue in Noesis, it also happens in WPF. The ideal solution would be just disabling wrapping in the desired Axis but that's not possible in WPF:

Image

I wonder if we could detect that wrapping is not happening in one of the axis and then disable wrapping in hardware.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Subpixel Rounding Question

18 Mar 2019, 20:09

Could you please report this in a different ticket? This is a different thing from #916 Thanks!

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 13 guests