custom animation

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

custom animation

Post by bongobeat »

Hello there,

I'm looking for someone experienced, who can make an animation for some big banners?
Those which are marked with the red color.
SpoilerShow
Image
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: custom animation

Post by Skuggasveinn »

Hi.

If you still need this then I can have a go at it. (just pm me the file).

I've recently had some success with baking Blender wind simulations into an armature and apply it to LoG models.
The process is far from perfect and cleaning up the simulation modifiers so that both model and animation will export correctly is a manual nightmare because the empties that need to correspond with every bone need to be added in afterwards. But the outcome is oddly satisfying.

Here is a demo where I'm changing between 3 sets of animations (idle, breeze and windy) with crossfading between them, the outcome did surprise me.

https://www.youtube.com/watch?v=ZSQAFyk ... e=youtu.be

instead of a button one can of course use timers and other triggers to active then wind change, even switch randomly between the flags to make it less uniform, but I did not take it all the way. Just wanted to see if it could be done.

Kind regards.
Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: custom animation

Post by minmay »

Skuggasveinn wrote: Sun Mar 31, 2019 4:26 amThe process is far from perfect and cleaning up the simulation modifiers so that both model and animation will export correctly is a manual nightmare because the empties that need to correspond with every bone need to be added in afterwards.
I can probably write a Blender plugin to do that automatically, if you describe your workflow in a little more detail.

edit: to add the empties automatically, not do the whole thing automatically!
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: custom animation

Post by Skuggasveinn »

Any help here would be greatly appreciated.
The workflow is as follows.

I set up the scene (game matrix, rootnode, local_srt)
I bring in the model and make the cloth part a seperate object.
I add cloth simulation to it and add wind force to the scene.

I then create the armature (I don’t bind it to the flag yet), I then use constraints to bind the armature to specific vertices of the flag object. This is all done so that the wind simulation moves cloth, and the vertices of the cloth in turn move the armature since it is constrained to it.

At this point I play around with the wind simulation, I don’t want randomness to the wind strength or its location since I need to find a loop. This happens around 200 to 400 frames into the simulation. Here I keyframe the armature.

At this point I have an armature that loops like a semi realistic wind.
I clean the scene, remove the wind and cloth modifiers and even the model.
I bring in the model again of the banner and align it with the armature.

Here starts the Grimrock part.
I create vertex groups that correspond with the names of the bones from the armature. If I play the animation the vertex groups move alone with the bone. At this point I wish I could just save the model and animation with bitcpy script, but it’s missing the empties.

Image

I added the empties to the bone location and named them the same as the bones. This allowed me to export without errors both the model and the animation. At first I thought this was working (I was wrong).
Image

In game the object was working, the animation was playing onInit and everything seemed ok. If I moved out of the update range the animation freezes on the current frame and resumes when entering the update range again.

The error is when the object spawns outside the update range, or if the player has never moved into the update range to trigger onInit play Then it’s all messed up.
Image

I imported the model file back into Blender and it was all messed up, (it was correct in edit mode and pose).
Image
At first I thought it was because I had not exported the model in rest mode, but it seems not to matter if you choose rest or pose mode during export.
Image

I later found out that “rest” mode of the model seems to be derived from the empties, all the bones take the rotation values of the empties, but are corrected when the animation starts to play. So here I need to find the rotation values of the bones, and set those to the empties, any help automatic this would be awesome.
( I have never understood why the empties are needed in the first place, but that's the LoG format I guess).

kind regards.
Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: custom animation

Post by minmay »

yeah, I should be able to make the export make nodes from the bones alone. Might be a couple of weeks before I can work on it, though. Thanks!
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: custom animation

Post by akroma222 »

Very nice indeed! :D
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: custom animation

Post by minmay »

All right, here's my local version of bitcpy's Blender plugin, with three changes:
1. When exporting models, nodes are now generated for the bones based on the actual bones, you don't need to add objects for them anymore. You can export at the point Skuggasveinn (and me) wished for, it doesn't matter whether you have an empty with the name of the bone or not. (If you do, its transform and parent will simply be ignored, the bone's transform and parent take priority).
It still creates the empties when importing models since you need the object hierarchy for non-bone nodes, such as the capsule nodes for monster models. And exporting objects that are not named the same as bones is unchanged, of course.
I haven't tested this very extensively because it's 3 AM here (mostly just tried it by screwing up/deleting random empties on vanilla monster models, exporting them, and checking the results), but it's worked every time so far.

The latter two are just things I'd already done for myself:
2. When exporting animations, nodes that have no keyframes will not be included in the animation. This allows you to make animations more like the vanilla animations, most importantly animations that don't clobber ModelComponent offset and rotation (previously all exported animations would set the location/rotation/scale of RootNode).
3. When importing models, nodes with the empty string as their parent will now import with no parent instead of crashing. Yes, some models with such nodes existed and worked in Grimrock, I ran into this while converting Grimrock 1 asset packs.

Let me know how it breaks :P
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: custom animation

Post by Skuggasveinn »

Image

script is wonderful minmay, so far everything works ;)
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
User avatar
7Soul
Posts: 199
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: custom animation

Post by 7Soul »

Holy balls if I saw that in the game I'd shit my pants
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: custom animation

Post by kelly1111 »

Wwwooooow skuggs. That looks amazing. I really want to find out how to do that?
Is it alot of work to make the ogre move that way in blender?

Any tuturials tips that are easy for animations for beginners you could point to?

I want to make my gelatinous cube monster finally :D

Is there a grimrock monster that is easy too look at animation wise for me to understand rigging ..capsule etc ? .... the slime maybe ?

Cant wait to get home from work
Post Reply