Crow model Blender file with rig and flying 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!
User avatar
juho
Posts: 238
Joined: Mon Feb 27, 2012 1:18 pm

Crow model Blender file with rig and flying animation

Post by juho »

I did a really quick rig and animation to the crow in blender. It's not the best (I did it during lunch brake), but it's a good star for someone to take it a bit further.

Use it any way you like. Grab the .blend file and textures here: https://dl.dropboxusercontent.com/u/111 ... g_crow.zip

The rig is really simple. I did couple of the main controllers as shapes to spot them more easily. Animation is a flying loop in action editor. I don't think the crow can fold it's wings properly with this rig.

If you use the crow, please post it somewhere in these forums.

Image
Follow me on Twitter: @JuhoMakingStuff
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Crow model Blender file with rig and flying animation

Post by Isaac »

Very nice; and very cool. 8-)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Crow model Blender file with rig and flying animation

Post by akroma222 »

Thankyou Juho! :D
User avatar
THOM
Posts: 1266
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Crow model Blender file with rig and flying animation

Post by THOM »

Can someone help me?

I could load the file into blender and tried then to export it. The file was created but it seems to be broken somehow. When I load it into GMT the program crashes badly and when I try to use it in a mod the loading fails also and Grimrock says:

Code: Select all

[string "model.lua"]:0: D3DError - CreateVertexBuffer() failed: D3DERR_INVALIDCALL
What happens here?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Crow model Blender file with rig and flying animation

Post by Skuggasveinn »

THOM wrote: Wed Nov 18, 2020 7:28 pm Can someone help me?

I could load the file into blender and tried then to export it. The file was created but it seems to be broken somehow. When I load it into GMT the program crashes badly and when I try to use it in a mod the loading fails also and Grimrock says:

Code: Select all

[string "model.lua"]:0: D3DError - CreateVertexBuffer() failed: D3DERR_INVALIDCALL
What happens here?
The original file seems to be unavailable in the link above, I could have a look if you get me the original file.

kind regards.
Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
User avatar
THOM
Posts: 1266
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Crow model Blender file with rig and flying animation

Post by THOM »

Thanks for your response. I've sent you the file via Skype.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Crow model Blender file with rig and flying animation

Post by Skuggasveinn »

So :D

To say I'm having trouble getting this into the game correctly would be an understatement, this is one crazy bird.

There is nothing wrong the blender file per se, the export script just expects things to be in a certain way, and if they aren't, all kinds of weirdness happens.

Problem one: The hierarchy of the model is not what the script expects.
We need a game_matrix node, RootNode and a local_srt, also in this model the mesh is parented to the rig, in all the LoG2 animated models I have seen the mesh is parented to the local_srt node. After setting up the hierarchy the model exports but I got the same error you got when trying it in game or with the GMT.

Problem two: The model has custom shapes for some of the bones, very handy for animating the crow, but I don't know how the script reacts to it, so I changed the bones to standard again. The model DIDN'T export, I got a new error :D that pointed towards tangent space errors for the faces.

Problem three: The model has a mix of triangles and quads (tangent space error), the script wasn't handling it. This was an easy fix with the blender build in command to triangulate the faces. The model exports but AGAIN the same "D3DERR_INVALIDCALL" as from start.

Problem four: The bones have active modifiers on them (copy rotation, constrains etc). None of the model from the asset pack have them, and they are really not needed once you have baked the animation. So I removed all the modifiers from the bones. That massed up the animation, the crow was turkey on crack, time to take a step back.

