How to do an animated painting?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

How to do an animated painting?

Post by thomson »

I'm thinking about creating a dungeon object - a painting, hanging on the wall with animated content (the daemon painted on it would wave his claws, the person eerily looking left and right etc.). What would be the best way to implement such a thing?

One approach that comes to my mind is to create a number (e.g. 20) objects, each representing one animation frame and then quickly create and destroy them in a loop. Of course the "animation" would be running only if the party was close by. The slight problem with that approach is that if the painting is reasonably big, it will require many textures, so the mod would be somewhat bloated. But I think this is unavoidable anyway.

A side problem: I'd like part of the animation would be to make the object brighten and then get darker over time (sort of like glowing and pulsating). How can I do that without additional textures that only vary in brightness?

Any thoughts? Suggestions?
Last edited by thomson on Sun Sep 29, 2013 12:22 pm, edited 1 time in total.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: How to do an animated painting?

Post by Isaac »

There is a minor 'gotcha' with this method, I'll outline at the end, but for starters you would create a Picture frame in your 3D modeler first *.
Then create all of your 2D painting animation frames in a paint program. These can be side by side in a square 'power of two' image. Then create a rectangular plane the width of your painting, but with the height of all of your animation frames stacked end to end. UV map this rectangle so that each animation frame precedes the next one.

In the 3D modeler, position the rectangle centered in the picture frame @ its frame1, and keyframe it; then for every frame of your animation move the object up (or down) one frame at a time until you have the entire strip completed. Play the animation, and it should flip frames perfectly. In Blender you might use 'Constant Interpolation' instead of the default.
Save the objects and animation and import them to John Wordsworth's GMT, and test /tweak its playback speed.

In the editor, create/clone a button, and assign the animation as its pressAnim, and assign it any sound or silence sound effect. In your scripts call the button:push() command to activate the animation.

** To export from Blender: Use the Collada format for the model, and select that it exports the animation. In the GMT import the file with Assimp; switch to the animation tab, and import the same file again using the load animation with Assimp, and you should have it. ;) (Modify and be sure to save it from the animation tab.)

*Gotcha #1: for the upward rectangle method, you would want to make the frame with an inset that puts the painting slightly behind the wall; and ideally you would make a simplified copy of the wall, with a painting sized hole in it. When the animation plays, the frames will scroll behind the wall; with only the one in the picture frame visible.

Alternatively, (and if the animation is short enough), you could make that rectangle into a cylinder, where the animation frame is in front of the wall, and instead of moving the rectangle up & down, you would keyframe a rotation of the cylinder; this would eliminate the need for a custom wall, but the animation would have to be only a few frames duration.

____________
For the brightness effect... It's possible to add a dark lamp in the engine, but it might give better results to just use your paint program to progressively darken (then lighten) the animation frames on the atlas texture. If you line up the frames in order, then in Photoshop [or other] you could make a gradient layer from white to black to white, (and optionally 'posterize' it if you want even tinting), then overlay it on to your animation atlas. That could smoothly darken & lighten your frames.
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: How to do an animated painting?

Post by thomson »

Wow! Thanks a lot. I didn't expect THAT detailed hint. That will absolutely make the whole thing much easier.

I suppose the excuse "I don't how to do that" is no longer applicable, so I have no other choice, but to just implement it. :)
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
Eleven Warrior
Posts: 746
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: How to do an animated painting?

Post by Eleven Warrior »

Wow man this is just awesome...Isaac.. wish I could do that lol Good Job bro..
Grimbold
Posts: 4
Joined: Thu Sep 26, 2013 11:43 am

Re: How to do an animated painting?

Post by Grimbold »

Simpler solution: Blender allows one to use a movie as a texture. I've never tried it before though.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: How to do an animated painting?

Post by Isaac »

Grimbold wrote:Simpler solution: Blender allows one to use a movie as a texture. I've never tried it before though.
It does; it also allows for animated UVs, but I don't think either can be exported and brought into the GMT. Blender does a lot of things you can't use outside of itself. Blender can calculate some pretty fantastic cloth effects too, but I've never been able to use it in LoG (or any other game engine ~except as a static mesh; great for table cloths and chair covers).

It would be really wonderful if LoG2 allowed for animated UVs; but probably not worth the hassle for them to include it. Video textures would be cool to.
Post Reply