HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Unwanted repeated / not-cleared rendering of elements in Noesis

30 Nov 2021, 12:02

Hi,

I've been having trouble with my Noesis-based GUI where my object icons repeat/tile weirdly. (Ignore top left object icon; I have some accidentally defaulting to (0,0) coords)

Image

I'm not sure, but it seems to be linked to the list on the left (which matches the number of icons/objects represented) being longer than the control can show. I thought of this when in another thread on the forums here, someone suggested that issues driven by xaml and elements like this was due to clipping not working? When I null out that list but keep the icons, it seems to work.

Image

When it is going wrong, it looks fine in Renderdoc (from my limited experience with the tool):

Image

I stripped out the rest of my rendering to isolate it. But at this point I've tinkered with it so much I'm not sure! My initial integration was clearly not right, and was mostly trial-and-error.
const float localGameTimeSecs = world.gameTime_;
UpdateGUI(localGameTimeSecs); // IView::Update(localGameTimeSecs);

RenderGUIOffscreen(); // IView::GetRenderer()::UpdateRenderTree(), then IView::GetRenderer()::RenderOffscreen()

glBindFramebuffer(GL_FRAMEBUFFER, 0);
glViewport(0, 0, 1920, 1080);

glClearColor(0.0f, 0.0f, 0.25f, 0.0f);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

RenderGUI(); // IView::GetRenderer()::Render();

glfwSwapBuffers((GLFWwindow*)window_->GetNativeWindow());
glfwPollEvents();
Any tips on what to look at?

Thanks!
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

30 Nov 2021, 12:09

Any tips on what to look at?
It seems to be an integration issue. Can you isolate the problem in a XAML? If that's possible then you can test that XAML with XamlPlayer and if everything is correct (it should) then you can take a RenderDoc capture to compare against yours.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

30 Nov 2021, 12:14

Could it be that you are not clearing the background before rendering the UI, so you are seeing the icons from the previous frames?
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

30 Nov 2021, 12:17

I believe this to be the only rendering code active right now. Am using the GLDevice from the framework as well.

The important point I missed from the first post is that it doesn't happen all the time - just certain angles/positions. Not sure if that's due to overlapping icons, clipping being weird, or what.
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

30 Nov 2021, 12:21

Just noticed it seems to be when the object icons overlap with the element on the left.

https://i.gyazo.com/1ebd59fdee8ae539619 ... 8bfff6.mp4

EDIT: The xaml for this main UI. You'll see the "ship list" mentioned towards the bottom (that's the left panel)
<UserControl x:Class="rtg.Views.GameView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:rtg"
        xmlns:controls="clr-namespace:rtg.Controls"
        xmlns:viewModels="clr-namespace:rtg.ViewModels"
        mc:Ignorable="d"
        Height="1080" Width="1920" Background="Transparent">
    <Grid>
        <!-- Ship Icons -->
        <ItemsControl ItemsSource="{Binding Entities}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <controls:SpaceObjectIcon RouteOnClicked="{Binding DataContext.ObjectSelected, ElementName=ShipListItemControl}"
					                          RouteOnDoubleClicked="{Binding DataContext.ObjectFocused, ElementName=ShipListItemControl}"
					></controls:SpaceObjectIcon>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemContainerStyle>
                <Style TargetType="{x:Type ContentPresenter}">
                    <Setter Property="controls:CenteredCanvas.X" Value="{Binding [UIPosComponent].ScreenPosX}"/>
                    <Setter Property="controls:CenteredCanvas.Y" Value="{Binding [UIPosComponent].ScreenPosY}"/>
                </Style>
            </ItemsControl.ItemContainerStyle>
        </ItemsControl>
        <Border x:Name="TopBorder" HorizontalAlignment="Center" Height="84" VerticalAlignment="Top" Width="222" CornerRadius="3" Margin="0,10,0,0" Background="#FF6A6767">
            <Grid x:Name="TopGrid" Margin="0,5,0,0">
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="190">
                    <!-- <TextBlock Text="Hardcoded"/> -->
                    <TextBlock Text="{Binding WorldName, FallbackValue=Sol}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="White" FontSize="16"/>
                    <Grid x:Name="TimeGrid" Margin="0,5,0,10" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="27*"/>
                            <ColumnDefinition Width="23*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock x:Name="TimeText" Text="Time:" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" TextAlignment="Center" Margin="5,0,5,0" Foreground="White"/>
                        <TextBlock x:Name="TimeValueText" Text="{Binding WorldTime, FallbackValue=5.5, StringFormat={}{0:#,0.0}s}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" TextAlignment="Center" Grid.Column="1" RenderTransformOrigin="0.763,0.546" Margin="5,0,5,0" Foreground="White"/>
                    </Grid>
                    <Grid x:Name="TimeButtonGrid" HorizontalAlignment="Stretch" Margin="5,0,5,5">
                        <!-- <Grid.ColumnDefinitions> -->
                        <!-- <ColumnDefinition Width="5*"/> -->
                        <!-- <ColumnDefinition Width="5*"/> -->
                        <!-- <ColumnDefinition Width="5*"/> -->
                        <!-- <ColumnDefinition Width="5*"/> -->
                        <!-- </Grid.ColumnDefinitions> -->
                        <!-- <Button x:Name="PauseButton" Content="&gt;" Grid.Column="1" Margin="2,0,2,0" Width="30"/> -->
                        <!-- <Button x:Name="PlayButton" Content="&gt;&gt;" Grid.Column="2" Margin="2,0,2,0" Width="30"/> -->
                        <!-- <Button x:Name="FastButton" Content="&gt;&gt;&gt;" Grid.Column="3" Margin="2,0,2,0" Width="30"/> -->
                        <!-- <Button x:Name="FastestButton" Content="=" Grid.IsSharedSizeScope="True" Margin="2,0,2,0" Width="30"/> -->
                    </Grid>
                </StackPanel>
            </Grid>
        </Border>
        <Border x:Name="ShipListBorder" HorizontalAlignment="Left" Height="686" VerticalAlignment="Top" Width="285" CornerRadius="5" Margin="10,115,0,0" Background="#FF6A6767">
            <Grid x:Name="ShipListGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <!-- Vertical list of ships in our fleet -->
                <ItemsControl x:Name="ShipListItemControl" ItemsSource="{Binding Entities}" Margin="5,0,5,0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Grid.RowSpan="2" Grid.Row="1">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Vertical"></StackPanel>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <controls:ShipListEntryView RouteOnClicked="{Binding DataContext.ObjectSelected, ElementName=ShipListItemControl}"
                                                        RouteOnDoubleClicked="{Binding DataContext.ObjectFocused, ElementName=ShipListItemControl}"
                            ></controls:ShipListEntryView>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <TextBlock Text="FLEET" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontWeight="Bold" Foreground="#FFCDCCCC" FontSize="28" TextAlignment="Center" Margin="0,10,0,5"/>
            </Grid>
        </Border>
        <Border x:Name="BottomBorder" BorderBrush="Black" HorizontalAlignment="Center" Margin="0,906,0,10" Width="1331" Background="#FF6A6767" CornerRadius="5,5,5,5">
            <StackPanel>
                <TextBlock Text="PLACEHOLDER" TextWrapping="Wrap" FontWeight="Bold" Foreground="#FFCDCCCC" FontSize="28" Width="283" TextAlignment="Center" Height="37"/>
                <StackPanel Height="100" Orientation="Horizontal"/>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