Problem five: before removing the modifiers I went over the hierarchy of the bones, the feet have IK (don't know how the script reacts to IK). So I removed the IK from feet and exported, the animation was still on crack and the feet are now inside the bird. Since I removed IK I needed to go over bone parenting for the feet, I did and fixed the feet.

Problem six: When going over the bone hierarchy I saw that sometimes the rotation method for a bone, changed between "XYZ Euler" and "Quaternion WXYZ". So I fired up some models with animations from the asset pack, all bones always have "Quaternion WXYZ" so I changed all the bones of the bird to that. The model exported, but crashed the game, and GMT went into an endless loop that I had to kill from process explorer to get my computer back :?

lets get back to basics.

Lets remove all animation data from the rig, lets remove all the modifiers from the bones and every and all transformation or constrain, lets reset everything to rest pose.
Can I export the model with a rig enabled with no animation, YES, model is fine inside the GMT and the game.

Can I animate the rig myself with a few keyframes and export that animation, YES , but it warps, ok we have a weight issue.

Problem seven: Many game engine have a limit to how many weights can be assigned to vertices, industry standard is 4.
What if I tell blender to limit bone weight to vertices to 4 (console tells my I have affected around 103 vertices !!!!!!)
Model exports and test animation does not deform the mesh, but still something is strange !!.

Problem eight: Can a vertex have the total weight assigned to it, a higher value then one ?, never seen that in any of the models from the asset pack, so lets normalize all the weights to one.
Everything exports, but still the animation is a little off.

So at this point I think lets, copy the poses from the original file into every frame of the clean rig, so I have the correct animation and see how that looks. NO, everything crashes, both the game and GMT :shock: what the effing hell is going on, I just copied the poses from the the original file, this should have worked, but didn't.

Ok, back to clean rig without animation, this is just 25 frames, I can do this by hand having two instances of blender open and simply manually setting every frame like the original file.
Everything exports, but the animation is off :x

The top position extends way behind the blender animation and the lowest wing position doesn't go nearly as low as in the blender animation.
Image
The rig has no constrains, there are no modifiers on the rig, the animation is baked, why is this happening ?, why am I doing this on a Friday ?, why I'm I not drunk somewhere ? (because of social distancing dude) ..... right, lets continue then :D .

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
User avatar
THOM
Posts: 1266
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Crow model Blender file with rig and flying animation

Post by THOM »

Oh my goodness - I hope you are still well. :shock: Never expected such a lot of work...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Crow model Blender file with rig and flying animation

Post by minmay »

I can provide a tiny bit of information for a few of these issues!
Skuggasveinn wrote: Fri Nov 20, 2020 8:55 pmProblem five: before removing the modifiers I went over the hierarchy of the bones, the feet have IK (don't know how the script reacts to IK).
The script doesn't care about your IK settings, you can safely leave IK on.
Skuggasveinn wrote: Fri Nov 20, 2020 8:55 pmProblem seven: Many game engine have a limit to how many weights can be assigned to vertices, industry standard is 4.
Grimrock's model format only has room for 4, yes. If you export a vertex with more than 4 bones assigned to it, the exporter script will discard some of them.
Skuggasveinn wrote: Fri Nov 20, 2020 8:55 pmProblem eight: Can a vertex have the total weight assigned to it, a higher value then one ?, never seen that in any of the models from the asset pack, so lets normalize all the weights to one.
Everything exports, but still the animation is a little off.
Non-normal vertex weights will technically "work" in Grimrock - you won't get any crashes or anything from them - but they behave completely differently from how they behave in Blender, which makes them pretty useless in practice.
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: Crow model Blender file with rig and flying animation

Post by Skuggasveinn »

And we are done :D

https://youtu.be/cexKGzZZceA

Like minmay pointed out, script ignores a lot of things, bone constrains and IK can be kept. What really is needed is to have the hierarchy 100% correct, you need to triangulate the model, remove the custom bone shapes (that messes with the script), you also need to remove the shapes the custom bone shapes are using (or hide them), then bake the animation before exporting anything.

crowcontroller in the game seems to be unfinished as well ,
It is only seen inside the forest.lua object file.
SpoilerShow

Code: Select all

defineObject{
	name = "crow",
	components = {
		{
			class = "Model",
			model = "assets/models/monsters/crow2.fbx",
		},
		{
			class = "CrowController",
		},
		-- {
		-- 	class = "Animation",
		-- 	animations = {
		-- 		idle = "assets/animations/monsters/crow/crow_idle.fbx",
		-- 		peck = "assets/animations/monsters/crow/crow_peck.fbx",
		-- 		fly = "assets/animations/monsters/crow/crow_fly.fbx",
		-- 		glide = "assets/animations/monsters/crow/crow_glide.fbx",
		-- 	},
		-- 	playOnInit = "idle",
		-- 	loop = true,
		-- },
	},
	placement = "floor",
	editorIcon = 252,
	reflectionMode = "never",
}
The idea seems to have been that the idle animation is the crow on the ground, and it alternates between idle and peck, then when the party gets near it takes flight with fly animation and then uses fly and glide when in the air.
The controller does detect the party and gets the model into the air where it roams around, but it never switches between animations, in the video I have already made the crows fly, and there are 2 definition, one with fly (using juho's animation) and another with glide that I did.

After the party has gotten near to the crows and they start flying, they seem to fly around forever, and never land back (or at least I didn't wait long enough and I kept the level running for some time).

But in the air, this looks really good ;)

kind regards.
Steingrímur.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
Post Reply