[SOLVED] Animated texture with cookie light


#1

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?


Scripting of the spot lamp for adding a sprite or animated gif
Spritesheets with png or jpg, which is better?
#2

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.


#3

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


#4

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).


#5

yes, thats true…must cut the video first, thanks.


#6

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…


#7

What do you mean by spot? I don’t understand what effect you are going for?


#8

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


#9

So there’s a couple of ways to do this:

  1. 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?
  2. 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

#10

it ius necessery that it light


#11

because i need to project on complex topology, not just a plane


#12

please. look her https://sheenyfile.com/posk-gallery/ fo fake effect, it looks just horrible


#13

Hmm… The scale and offset doesn’t actually do what I thought it should :thinking:

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.


#14

do you have example code ?


#15

Nope. Haven’t done it before. Just working off theory.


#16

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?


#17

I was thinking of doing it in code.


#18

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


#19

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


#20

Oh, I am soo glad! Hammer. This is what I was ages looking for! Thank you so much. Thank you so much! :slight_smile: