UPDATE:
I don't know if it's the best way to do it, but I implemented a few classes that work just fine. Here is the irrlicht example:
https://mega.co.nz/#!sVNEjIjD!A5OH1ktI5 ... HMMneIzhaA
What I did:
1)Implemented a Billboard that supports using it as a standard Billboard, but it also supports NOT looking at the camera. You can simply set where it looks at by setting the orientation.
2)Implemented a texture animator that can be used like the standard texture animator, and it also can be used with a texture matrix. You can also configure it to play only once instead of looping, and you can restart the animation any time you want.
Known bugs:
* I didn't update the "Serialize" and "deserialize" methods with the extra attributes I added.
The example:
Three Billboards, two of them look at the camera.
One plays a sonic animation every 5 seconds, the others are looping a texture matrix
Original post:
Hello, this is my first post and I have a very basic question. Which one of these methods would you recommend to animate a texture:
1) Use setMaterialTexture on each loop to "update" the texture in IAnimatedMeshSceneNode
(taken from here: http://irrlicht.sourceforge.net/forum/v ... hp?t=29349 )
2) Use TAnimSprite and load only one big texture. then "scroll" through the textures to simulate the animation
(taken from here: http://irrlicht.sourceforge.net/forum// ... f=4&t=6471 )
3) Using a billboard and a texture animator
(taken from here: http://irrlicht.sourceforge.net/forum/v ... reanimator and
http://irrlicht.sourceforge.net/forum/v ... r&start=15 )
You are probably thinking: "ok, but what do YOU want to do?".
I want to have a 2D character on screen, with several animations. Some of them are in the same image, some of them are not.
Extra points: Sometimes I would like to draw one animation on top of the other. Suggestions?
Thanks for reading!
[Solved]Recommended texture animation method?
[Solved]Recommended texture animation method?
Last edited by dc740 on Thu Jan 01, 2015 11:28 pm, edited 1 time in total.
Re: Recommended texture animation method?
Texture atlas/texture array + vertex shader/texture matrix is the most efficient way. But if you only have one such char, it doesn't really matter, use what you prefer.
Re: Recommended texture animation method?
Try out the included 2d graphics tutorial if you have not yet. There is a animation example.
Re: Recommended texture animation method?
AFAIK, the demo and 2D tutorial in irrlicht only covers basic 2D drawing on the screen. What I actually want is a billboard with a texture animator, that doesn't point at the camera all the time (I know it sounds weird), and it's efficient enough to show a lot of "sprites" on the screen simultaneously.
About the texture atlas, the TAnimSprite implementation uses that method, but I'll try to make the texture animator+billboard do the same. I have to use .push_back(texture) for each frame, so now my problem is how to extract the texture from the matrix. I'm still getting used to irrlicht.
So I'll basically re-implement a billboard, but I'll remove the part where it faces to the camera all the time. I could use some help on pushing each texture separately from one big texture matrix
Thank you guys.
About the texture atlas, the TAnimSprite implementation uses that method, but I'll try to make the texture animator+billboard do the same. I have to use .push_back(texture) for each frame, so now my problem is how to extract the texture from the matrix. I'm still getting used to irrlicht.
So I'll basically re-implement a billboard, but I'll remove the part where it faces to the camera all the time. I could use some help on pushing each texture separately from one big texture matrix
Thank you guys.
Re: Recommended texture animation method?
Since I'm just a newbie on these, I ended up trying the TAnimSprite. It does what I need, but could you guys point me to the right direction when it comes to rotating and moving the ISceneNode? (moving it would be the most important)
https://web.archive.org/web/20061012222 ... h_Irrlicht
The original implementation doesn't work with the FPS camera. I move around and the image stays in the same position. It only works partially if I remove all the transformations from the render() method (the rotation and movement stops working)
Any hints?
Thanks!
If you want to try it:
https://mega.co.nz/#!kJN3nayL!xSJ1yj5Wr ... PrbWdRY13I
Place it in irrlicht-1.8.1/examples and open it with Codeblocks. It should be ready to run. Note that I removed the transformations from the render() method
https://web.archive.org/web/20061012222 ... h_Irrlicht
The original implementation doesn't work with the FPS camera. I move around and the image stays in the same position. It only works partially if I remove all the transformations from the render() method (the rotation and movement stops working)
Any hints?
Thanks!
If you want to try it:
https://mega.co.nz/#!kJN3nayL!xSJ1yj5Wr ... PrbWdRY13I
Place it in irrlicht-1.8.1/examples and open it with Codeblocks. It should be ready to run. Note that I removed the transformations from the render() method
Re: [Solved]Recommended texture animation method?
I solved it. I updated the first post with the result. It's the first thing I do with irrlicht, so there might be some errors in the code.