Easy Ogre Exporter for 3DSMAX

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

I get a quick look on it, and ran into the same issue ....
But it works well in debug mode... it will not be easy to find out what happen.
Any help on this is welcome. maybe def87 get the point last time ?

very strange since it was working last time I tried this feature :/
OpenSpace 3D Project manager
http://www.openspace3d.com
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

I installed the max sdk and am working out the dependencies and details of building EOE from source. I can see it's part of a larger project of yours? So some things (like tinyxml source files) are missing from the project. I'll try to get a build environment for this project going and solve some issues in my spare time ... I don't absolutely need the feature until later this year :)

Thanks again for a working exporter. Gives me a good entry point into working with the max sdk as well.
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

I got everything building and am able to debug the max plugin during export now. I'm using Max2013 32 bit with VC10 express to debug. It looks like there's a corruption of the stack in ExMesh::exportPosesAnimation when we iterate through the keys of each morph channel:

Code: Select all

for (int ik = 0; ik < ikeys->GetNumKeys(); ik++)
In my case there are 14 keys on my first morph channel. The first call to ikeys->GetNumKeys() says 14. The next call crashes max. For kicks assigned ikeys->GetNumKeys() to an int just before the loop. First iteration its 14 and then bam its 0, so I think something is corrupting the stack. If I use the heap to allocate keys:

Code: Select all

IKey* nkey = new IKey();
ikeys->GetKey(ik, nkey);
Then I can get through ... you can't delete the keys at the end of the iteration though, and even so there's heap corruption later on :( I have no idea what's happening in inside GetKey but it smells fishy. I'll get some more time to poke around soon, I hope :)

Also I should probably move up to Max 2014 ... I simply assumed that because it crashed both that they crashed for the same reason, but that's probably a dangerous assumption.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

I came into the same crash point, and I don't understand what can be corrupted here ...
maybe the Morph3 lib from max sdk have not the same vector type size.
I think that the problem could be found in this lib. (maxsdk\samples\modifiers\morpher)
OpenSpace 3D Project manager
http://www.openspace3d.com
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

arkeon wrote:maybe the Morph3 lib from max sdk have not the same vector type size
Ready for some fresh digging to day. What you say above must surely be the case. We are allocating memory for the interface which must surely be the wrong amount. The interface likely has no bearing on the size of the actual key implementation. I just confirmed this in the max sdk docu:
It is up to the developer to make sure that the IKey* points to a key of the appropriate derived class based on the ClassID() of the controller.
So I'll do some reading and figure out how to get the correct type :)
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

OK so the Class ID coming back from the controller is 0x2007 which is HYBRIDINTERP_FLOAT_CLASS_ID. So, I believe the code should look like this (based on some code I saw in a collada exporter):

Code: Select all

for(int pose = 0; pose < validChan.size(); pose++)
{
	morphChannel* pMorphChannel = validChan[pose];

	//get keys for this pose
	IParamBlock* paramBlock = pMorphChannel->cblock;

	Control *c = paramBlock->GetController(0);
	IKeyControl* ikeys = GetKeyControlInterface(c);
	if(ikeys)
	{
		int numKeys = ikeys->GetNumKeys();
		IBezFloatKey bzfKey;
		for (int ik = 0; ik < numKeys; ik++)
		{
			ikeys->GetKey(ik, &bzfKey);

			if((bzfKey.time >= animRange.Start()) && (bzfKey.time <= animRange.End()))
			{
				animKeys.push_back(bzfKey.time);
			}
		}
	}
}

That appears to work fine, no more stack corruption. Now I crash (for an unrelated reason perhaps?) somewhere in this method ... when I get some more time I'll find out why. I'm using the latest from v1-9 so it might differ from what you are using. I applied the LOD fix from earlier in the thread.

Code: Select all

    // Make sure animation types are up to date first
    m_Mesh->_determineAnimationTypes();
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

EOE 1.95 available :
- export on morpher animation is corrected (thanks to c6burns for your help)
- I've added a frame step on resample animation, from the def87 idea
- it is now compiled with the latest Ogre 1.9
- setup updated


about the morpher animation I've just replaced the Ikey type by IBezFloatKey.
OpenSpace 3D Project manager
http://www.openspace3d.com
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

Rock on, arkeon ( :shock: that rhymed! )

Still crashes for me on this model, but I will get some time in the next few weeks to check out different models and do some additional debugging.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

I made the morpher test with simple models.
can you send me you Max whose crash so I could have a look in it.

Are you sure that every poses have the same number of vertices dans the sames vertices ID ? (even if this should not crash since this is tested)
OpenSpace 3D Project manager
http://www.openspace3d.com
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

I am 100% sure that each morph target has the same amount of vertices. I deleted everything in the stack above morpher and skin modifier before starting to debug. I am not 100% sure that each vertex ID matches ... I don't know what operations would cause this not to ... I guess editing the mesh at the vertex level after creating the morph targets? I don't think that was done, but I did not create this scene myself so I cannot be completely sure.

