Hello yaustar, could you give me a tip for creating sprite from a video file which I could add to the spot for kind of beamer/projection effect. Isnt very small classic sprite like an picto, I want to play a sequence using a spot lamp. I rendered the frames into image files. It is 800 images. How to set it?
800 images?! That’s not a good idea, that’s far too many and won’t fit on a sprite sheet. Can you show what kind of animation it is? It may be better to do the animation in code through scaling or some other method.
I created already a spritesheet with all frames…is over 20Mb, looking how to use it in playcanvas, found a script for setting that spreedsheet…but, still not sure
That’s just too large. At best, you can have a 8192 x 8192 sized sprite sheet but not many devices will be able to load that.
If you want device compatibility, then you are looking at best 2048 x 2048 (especially on mobile).
yes, thats true…must cut the video first, thanks.
so I did wonderful spritesheet 2048px with whole animation. it is now 700kb, great yes. Please could you advice me how I set the spot with that? I am just my first day here…
What do you mean by spot? I don’t understand what effect you are going for?
what i am try to do, is kind of light beam with animation, so it looks like a video projection in movie,
and I see in lamp seting (spot), that I can add the sprite there, but isnt finding my file…and also i need some scrypt probaböly to sett the grid
So there’s a couple of ways to do this:
- Does it have to be a light projection? Could you fake it by not having a light at all and just play the animation as a sprite on the wall?
- If it needs to be a light, the spotlight cookie parameter only takes a texture, not a sprite asset. You would have to play around with the cookieOffset and cookieScale to manually progress through the frames. https://developer.playcanvas.com/en/api/pc.LightComponent.html#cookieOffset
it ius necessery that it light
because i need to project on complex topology, not just a plane
Hmm… The scale and offset doesn’t actually do what I thought it should
I can only think of manually switching the textures from one frame to another (so not use a sprite sheet) or dig into the light code to see if you can use just a section of the cookie texture at a time.
do you have example code ?
Nope. Haven’t done it before. Just working off theory.
so, you suggest to make kind of interface/button for switching the texture like it would be a slide-projector? would it work with a spot?
I was thinking of doing it in code.
are you able to code that? would you like to help me to code this? I found this: https://github.com/playcanvas/sprites, it is deprecated. Need some first steps help
I had a quick go and managed to get the video playing in the texture directly: https://playcanv.as/p/4UIh6Riz/
Project here: https://playcanvas.com/project/623407/overview/light-projector
Oh, I am soo glad! Hammer. This is what I was ages looking for! Thank you so much. Thank you so much!