Kreout
Topic Author
Posts: 12
Joined: 02 Feb 2014, 15:35

Performance on Android (Unity)

09 Mar 2014, 19:46

Hi, I've just started testing a few gui elements on my Samsung Galaxy Nexus phone.
Now, the first thing I tried was a simple grid divided into 3 columns.
The left column contains a simple border.
Middle column is empty.
Right column contains a border with a gradient background, containing a canvas with 3 simple buttons.

The right border has a storyboard which animates its translatetransform in rendertransform.
My problem is that this animation, which slides the right column into or out of view cubic ease-in-out is pretty choppy on my device.

I find that a bit surprising, since I have so few controls i the tree. In the Unity editor its smooth.
My question is what kind of performance to expect on android. Is there something inherently wrong with animating a rendertransform, or are there other do's and dont's that apply on mobile?

I've tried running with offscreen width and height set to 0 and medium quality, and I've tried both ppap and msaa with no change in performance.

Please advice if theres something I can do to optimize performance.
Right now I get choppier animations than with Daikon-Forge, which is very cpu-heavy when tweening.
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Performance on Android (Unity)

10 Mar 2014, 13:38

Hi,

Maybe you could attach your xaml, so we can analyse its performance here.

I tested the following xaml in a LG Nexus 4 and the animation plays smoothly:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <Storyboard x:Key="AnimBd">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="RenderTransform.X" AutoReverse="True" RepeatBehavior="Forever">
                <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0">
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:4" Value="200">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CubicEase EasingMode="EaseInOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:6" Value="200">
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Grid.Resources>
    <Grid.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource AnimBd}"/>
        </EventTrigger>
    </Grid.Triggers>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Border Background="Yellow"/>
        <Border x:Name="Bd" Grid.Column="2">
            <Border.RenderTransform>
                <TranslateTransform/>
            </Border.RenderTransform>
            <Border.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0" Color="Yellow"/>
                    <GradientStop Offset="1" Color="Orange"/>
                </LinearGradientBrush>
            </Border.Background>
            <Canvas>
                <Button Canvas.Left="10" Canvas.Top="10" Width="200" Height="50" Content="Button 1" FontSize="30"/>
                <Button Canvas.Left="10" Canvas.Top="70" Width="200" Height="50" Content="Button 2" FontSize="30"/>
                <Button Canvas.Left="10" Canvas.Top="130" Width="200" Height="50" Content="Button 3" FontSize="30"/>
            </Canvas>
        </Border>
    </Grid>
</Grid>
Could you test it and tell me how it performs on your device?

Thanks for your feedback.
 
Kreout
Topic Author
Posts: 12
Joined: 02 Feb 2014, 15:35

Re: Performance on Android (Unity)

10 Mar 2014, 20:53

Hi,

Maybe you could attach your xaml, so we can analyse its performance here.

I tested the following xaml in a LG Nexus 4 and the animation plays smoothly:

Could you test it and tell me how it performs on your device?

Thanks for your feedback.
Hi, and thank you!
I tried your example, but it was as choppy as with my own xaml.
BUT, I failed to mention in my first post that I used one of your example scenes as a base, and I therefore had the "RoomScene" prefab in my scene.

Upon disabling that gameobject, it's now silky smooth. Both your xaml and mine.
I hadn't thought about the fact that that prefab might not be mobile-friendly.
But as it turns out, it uses 3 point-lights which incidently killed my device performance-wise.
I changed my quality-settings to 0 pixel-lights, and everything is smooth again even with the prefab.

So, long story short; there's nothing wrong with the performance of Noesis on android, and I'm a bit embarrased that I didn't think about checking everything else before assuming that Noesis was the culprit.

Thank's a lot for always taking your time to respond to these sometimes stupid questions :)

PS. Can I trust the Unity profiler when testing the performance of Noesis? Since the number of drawcalls isn't reported in the stats-window when in play-mode, are there more things going on under the hood that won't show in the profiler? When profiling my device, I now get a total rendering-time of about 2ms per frame which is great, but I just wonder if those metrics are accurate? DS
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Performance on Android (Unity)

11 Mar 2014, 19:07

So, long story short; there's nothing wrong with the performance of Noesis on android, and I'm a bit embarrased that I didn't think about checking everything else before assuming that Noesis was the culprit.

Thank's a lot for always taking your time to respond to these sometimes stupid questions :)
They are not stupid questions. We should probably change that scene by a simpler one to avoid these problems in the future. Thanks a lot for the feedback.
PS. Can I trust the Unity profiler when testing the performance of Noesis? Since the number of drawcalls isn't reported in the stats-window when in play-mode, are there more things going on under the hood that won't show in the profiler? When profiling my device, I now get a total rendering-time of about 2ms per frame which is great, but I just wonder if those metrics are accurate? DS
Number of drawcalls are not properly reported by Unity because we are a native plugin that sends directly commands to the GPU. We have that information, in fact you can analyze it in the XamlPlayer, and in future versions we will find a way to show it in Unity.

Total rendering-time instead is accurate because Unity profiles the time it takes to execute all gpu commands, including native plugins.
 
Kreout
Topic Author
Posts: 12
Joined: 02 Feb 2014, 15:35

Re: Performance on Android (Unity)

11 Mar 2014, 21:05

Thats great!

Who is online

Users browsing this forum: Google [Bot] and 0 guests