Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - habitoti

Pages: [1] 2
1
Support / Removing a platform for standalone desktop builds
« on: January 17, 2015, 07:36:29 pm »
Hi,

I have made a lot of efforts to arrange my textures in 2x and 4x atlases (lots!) for the mobile targets. Now I am doing a standalone build for desktops (PC/MAC/LINUX) and would actually just need the 4x since there are no issues for a PC in dealing with the larger textures. To reduce the app size I want to only deploy the 4x platform atlasses, but for obvious reasons I can't delete the 2x atlasses from the project.  Is there any easy way to "switch them off" for just this output channel? Since they are not within a resource folder, I suppose tk2d decides to take them and put them into the build, so mabye there is an easy way to have it suppress this for desktop builds.

Thanks, habitoti

2
Showcase / Café International, classic boardgame adaptation
« on: October 15, 2014, 07:22:55 am »
Hi,

having developed a native iOS version first, I started to port Café International to Unity, heavily using Toolkit 2D.
An Android version is now released (Google PlayStore, Amazon Store).





3
Support / Issue with Font-Collection
« on: March 07, 2014, 07:34:00 pm »
Hi,

I've put all my fonts into font collections for platform support. I found an issue here: I have a very small font (just some monospaced digits and extra characters for table listings). They are perfectly ok in the source, but some digits are ultimately cut off at the bottom in the final atlas. Further more, there are some tiny artefacts showing up in between. Please see the marked sections in the atlas.

Source font graphics from bmglyph:


Generated font collection atlas with tiny artefacts and cut-offs:


Collection padding is set to Default. Haven't seen such artefacts before, maybe onyl introduced with the latest beta? I recreated the fonts today with the latest version from yesterday installed...

Regards, habitoti

4
Support / The fifth way of looking up platform assets ;-)
« on: March 04, 2014, 07:52:11 am »
Hi,

I would like to suggest a fifth way of looking up graphics assets for platform support. I am actually using it, so maybe it's useful for others (and if you take it into standard coding, I wouldn't have to carry it over on each update ;-).

I have hundreds of assets organized in atlasses. I don't like to put them flat into a single folder, so I have quite a big and deep subfolder structure. For platform support, I don't want to clutter that with additional lowres files, but rather have other folders with the complete same hierarchy next the to it, carrying the lower resolutions still organized in the same deep hierarchy. So my structure for the native platform looks something like this:

Code: [Select]
Assets/Graphics/4x/fld1/fld2/asset1.png
Assets/Graphics/4x/fld1/fld2/asset2.png
Assets/Graphics/4x/fld3/asset4.png
...
   

For 2x I simply use PhotoResizer from Mac Appstore that can generate hundreds of arbitrarily scaled versions in seconds, retaining the complete hierarchy. So I create this for scaled down assets:

Code: [Select]
Assets/Graphics/2x/fld1/fld2/asset1.png
Assets/Graphics/2x/fld1/fld2/asset2.png
Assets/Graphics/2x/fld3/asset4.png
...
   

Then my fifth way of looking up simply selects the proper full hierarchy for the given platform (and it will not harm any previously existing lookup principles, since they would be found first for proper setups):

Code: [Select]
// Fifth path: assume that source graphics are in a structure that has a root of /nx/ (n: 1,2,4)
// this will be replaced by desired platform. This way you can structure all artwork in arbitrary
// folder structures below that root
if (platformTexture.Length == 0) {
// locate current platform
string altDirectory = directory.Replace("/4x/", "/" + platformName + "/");
altDirectory = altDirectory.Replace("/2x/", "/" + platformName + "/");
altDirectory = altDirectory.Replace("/1x/", "/" + platformName + "/");
if (System.IO.Directory.Exists(altDirectory)) {
platformTexture = FindFileInPath(altDirectory, filename, ext, extensions);
}
}

So if you think this would be useful for others, just pick that piece of code and add it to the existing 4 ways of looking up platform assets. It works in either "direction", no matter what your source platform is.

Regards, habitoti

5
Support / Setting (and using) correct platform
« on: March 04, 2014, 06:11:13 am »
Hi,

