Convert sprite to pc.texture

Hi, I’m looking at google without luck, about convert sprites to pc.texture type, I explain the purpose,
I have a spritesheet of images, more than 50 images (in only two images as spritesheets), so all works perfect to use over elements, but the problem is also I need to use them over an animated 3d object, so I need to put it as the mesh material diffuseMap, but diffuseMap not work with sprites types, only textures, so I’m looking for a way to create a texture using the sprite as source, but don’t found any info…

can someone help me with this?

thanks!

Are you doing this at runtime or in the Editor?

The texture atlas has a private API to get the texture (https://github.com/playcanvas/engine/blob/dev/src/scene/texture-atlas.js#L61) and the sprite is just a reference to a region the atlas

You won’t be able to directly go from sprite → texture. You would effectively use the texture atlas and somehow change the UV position and offset on the material to match the frame information on the sprite.