NPC Animation

Everything about development and the OpenMW source code.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

NPC Animation

Post by jhooks1 » 02 Sep 2011, 22:26

Going to start work on skinned parts for NPCs tonight. The first thing I am going to try is getting a beast tail to bend properly.

User avatar
pvdk
Posts: 523
Joined: 12 Aug 2011, 16:34

Re: NPC Animation

Post by pvdk » 02 Sep 2011, 23:11

Nice! Make sure to make lots of movies of your progress, I love those vids!

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 03 Sep 2011, 21:17

Right now tails do bend a little bit, but not completely right. I suspect that the reason it is not completely right is because we do not have all the vertex weights factored in (see creature animation thread).

Also another problem is if you exit rendering distance of an npc and then come back the tail is not in the right place anymore.

I am going to try hands, chest, and beast feet next.

EDIT: The problem with the tail leaving its place was associated with the ogre Bip01 Animation Positioning, so I have turned that off for now.

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 13 Sep 2011, 22:07

To get skinned npc parts working correcting, I think they actually need to exist inside the base_anim nif instead of being bounded to a bone. I started working on this last night, my approach is to basically copy all the submeshes from each skinned part into the base_anim.

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 15 Sep 2011, 03:35

So far I have tried making a function that adds all submeshes from a part into each NPC entities mesh. It doesn't crash, and ogre is not throwing any error messages, but this method of operating can cause npc's not to be displayed at all. I have realized now that once you add in a submesh for one entities mesh, it goes into all entities using that mesh (they share the same mesh, but not the same objects bound to bone, which is why this worked when an external mesh was bounded to a bone).
I think what we are going to have to end up doing is the following:
1)Load the respective skinned parts, a list of parts will be recorded.
2)Load the base animation nif, add a 4 digit number to the end of the filestring ex ("\\Meshes\\base_anim.nif0001>|"). The number is there to mark it as unique and have it reloaded
3)At the end of loadResource() add in all the respective NiTriShape Copies from the accumulated list from mesh parts (see 1)

To sum it up:
This is going to be a pain in the ass.
Nothing worth committing yet.


EDIT:
Changing or removing an npcs armor/clothes may be a problem if everything is contained inside one mesh. It might not be a problem if you zero out all the respective buffers and destroy the submesh, but I really do not know yet.

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 15 Sep 2011, 18:31

I've thought about this some more. If I just add a 4 digit number to make base_anim unique, I think I can use my existing function that I mentioned before and it might work.

On a related note, we might need to apply a number to make creatures unique too. If 2 or more of the same creature type are in the same cell, the buffers on them would be the same and we would have a problem. Adding the number would fix this.

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 17 Sep 2011, 01:33

OK, I got hand parts to exist inside the actual base_anim. Crossing my fingers hoping everything will work out when I apply animation to it.

EDIT: Bummer, having the unique base_anim introduces a lot more slowdown compared to the previous implementation (previous implementation was 3x faster).

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 17 Sep 2011, 19:12

SUCCESS!!!!! Hands open and close now. Also remember how the hands would disconnect from the forearms? Doesn't happen anymore. Now I just need to apply this same animation method to chest pieces, beast feet, and beast tails. Then I will probably post another video.

Also, now in Beshara I am getting 13fps animating all npcs. That is pretty terrible, we need to find a way to speed this up, and I think it is going to be very hard to do.

User avatar
Star-Demon
Posts: 73
Joined: 11 Aug 2011, 03:17
Location: New York
Contact:

Re: NPC Animation

Post by Star-Demon » 17 Sep 2011, 20:51

Grats on more progress.

We'll probably have to see where our bottlenecks are.
"The scientists of today think deeply instead of clearly. One must be sane to think clearly, but one can think deeply and be quite insane." - Nikola Tesla

jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: NPC Animation

Post by jhooks1 » 19 Sep 2011, 00:46

Added handling of right hand and chest pieces. Robes work now, sort of, at times body parts break through. I will have to try disabling the body parts that are breaking through, I think that will fix it.

Post Reply