I am trying to get along your platform support docs (and all the threads here around it). I am failing already early, because setting the platform support in code does not work correctly for me. I set it in a specific setup script really early in the startup phase (backed by an explicit early script execution order) like this: tk2dSystem.CurrentPlatform = "2x";
I added a log to your currentPlatform getter, and it is already correctly set to "2x" the first time it is being requested at all. However, at runtime the affected sprites are still pointing to the 4x atlasses. If I set it manually in tk2d Prefs, however, they correctly point to the 2x atlas.
I assume I missed one important additional step -- I simply don't know which...

Thanks, habitoti

6
Support / Issue in creating platform support?
« on: March 04, 2014, 06:02:54 am »
If I haven't overlooked something, I might have found two issues with platform support (I am cautious in my wording, since I sometimes fail to get the whole -- huge -- picture in the first place  ;) )

I start off with a 4x platform, then introduce a 2x later on (anchor calculations are no issue here for me...). Two things happen (which I can workaround manually, so no _big_ deal, but maybe not so nice...)

  • If max size of atlas is set to current size of 4x, I get "Assets do not fit in atlas" error and 2x isn't created on commit. Only if I make it larger than actual current 4x atlas, it works (and of course ends up smaller). So I have e.g. a 2048x2048 4x atlas, max size set to 2048. Only if I set max to 4096, also the 2x is created (at 1024x1024)
  • If I use two materials on the original source platform, this won't be replicated into the new 4x and 2x platform. To better distinguish them, I renamed the original "atlas0 material" and "atlas0 material 1" into "transparent material" and "solid material" because otherwise you had no clue in the selection dropdown which one is which. The new 4x and 2x platform folders will contain only one "atlas0 material". As soon as I introduce manually a second one and rename those again, the initial assignements to individual assets will be immediately correct again.


Regards, habitoti

7
Support / Platform support only for multiples of 2?
« on: March 03, 2014, 04:05:54 pm »
Hi,

is there any technical (tk2d internal) reason top only have platform support in multiples of 2 (as the platform support creation process suggests), or can I switch to arbitrary source resolutions?
Reasoning: coming from iOS, I have all artwork as hires sources made for 2048x1536 iPad Retina resolution. For Android, lots of devices out there still have 1280 x <something>, and just a few phones have <= 1024 x <something>. So for the latter, it would be less worthwhile to create the 2x of 1024 (vs 4x/2048) platform, but creating a "native" 1280-based set of atlasses would be very much of a useful additional effort.

Thanks for clarification,
    habitoti

8
Support / Mystical thin black line around sprite
« on: February 15, 2014, 08:55:10 am »
Hi,

I have a square sprite with a dark grey underground. It appears correctly in the atlas (Pic 1), but when put on screen as a sprite, it gets an annoying 1px black line around it (Pic 2). No compression has been applied (yet), so any clue how to avoid such artifacts? I already added a 2px padding in the atlas, but that didn't help...

