Page 2 of 2

Re: Rendering errors for nested objects

Posted: 17 Nov 2017, 18:18
by nokola
Thanks jsantos! Added http://www.noesisengine.com/bugs/view.php?id=1195

It would be interesting to understand why the issue happens with half floats. In my screenshot above, I'd expect even if there are precision errors the color to be gray, since both the top and bottom texture have large enough gray around the edges (~5 pixels minimum)

Re: Rendering errors for nested objects

Posted: 20 Nov 2017, 12:40
by jsantos
Not sure your case is also related to using half-floats. I will send you a patched version for verification purposes.

Re: Rendering errors for nested objects

Posted: 21 Nov 2017, 04:09
by nokola
I noticed the "ghost" lines happen for me when I set Opacity of element to < 1, e.g. when this button transitions to disabled state:
    <Style x:Key="ButtonCircle" TargetType="Button">
        <Setter Property="Width" Value="50"/>
        <Setter Property="MinHeight" Value="50"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid Background="Transparent" x:Name="body">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="border">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0.7"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer">
                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0.3"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Margin="{TemplateBinding Padding}">
                            <ContentControl x:Name="ContentContainer" Content="{TemplateBinding Content}" VerticalAlignment="Top" Margin="9,9,9,0" />
                            <Ellipse x:Name="border" Opacity="0" IsHitTestVisible="False" Height="35" Width="35" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="7.5">
                                <!--Fill="#99FFFFFF"-->
                                <Ellipse.Fill>
                                    <RadialGradientBrush>
                                        <GradientStop Color="#99FFFFFF" Offset="0"/>
                                        <GradientStop Color="#99FFFFFF" Offset="0.94"/>
                                        <GradientStop Offset="1"/>
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
Here's the comparison with Opacity 1 and 0.3:
GhostLineOpacity.png
GhostLineOpacity.png (7.46 KiB) Viewed 2325 times

Re: Rendering errors for nested objects

Posted: 21 Nov 2017, 04:19
by nokola
Just noticed that the ghost lines seem to change based on what UI is elsewhere on the screen. Perhaps the UI is rendered too close in an off-screen texture atlas and "leaks" into adjacent UI? A 1 or 2-pixel transparent border around UI would fix it in such case. Just a guess.

Here' s a screenshot of ghost lines being changed from changing some completely unrelated part of the UI:
GhostLinesChangeWithUI.png
GhostLinesChangeWithUI.png (9.77 KiB) Viewed 2325 times

Re: Rendering errors for nested objects

Posted: 21 Nov 2017, 17:30
by nokola
Confirmed that if I change from having Opacity < 1 to Opacity == 1 and a half-transparent brush instead, the artifacts disappear. Note: can't use in all cases, sometimes I want the opacity to apply (e.g. for dimming out images / full button face)

Re: Rendering errors for nested objects

Posted: 21 Nov 2017, 21:39
by jsantos
It makes sense, because we only use offscreen rendertarget when Opacity < 1. And this bug happens when rendering to offscreen textures, when we are compositing those textures, the rectangles we use to blit are getting incorrect pixels for the borders.

Re: Rendering errors for nested objects

Posted: 23 Nov 2017, 19:46
by nokola
I got the test version with non-half floats - works! No more rendering artifacts here! :)
I suspect textures nearby were "leaking" in the opacity rendertexture that Noesis uses internally with half floats.

Re: Rendering errors for nested objects

Posted: 27 Nov 2017, 22:15
by jsantos
Thanks a lot for the feedback! We are working on the fix

Re: Rendering errors for nested objects

Posted: 30 Dec 2017, 23:12
by nokola
Just checking - did the fix make it in Beta12? I still see artifacts with 2.1 Beta12 - this time immediately at startup of the app.

Re: Rendering errors for nested objects

Posted: 02 Jan 2018, 16:46
by jsantos
No, that fix is not yet integrated. But we plan to have it before the stable release.