MWRender Refactoring

Everything about development and the OpenMW source code.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini » 19 Nov 2011, 09:26

I thought we had this problem before once.
Not that I remember. Can you get a stack backtrace so we know at least where it is crashing?

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

Re: MWRender Refactoring

Post by jhooks1 » 19 Nov 2011, 23:30

Sweet, found a fix that works.

EDIT: Committed.
Found another bug, if you try to visit a cell that you have already visited previously, openmw will crash.

EDIT2: Fixed bug mentioned in edit. @Zini, It may be time for a merge into master, but I think you should do some testing too.

User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini » 20 Nov 2011, 11:02

We will not be merging the mwrender branch into master at this time, because it loses essential functionality (NPC rendering). Instead when it is done, I will create from it a new animation branch and add animation scripting instructions to this branch. You can then create your own animation branch from it and implement the animation. Once that is done we can merge into master.

We are still missing some RenderingManager functions (removeObject, setPhysicsDebugging, getPhysicsDebugging).

I will try to do some tests either later today or on Monday. With a bit of luck, I will also find the time to do the animation script instructions and write up some guidelines for the animation implementation, so that you can start to integrate your animation work early next week.

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

Re: MWRender Refactoring

Post by jhooks1 » 20 Nov 2011, 13:21

For Animation work I see it as 3 steps:

1) Update the NIFLoader, BSAArchive and many of the Nif related records.

The NIFLoader will contain 3 maps with filenames for keys. One will contain shape data (including original vertices, normals, bone weights, bone sequence data, morphing data, etc). Another will contain animation transforms (rotations and corresponding times, translations and corresponding times, etc). The last contains the time indices (start, stop, loop start, loop stop) which will most likely not be utilized until we implement AI. NIFLoader's code could roughly double.

Many core functions of the NIFLoader will need to be updated. There are many new functions that need to be added - including one for adding npc parts that are not bound to a single bone, and one used to mirror/scale parts. Not all the functions from the animation branch will be added - some are redundant/no longer used.

2) Render creatures and NPCs
For creatures this is simple - just insertMesh() with the filename.

For npcs it is a lot more complex - we have to go through the npc's inventory and bind armor and clothing parts based on different priorities (e.g. if the character has a robe and a cuirass, the robe takes priority and is shown). For the body parts that are not covered by clothes/armor, obviously the correct skin body part needs to be bound.

All the npc's parts are connected to a base animation skeleton nif file, base_anim.nif for regular npcs and base_animkna.nif for beast. There are a few other npc animation files for a few very short animations (argonian swim - 1 second long, female - 11 seconds, dancing girl). At this time I only have interaction with the previous two mentioned, and I think this is sufficient for now.

3) Implementing animation

I have two helper functions for this - handleAnimationTransform() and handleShapes(). Both npcs and creatures make use of these functions, in the animation branch these functions are used from within the engine file in frameStarted(). Obviously this is going to change - these functions will be utilized instead in mwrender/creatures and mwrender/npcs

User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini » 21 Nov 2011, 13:06

Finally done. Didn't compile at first and needed quite a bit of clean up.

There are several areas that will need further improvements. But we can do that as a part of other tasks the are related to these areas. That is work for another day and for another release. I think I speak for all, if I say we are profoundly sick of doing mwrender work.

For future reference, these are the areas that still need improvements:

- Player: The whole player implementation (world model and rendering) is still a mess. We will address this as part of the player controls task.

- Ambient: The ambient settings are not properly handled yet. We will address this as part of the sky manager rework.

- Object movement: Too many problems to list them all. Not sure when to address this, but since we don't move anything but the player right now, there is no hurry.

- Enabling/disabling: I missed that the original enabling/disabling concept was flawed when redesigning mwrender. This is a new task and I will address it later. Maybe even in 0.13, which would mean we will have a small regression in 0.12. But since this feature wasn't used anyway, nobody should notice.

@jhooks: I will start now to prepare the animation branch. While I am at it, could you have a look at our naming policies and code layout rules in the wiki again? We aren't exactly picky about these, but in some cases your code diverged very strongly from these guidelines.

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

Re: MWRender Refactoring

Post by jhooks1 » 21 Nov 2011, 20:16

Okay, I will adjust the code to the naming policy.

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

Re: MWRender Refactoring

Post by jhooks1 » 22 Nov 2011, 06:57

I need some clarification on the functions that I still need to add. setPhysicsDebugging() - pass in MWRender::Debugging as an argument? getPhysicsDebugging - return MWRender::Debugging?

What needs to be called in removeObject()?

User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: MWRender Refactoring

Post by Zini » 22 Nov 2011, 09:39

I need some clarification on the functions that I still need to add. setPhysicsDebugging() - pass in MWRender::Debugging as an argument? getPhysicsDebugging - return MWRender::Debugging?

What needs to be called in removeObject()?
I have taken care of all that already in my last mwrender commit. You can start with the animation now.

Post Reply