EDIT: happens as soon as I use an RGB texture w/o alpha for the texture, even if I use the full 24 bits. The line disappears as soon as I add an alpha layer (however I don't want this specific texture to need alpha, since I want to compress it ultimately with a non-alpha compression...)

EDIT 2: I am using dicing now for these sprites, and the artifacts are gone, even w/o alpha channel (and ETC compression works great on that now!). Only when using the sprite in a whole they show up. So no prob any longer for me, I just have it diced and am happy...but maybe you can anyhow explain that effect (for future generations ;-)

 

Thanks, habitoti

9
Support / Atlas Compression
« on: February 09, 2014, 04:48:15 pm »
Hi,

a Unity texture can be compressed by a variety of formats (especially ETC for Android, see below). Is there a reason that it's rather limited for the TK2D Atlas when set to "Unity Texture"? I might be completely misled, but from what I read, at least for Android it's strongly recommended to use ETC.

I can change the compression to ETC2 once I created an atlas with uncompressed unity texture setting, but on every new commit it is then switched back to truecolor. It would be great if I could choose that compression upfront already, or if there would be a configurable postprocessing step to apply the desired compression to it.

Regards, habitoti


10
Support / 2.4B1: Sprites sometimes not displaying in Editor
« on: January 29, 2014, 07:41:00 am »
Hi,

after having installed 2.4B1, sprites are sometimes simply not displayed in Editor. Only when I run the game, everything is fine again (also then back in editor -- but just for some time. Coming back from Mono, and they are gone again). I just see the big background sprite, which is not atlas based, so it's seems something to be wrong with the atlasses now.
When I move a sprite further down the Z-axis, it shows up as a pink box. In it's regular position (all the same z and just layer sorted) it doesn't show up at all.

Regards, habitoti

11
Support / Anchor outside of Sprite
« on: January 07, 2014, 08:51:52 am »
Hi,

is there any technical reason for a custom anchor being constrained to the sprite boundaries? It would be great if it could be moved also to the outside…

Regards, habitoti

12
Support / Disabling a UIButton
« on: January 03, 2014, 12:10:06 pm »
Hi,

I hope this is not a completely stupid question because maybe I just oversaw something obvious (again ;-):
How do I "officially" disable a custom button? I have a button type with my own button behavior (actually mostly copied from the tk2d toggle button). I use the event settings from the tk2dUIItem piece of the button (because I like the inspector), and this always fires that click event, even if I disable that component (from within my button behavior component). Looking into the code, there is no OnDisable implemented in tk2dUIItem to take out the onClick (etc.) events (like it is the case for the behavior components like Toggle Button etc.). So how can I make it ignore clicks for a controlled period?
Another option would be to hanlde the click myself in my behavior component, but I haven't found out how to use your nice SendMessage inspector in editor ;-) Would that be possible at all easily?

Thanks, habitoti

13
Hi,

I just created a blog post on a simple LeanTween extension that makes alpha and scale tweening on tk2dSprites slick and easy. Maybe it's helpful for others as well…

Regards, habitoti

14
Support / Extra transparent border in atlas?
« on: December 08, 2013, 03:03:29 pm »
Hi,

one great feature I used to use with TexturePacker on iOS in the past was the ability to configure an additional transparent border (2-3px) around sprites of the atlas w/o having to explicitly add it to the artwork itself. This was completely transparent to the usage of sprites otherwise, but it allowed for perfect antialiasing of sprite borders on rotation.
With tk2d now, the sprite borders can get very ugly when rotating sprites. Wouldn't that be a great feature for tk2d as well to introduce such a feature for the atlas?

Best, habitoti

15
Support / Lifetime of self created sprite?
« on: November 30, 2013, 03:49:56 pm »
Hi,

I am just in the process of creating my own scene transition manager. I know there are a lot around using GUI textures, but I wanted to try my own using only toolkit 2D features, with a 1x1 black px scaled sprite that overlays the screen and will be tweened over the alpha. This all works great for the fade-out, the new scene is loaded, but then the GO-child of the TransitionManager singleton holding the black sprite no longer has the generated sprite on board. The GO itself is not destroyed on load, and I have no clue why the sprite isn't surviving the loading. This is how I set up the TransitionManager singleton:

Code: [Select]
         // create a black overlay for the whole screen
Texture2D fadeTexture = new Texture2D(1,1);
fadeTexture.SetPixel(0, 0, Color.black);
fadeTexture.Apply();

_fadeGO = tk2dSprite.CreateFromTexture(fadeTexture, tk2dSpriteCollectionSize.ForTk2dCamera(tk2dCamera.Instance),
new Rect(0,0,1,1), new Vector2(0.5f, 0.5f) );
_fadeGO.name = "Fader";
_fadeGO.transform.parent = transform;
_fadeGO.renderer.sortingLayerName = "Effects";
_fadeSprite = _fadeGO.GetComponent<tk2dSprite>();
_fadeSprite.scale = new Vector2(tk2dCamera.Instance.ScreenExtents.width/_fadeSprite.CurrentSprite.GetUntrimmedBounds().size.x,
                                tk2dCamera.Instance.ScreenExtents.height/_fadeSprite.CurrentSprite.GetUntrimmedBounds().size.y);
_fadeGO.SetActive(false);

DontDestroyOnLoad(this);

Is the tk2dUIManager somehow cleaning up sprites?

This is how it looks before the screen transition:


And this is the state after the new scene has been loaded:


Anything else that I need to do to save my little sprite over to the other side?

Thanks, habitoti

Pages: [1] 2