I will try a few things to make sure I'm not about to waste your time with something trivial. If I'm still stuck I will send you the max file. Thank you for all your assistance :)
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

ok you're welcome :)
OpenSpace 3D Project manager
http://www.openspace3d.com
nickG
Greenskin
Posts: 122
Joined: Fri Jan 20, 2012 6:44 pm
Location: Russia,Moscow
x 1

Re: Easy Ogre Exporter for 3DSMAX

Post by nickG »

how i can export many objects how one object?
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

this is not a feature of EOE, you can attach all your objects into one in 3dsMax.
OpenSpace 3D Project manager
http://www.openspace3d.com
nickG
Greenskin
Posts: 122
Joined: Fri Jan 20, 2012 6:44 pm
Location: Russia,Moscow
x 1

Re: Easy Ogre Exporter for 3DSMAX

Post by nickG »

arkeon wrote:Hi !

this is not a feature of EOE, you can attach all your objects into one in 3dsMax.
yes but not for big meshes(for example crytek sponza)
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Try this,

collapse an object in Edit Mesh or Edit poly, and use attach list, then select all other objects, and match material Ids.
OpenSpace 3D Project manager
http://www.openspace3d.com
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

@c6burn

With Ogre 1.9 it seems that multiple vertex animation types on Mesh are no more allowed ^^
this is why _determineAnimationTypes fail.
here the exception I get on mesh "try to mix vertex animation types, which is not allowed"

Does anybody know if this change was made recently ?
OpenSpace 3D Project manager
http://www.openspace3d.com
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

My mistake ^^
the control to determine if there is a vertex animation must fail and detect a pose animation as a vertex animationsince the object vertices change on time line.

I'll check that to find a better way to determine which animation type should be use.
OpenSpace 3D Project manager
http://www.openspace3d.com
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

EOE 1.96 available :
- export on morpher animation is ok (this time !!)
- setup updated

In fact Ogre mesh do not support Mesh Animation + Poses or Poses Animation
so when a morpher is setted there is no vertex animation exported.
I've also force the mesh at bind pose if it is skinned when exporting vertex animations.
OpenSpace 3D Project manager
http://www.openspace3d.com
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 139

Re: Easy Ogre Exporter for 3DSMAX

Post by c6burns »

Sorry, I just came back to this after some other work. Brilliant job, man! Just exported and it created an animation state for the poses and the skeletal. Playing both produces exactly the result I needed. Can't thank you enough :)
weaklyinteractinwimp
Gnoblar
Posts: 6
Joined: Fri Mar 07, 2014 5:18 am

Re: Easy Ogre Exporter for 3DSMAX

Post by weaklyinteractinwimp »

Hi, i'm trying to export a simple model, just a rectangle, in 3D Studio Max 2013 x64, but i only get a .scene and a material file - there is no mesh file. Looking at the logs, i get a message like "Warning: skipped faces". Could someone please explain why i get that error message? As of this writing i get this error for every model i've tried to export using the plugin.
Thanks in advance.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

hi, this must means that MAX do not return the object faces, maybe that it was a spline before of something like that.
Try to reset Xform the model and collapse before export.
OpenSpace 3D Project manager
http://www.openspace3d.com
weaklyinteractinwimp
Gnoblar
Posts: 6
Joined: Fri Mar 07, 2014 5:18 am

Re: Easy Ogre Exporter for 3DSMAX

Post by weaklyinteractinwimp »

Hi arkeon, thanks for your prompt reply. I tried to reset the Xform just as you suggested but i still cannot get this simple cube to convert :( ...i still get the "skipped faces" warning message, and no .mesh
Anything else you could recommend i try?
Best regards, and thanks in advance.
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

try to convert the model in edit mesh
OpenSpace 3D Project manager
http://www.openspace3d.com
arkeon
Goblin
Posts: 272
Joined: Fri Dec 04, 2009 6:02 pm
x 38

Re: Easy Ogre Exporter for 3DSMAX

Post by arkeon »

Hi !

I've updated the exporter to V 1.97
There was a test on objects number of faces before to export, but in some case it was returning 0 when the object were not supported by the Max IGame interface of the Max SDK.
So i've changed the way to test that from real mesh information and maybe that was your problem.

Download and install the exporter again
OpenSpace 3D Project manager
http://www.openspace3d.com
weaklyinteractinwimp
Gnoblar
Posts: 6
Joined: Fri Mar 07, 2014 5:18 am

Re: Easy Ogre Exporter for 3DSMAX

Post by weaklyinteractinwimp »

Hi arkeon, thanks again for your prompt reply. I installed version 1.97 and now i get a .mesh file. However i cannot open the mesh/model; i also tried this in Ogre Meshy and had the same problem. I tried converting several objects, and even got myself the trial version of 3D Studio Max 2013 64bit and tried converting the built in bmw7 model - but none of these attempts bore fruit sadly.