PianoScoreJP

Sprite sheet maximum size

Recommended Posts

Hello.

 

I have a problem using sprite sheet.

 

I have a sprite sheet which original image size is 6000 x 1080 px.

There is no problem in Chrome browser(v.42.0.2311.135 m) for windows.

However In Android Chrome v42.0.2311.111 (Android OS version is 4.2.2) , sprite images are not shown( shown as black square).

 

I've tried several image size and I found if image size exceed 4096px , problem caused.

 

Json text 

{"frames":{

"a.png":{"frame":{"x":0,"y":0,"w":228,"h":436},"rotated":false,"trimmed":false,"spriteSourceSize":{"x":0,"y":0,"w":228,"h":436},"sourceSize":{"w":228,"h":436}},

"b.png":{"frame":{"x":229,"y":0,"w":228,"h":436},"rotated":false,"trimmed":false,"spriteSourceSize":{"x":0,"y":0,"w":228,"h":436},"sourceSize":{"w":228,"h":436}}
},
"meta":{"image":"test.png","format":"RGBA8888","size":{"w":4097,"h":436},"scale":1}
}

 

 

Please see screenshot.

Windows

post-14442-0-18352500-1430917959.png

 

Android

post-14442-0-54917700-1430918010.png

 

resize original image to 4096 px.

 

Android

post-14442-0-94193300-1430918045.png

There is no problem in 4096px.

 

 

Is this bug or specification ?

Anyone know solution ?

Share this post


Link to post
Share on other sites

Thanks.

How can I know MAX_TEXTURE_SIZE ?

Is It depended on browser or device?

Browser, device, hardware, a lot of factors. I would use that site to find the smallest supported size for your demographic and use that.

Share this post


Link to post
Share on other sites
5 minutes ago, bbyford said:

The site doesnt mention what the measurement is, can i presume its 4096 bytes?

For the MAX_TEXTURE_SIZE it's how many pixels the image can be in width/height.

Share this post


Link to post
Share on other sites
9 minutes ago, Exca said:

For the MAX_TEXTURE_SIZE it's how many pixels the image can be in width/height.

care to elaborate? is that any combination like: 1x4096, 2048x2048 etc? Or the square of 4096 to produce a square factor for width and height?

Edited by bbyford

Share this post


Link to post
Share on other sites

Anything below or equal to MAX * MAX is quaranteed to work (almost always, unless something is wrong with the gpu/driver). Going over either of those (even if decreasing another) might work or might not work.

From the khronos specifciation: "The value gives a rough estimate of the largest texture that the GL can handle. The value must be at least 64. "

Share this post


Link to post
Share on other sites
15 minutes ago, Exca said:

Anything below or equal to MAX * MAX is quaranteed to work (almost always, unless something is wrong with the gpu/driver). Going over either of those (even if decreasing another) might work or might not work.

From the khronos specifciation: "The value gives a rough estimate of the largest texture that the GL can handle. The value must be at least 64. "

Super, thanks!

Share this post


Link to post
Share on other sites

The reality is, everywhere supports 4096x4096. 

But!

If, during your app, a texture is required to be rendered from an atlas not yet in the GPU memory, then a 4096x4096 texture is going to take longer to upload to it, and, in my experience, cause a micro stutter in the app on older mobile devices. So I used 2048x2048. Not quite as efficient as more atlases required.. but texture swapping doesn't effect gameplay.

Now, depending on your app, that may or may not be a problem for you! You might be able to guarantee all base textures are uploaded to GPU using prepare plugin before being used, or you might only be targeting desktop, or might not have many textures so no multi-texture swapping is required.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.