Topic Author
Posts: 1
Joined: 09 Dec 2014, 20:55

Texture Atlas Image Inclusion

09 Dec 2014, 21:42

Our current project uses a texture atlas that is 1600x1600 RGBA 8 bit color that is 9.8 Mb in size.

When we build our compiled resources using the resource.buildtool any that reference the atlas are 22 Mb in size including the texture atlas image itself.

I am extremely new to Noesis GUI but I assume the doubling is due to pre-computed and stored mip-maps.

Regardless, is it expected that each xaml file that references the texture atlas would include the image information in the compiled output?

To verify this was the case, I replaced the texture atlas with a 150 Kb image and saw all the compiled files drop in size accordingly.

Is there a setting or configuration that can used to prevent the duplication of the image data in the individual output files?

Our output Data directory has ballooned to more than 400 Mb and we are concerned as we have many more items to add.

We are currently using the Windows SDK version

Thanks in advance for your help
User avatar
Site Admin
Posts: 3424
Joined: 20 Jan 2012, 17:18

Re: Texture Atlas Image Inclusion

10 Dec 2014, 01:06

Effectively, in v1.1 textures are included inside each XAML that uses it. The solution is having only one XAML referencing the atlas, for example (taken from the Aladdin sample provided inside Samples):
<!-- Created using Noesis XAML exporter for TexturePacker (http://www.texturepacker.com) -->

    <ImageBrush x:Key="aladin01" ImageSource="aladin-atlas.png" Viewbox="145,58,33,54" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin02" ImageSource="aladin-atlas.png" Viewbox="180,58,30,54" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin03" ImageSource="aladin-atlas.png" Viewbox="73,61,27,57" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin04" ImageSource="aladin-atlas.png" Viewbox="39,2,33,57" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin05" ImageSource="aladin-atlas.png" Viewbox="112,2,38,54" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin06" ImageSource="aladin-atlas.png" Viewbox="74,2,36,56" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin07" ImageSource="aladin-atlas.png" Viewbox="152,2,31,54" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin08" ImageSource="aladin-atlas.png" Viewbox="185,2,27,54" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin09" ImageSource="aladin-atlas.png" Viewbox="41,61,30,57" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin10" ImageSource="aladin-atlas.png" Viewbox="2,2,35,58" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin11" ImageSource="aladin-atlas.png" Viewbox="102,60,41,55" ViewboxUnits="Absolute" Stretch="Fill"/>
    <ImageBrush x:Key="aladin12" ImageSource="aladin-atlas.png" Viewbox="2,62,37,57" ViewboxUnits="Absolute" Stretch="Fill"/>

And then, each time you need the atlas, you include the XAML :
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

          <ResourceDictionary Source="atlas.xaml"/>

		<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Center" Margin="5">
		  <Rectangle Fill="{StaticResource aladin08}" Width="27" Height="54"/>
In v1.2 (whose beta is available right now) we changed this a bit and now textures are not included inside preprocessed XAMLs and they are shared properly.
Posts: 11
Joined: 09 Oct 2014, 20:01

Re: Texture Atlas Image Inclusion

11 Dec 2014, 14:09

Is there a way to use compressed atlas textures / sprites?
Or do I have to deal with RGBA images?

Recently we ran out of memory on mobile devices, so dealing with compressed images would be a bit more accurate for older devices..
User avatar
Site Admin
Posts: 3424
Joined: 20 Jan 2012, 17:18

Re: Texture Atlas Image Inclusion

12 Dec 2014, 22:02

Right now, texture compression is only implemented in desktop platforms (GL and DX11 in v1.2). For mobiles, if you are using Unity you can create TextureSources using a Unity Texture2D as explained in this tutorial:

http://www.noesisengine.com/docs/Gui.Co ... orial.html
Grid grid = GetComponent<NoesisGUIPanel>().GetRoot<Grid>();

Texture2D texture = Resources.Load("Noesis") as Texture2D;
TextureSource source = new TextureSource(texture);

Image img = grid.FindName<Image>("img");
Anyway, implementing texture compression for mobiles is in our Roadmap.

Who is online

Users browsing this forum: Bing [Bot] and 1 guest