Jump to content

What does it mean in Phaser when you see a full atlas instead of a sub texture?


clark
 Share

Recommended Posts

Has anyone seen a bug when testing a game where you see the full sprite sheet and not a sub texture from it?

In testing on emulation, things are ok, but as soon as I test on a device, I get unexpected results where it seems like an entire atlas is assigned to a texture. I have seen this before in the past when I was trying to tile a texture too. I never seen the tiled texture, I seen the whole atlas.

There are no errors, so just want to see if anyone has experience this and has any advice?

Link to comment
Share on other sites

This happens on WebGL when you try to use part of an atlas in TileSprites. I've not tested thoroughly why it happens, but I can't seem to work out what causes it; just that certain frames in my atlases work, while others don't. It isn't as obvious as the sizes not being powers of two either, as some have suggested.

 

For speed of development in these situations I've just kept any tileable assets separate from my atlas, but really it'd be nice to know absolutely clearly what the requirements are for atlas frames to be used in TileSprites. Anyone? :)

Link to comment
Share on other sites

My example with the tiled sprites is not very clear in my mind but for sure we used atlases. I had one atlas which contained a square texture, and another atlas which was the same but different in size. So roughly one was 62*62 and the other was like 57*57. The latter never worked and I asked the designer to use 64x64 which solved the problem.

But today I am using no tiled sprites and see it on ipad 4. My whole viewport thing is screwed though so it could be anything

Link to comment
Share on other sites

I wouldn't expect a TileSprite to work if using just part of an atlas, so that doesn't surprise me (it might in canvas mode, but I'm pretty sure Pixi can't handle it in WebGL yet).

 

If a normal Sprite displays the entire texture instead of a frame it's because the given image key doesn't have any FrameData associated with it in the cache, or the frame index or name couldn't be found and it has nothing else to default to.

 

There are several things that can cause this, but it's easier to narrow down if more context is available.

Edited by rich
Clarity
Link to comment
Share on other sites

I think I need to get to the bottom of this once and for all and do some serious testing, because I'm sure I've had situations where parts of an atlas have successfully tiled, and other parts from the same atlas have refused to, and both parts have been power of two sized frames. The only thing I can think of is that position on the atlas also has some bearing; which given the dynamic nature of atlases is a bit problematic.

Link to comment
Share on other sites

  • 3 months later...

I am really struggling with this on an ipad hd with ios7 safari. It is the only device currently showing me full atlases. This time it has nothing to do with tiling or webgl. The Json appears to load and the atlas and I get no errors. I messed around with correctly formatting the files and setting the. UTF8 without BOM. Encoding but it's driving me nuts. Lol

It is like the game is simply a loaded atlas. No other visual entities are assigned textures

Link to comment
Share on other sites

Yeah I have experienced this too! If you make 100 circles, and apply a bad sub texture from an Atlas, you will get 100 full atlases as textures.

But in this case, I do not even see that, just a single full atlas.

 

console.log(this.game.cache.getImage(AssetList.ThemeKey()));console.log(this.game.cache.getFrameData(AssetList.ThemeKey(), AssetList.background()));console.log(this.game.cache.getFrameByName(AssetList.ThemeKey(), AssetList.background()));var image: Phaser.Image = this.game.add.image(0, 0, AssetList.ThemeKey(), AssetList.background());  //nothing, empty screen

Those 3 console logs are all successful.  Which is to say that I expect what I see in the console and the data is correct. I see an ImageTag, I see a data list with frames (including background.png) and I see the Frame itself.  But It is not applied to the Image.

Link to comment
Share on other sites

Where I am now, is I have discovered that failure occurs as soon as the Atlas size is above 2048x2048

 

Is this a known thing on Safari? I would have expected a 2012 Ipad to handle upto 4096x4096, at least it did in Starling but now I am thinking there may be limitations in the browser?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...