I remember similar issues happened when trying to implement the now-commented-out section you see there. It really didn't like that! Possibly same/similar integration issue.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

02 Dec 2021, 03:19

EDIT: The xaml for this main UI. You'll see the "ship list" mentioned towards the bottom (that's the left panel)
There are many errors if I view it with XamlPlayer. Could you please clean it and attach a version that works in XamlPlayer? That's the best way to discover what's going on.
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

03 Dec 2021, 15:55

EDIT: The xaml for this main UI. You'll see the "ship list" mentioned towards the bottom (that's the left panel)
There are many errors if I view it with XamlPlayer. Could you please clean it and attach a version that works in XamlPlayer? That's the best way to discover what's going on.
Sure; I posted that more hoping that I was doing something obviously dumb.

I'm not quite sure how best to reproduce this; with all the view models and multiple different xamls. I guess combine into one xaml (can the player load more, if so where from?) and add pre-existing data to the ItemsControl? Since I have no collection to bind to in the XamlPlayer. Unless I have misunderstood how it works.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

06 Dec 2021, 15:11

For the XamlPlayer, you can only use a single XAML and no data-binding nor x:Class. I was assuming this was easy to reproduce just by copying the values of the elements and putting everything simplified in a XAML. If that's not possible then I can have a look at the renderdoc. We are in the middle of releasing 3.1.2 so I am not sure the priority I can give to this.
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

29 Dec 2021, 03:51

For the XamlPlayer, you can only use a single XAML and no data-binding nor x:Class. I was assuming this was easy to reproduce just by copying the values of the elements and putting everything simplified in a XAML. If that's not possible then I can have a look at the renderdoc. We are in the middle of releasing 3.1.2 so I am not sure the priority I can give to this.
Hey jsantos,

I've uploaded a renderdoc capture of the issue.

I thought I had somehow fixed it, but no. The issue triggered in this capture when the object icons intersect with the element at the top of the screen, again perhaps suggesting some kind of clipping issue?

I'll work around the issue for now - it's the holidays after all! Merry Christmas.
 
HateDread
Topic Author
Posts: 71
Joined: 06 Feb 2020, 10:27

Re: Unwanted repeated / not-cleared rendering of elements in Noesis

03 Jan 2022, 16:15

Thinking about this further, there's a commonality here.

The first screenshots I showed, the issue with the ship icons repeating occurred when an icon was overlapping with the control on the left, but only if that ItemsControl was over-filled. In the capture I added, I can reproduce the issue now that I added some elements to the panel at the top, which caused them to be clipped - icons overlapping with that cause the issue.

Here is a close-up of the new elements added to the top of the screen that triggered the issue in the Renderdoc capture. This is from Renderdoc itself, where everything looks okay (in-game there are 10s of these icons stacked on top of each other). You can see the buttons at the bottom and the text at the top clipping off.

Image

Border clipping oversized contents + my ship icons overlapping it = rendering artifact / repeating ship icons.

Who is online

Users browsing this forum: Google [Bot], vinick and 64 guests