react-native-skia icon indicating copy to clipboard operation
react-native-skia copied to clipboard

Atlas is not working with large spritesheet

Open kkaplinski opened this issue 11 months ago • 3 comments

Description

Hi! I tried to use quite large image file (16 frames, 8640 × 675) with Atlas component to animate sprites but nothing was rendered. Code is working perfectly fine with less frames (8 frames, 4320 × 675).

UPDATE: I decided to break my animation into few rows. 👍

React Native Skia Version

1.10.2

React Native Version

0.76.6

Using New Architecture

  • [x] Enabled

Steps to Reproduce

Use Atlas component with large image file ( width > 8150px).

Snack, Code Example, Screenshot, or Link to Repository

  const image = useImage(require('test.png'));
  const sprites = useRectBuffer(1, (rect, i) => {
    'worklet';
    const x = width * progress.value;
    rect.setXYWH(x, 0, width, height);
  });

  const transforms = [Skia.RSXform(1, 0, 0, 0)]

  return (
    <Canvas style={{width: '100%', height: '100%'}}>
      <Atlas
        sprites={sprites}
        image={image}
        transforms={transforms}
      />
    </Canvas>
  );

kkaplinski avatar Jan 22 '25 14:01 kkaplinski

Hello! Did you manage to solve the problem?

exzos28 avatar Sep 25 '25 16:09 exzos28

@exzos28 If I remember correctly, I split the animation into several lines to reduce the width of the image.

kkaplinski avatar Sep 27 '25 09:09 kkaplinski

@kkaplinski I also did this. Did you find the information about the limit? I mean, if it's GPU memory limit we need to check it and load different sprite (asset).

exzos28 avatar Sep 27 '25 11:09 exzos28