Official MeshMagick thread - now licensed under MIT

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

Tonight I commited MeshMagick 0.6.

The Library-API is completely revamped. There now is a MeshMagick class which serves as a facade to the internals. You can get a tool from it via a getXxxTool() member function.
Details on how to use it can be found in the wiki: http://www.ogre3d.org/wiki/index.php/Me ... _a_library

I only have Windows available right now. I blindly changed build files for CMake, Code::Blocks and autotools too, but they are likely broken. If anyone on these platforms uses MeshMagick I gladly accept patches which will fix them.

@xabila, please try again with the new version. I didn't apply your patch because I chose to do most things differently. But your patch was very useful to see the bug regarding merging multiple meshes in succession with the MergeTool. This is now fixed, thanks.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: [New Tool] Ogre MeshMagick - First official release

Post by syedhs »

I think it would be a nice thing if MeshMagick can be statically linked to Ogre by default. Moving around the tool along with correct Ogremain.dll sometimes can be a hassle :)
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
User avatar
xabila
Goblin
Posts: 225
Joined: Mon Jun 05, 2006 9:40 am
Location: rennes [FR]

Re: [New Tool] Ogre MeshMagick - First official release

Post by xabila »

Ok, so on linux it's OK.

maybe you can add other tools such as optimise and rename on the MeshMagick class too

so gogo windows :(
User avatar
xabila
Goblin
Posts: 225
Joined: Mon Jun 05, 2006 9:40 am
Location: rennes [FR]

Re: [New Tool] Ogre MeshMagick - First official release

Post by xabila »

So now i have 2 link errors on windows ;) the both singleton ;)

simbad say here http://209.85.229.132/search?q=cache:DD ... =firefox-a, that it's a inlining problem, and we must override getSingleton on cpp.

So i did it
But i still get that *ùm^$ link error

Is there any option to stop the inline on visual

Code: Select all

MapEditorTreeView.obj : error LNK2001: symbole externe non résolu "protected: static class meshmagick::OgreEnvironment * Ogre::Singleton<class meshmagick::OgreEnvironment>::ms_Singleton" (?ms_Singleton@?$Singleton@VOgreEnvironment@meshmagick@@@Ogre@@1PAVOgreEnvironment@meshmagick@@A)
MapEditorTreeView.obj : error LNK2001: symbole externe non résolu "protected: static class meshmagick::MeshMagick * Ogre::Singleton<class meshmagick::MeshMagick>::ms_Singleton" (?ms_Singleton@?$Singleton@VMeshMagick@meshmagick@@@Ogre@@1PAVMeshMagick@meshmagick@@A)
..\Runtime\Debug\gose.exe : fatal error LNK1120: 2 externes non résolus
Last edited by xabila on Fri May 29, 2009 2:14 pm, edited 1 time in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by jacmoe »

Those errors are in your own project?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

xabila wrote:So now i have 2 link errors on windows ;) the both singleton ;)
Do you use the API as described in the MeshMagick wiki page and the API docs? Your old way doesn't work anymore. I made it much easier now.
I tested in Windows with a small test program and linking and using MeshMagick as a lib works.
team-pantheon programmer
creators of Rastullahs Lockenpracht
FlorianGeorge
Halfling
Posts: 86
Joined: Tue Sep 01, 2009 7:15 pm
Location: Cologne, Germany
x 4

Re: [New Tool] Ogre MeshMagick - First official release

Post by FlorianGeorge »

First of all, thanks for this tool, it was able to remove/merge double vertices I couldn't remove with Blender.

Second, while the tool is successful at remapping the indexes of the triangles, it seems that it doesn't touch the target vertice indexes of Poses, which of course need attention as well after such an operation.

I added a little remapPoses method, see the attached zip. It currently only affects the optimise operation, but maybe the same method could be used for e.g. the merge operations.
Attachments
MmOptimiseTool.zip
(7.43 KiB) Downloaded 404 times
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

Thank you very much for this Flo81. :)
I am currently heavily involved in my day job (crunchtime :( ) so I cannot take a deeper look at it right now. Next week things should go on at a slower pace and I will review the patch.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
xabila
Goblin
Posts: 225
Joined: Mon Jun 05, 2006 9:40 am
Location: rennes [FR]

Re: [New Tool] Ogre MeshMagick - First official release

Post by xabila »

Just to inform you that i successfully add meshmagick on gose 1.2.
I can give you the diff if you want (just add some _MeshMagickExport and modify the Cmake files).

for gose : http://www.ogre3d.org/forums/viewtopic. ... 08&start=0
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by KungFooMasta »

Thanks for making the tool easier to use as a library! Few comments:

Changes need to be made to make the tool compatible with Ogre HEAD:
http://www.ogre3d.org/forums/viewtopic. ... cy#p322557

Mainly, "std::vector<String> ..." need to become "vector<String>::type ...". (Use Ogre vector)

Secondly, the wiki gives the following example:

Code: Select all

#include <MeshMagick.h>

using namespace meshmagick;

// Call this only after Ogre has been properly initialised.
void scaleMesh(MeshPtr mesh, Vector3 scale)
{
	MeshMagick mm;
	TransformTool* transformTool = mm.getTransformTool();
	transformTool->transform(mesh, Matrix4::getScale(scale), false);
}
Does this code write the mesh to file? Or we need to use 'invoke'? What does the transform API do?
Creator of QuickGUI!
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

xabila wrote:Just to inform you that i successfully add meshmagick on gose 1.2.
I can give you the diff if you want (just add some _MeshMagickExport and modify the Cmake files).

for gose : http://www.ogre3d.org/forums/viewtopic. ... 08&start=0
Thank you for the notice. I gladly accept any patches, just post them here as attachment and I will look at it. If you needed to modify the source to make it work for you, I am all the more curious about the needed changes.


@KungFooMasta, right now meshmagick is compatible with Ogre 1.6, I will convert it too 1.7 when it is officially released, till then everyone is welcome to use your solution.
Does this code write the mesh to file? Or we need to use 'invoke'? What does the transform API do?
No, it will manipulate the Mesh in memory, to write it back you need to call MeshSerializer::exportMesh yourself.
team-pantheon programmer
creators of Rastullahs Lockenpracht
atorkhov
Gnoblar
Posts: 24
Joined: Sat Sep 13, 2008 5:29 pm
Location: Moscow, Russia

Re: [New Tool] Ogre MeshMagick - First official release

Post by atorkhov »

Few problems with build systems:
1. MmStatefulMeshSerializer.h and MmStatefulSkeletonSerializer.h are listed twice in include/Makefile.am
2. In configure.in version still stays 0.5.2
3. Cmake does not properly install libraries on 64-bit system - it installs them to /usr/lib instead of /usr/lib64
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by KungFooMasta »

haffax,

I tried using MeshMagick as a library, to scale a mesh that also has a skeleton, however the resulting mesh is messed up when animating. In my case it is a spider, scaled by Vector3(3.0,3.0,3.0). When it animates the body parts fly around, probably because of the skeleton.

Here is my code:

Code: Select all

		using namespace meshmagick;

		MeshMagick mm(Ogre::LogManager::getSingleton().getDefaultLog());
		TransformTool* transformTool = mm.getTransformTool();
		Ogre::MeshPtr meshPtr = mMesh->mEntity->getMesh();
		transformTool->transform(meshPtr,Ogre::Matrix4::getScale(mBase->_getDerivedScale()));

		Ogre::MeshSerializer ms;
		ms.exportMesh(meshPtr.getPointer(),"./MeshViewer/" + mMesh->getMeshName());

		if(meshPtr->hasSkeleton())
		{
			Ogre::SkeletonPtr skelPtr = meshPtr->getSkeleton();
			transformTool->transform(skelPtr, Ogre::Matrix4::getScale(mBase->_getDerivedScale()));

			Ogre::SkeletonSerializer ss;
			ss.exportSkeleton(skelPtr.getPointer(),"./MeshViewer/" + skelPtr->getName());
		}
In my MeshViewer app I scaled the base node by Vector3(3.0,3.0,3.0) and then tried to serialize the changes to disk.

Here is the model I used:
GiantSpider.zip
GiantSpiderBAD.zip

Any idea what the problem is?
Creator of QuickGUI!
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

@atorkhov, sorry, I seem to have missed your posts. Usually I get an email when someone posts in this thread, either I missed it or it didn't get sent.
I don't have a working Linux system right now. So I will have to do the changes blindly.

@KungFooMasta, you are scaling the skeleton twice.
Signature of the transform function is, maybe a bit of a trap that there is a default parameter:

Code: Select all

void TransformTool::transform(Ogre::MeshPtr mesh, Ogre::Matrix4 transformation, bool followSkeleton = true);
So, does it work, when you leave out the skeleton scaling in your code?


Edit: Come to think of it, I didnt get an email notification for KungFooMasta's post either, even though notification is turned on. :?
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

While we are at it: Blakharaz was kind enough to make MeshMagick compile with Ogre 1.7. It remains compatible with Ogre 1.6.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by Svenstaro »

Getting this:
meshmagick: /tmp/src/ogre/OgreMain/src/OgreLodStrategyManager.cpp:45: static Ogre::LodStrategyManager& Ogre::LodStrategyManager::getSingleton(): Assertion `ms_Singleton' failed.
Aborted
for every meshmagick action, even -version.

I'm running Arch Linux x86_64 and Ogre 1.7 rc1. I compiled https://ogreaddons.svn.sourceforge.net/ ... meshmagick using this build process:

Code: Select all

mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make
make DESTDIR=$pkgdir install
Ogre itself is working fine.

Help much appreciated.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

Very likely due to a recent change in Ogre one of the generated managers expects LodStrategyManager to be instantiated.
Will check this evening.

You can try to instantiate LodStrategyManager in OgreEnvironment class just like those other managers.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

Ok, fix for this problem is in SVN.
It was what I believed it to be. MeshMagick now also instantiates LodStrategyManager and it works.

Change isn't so recent actually but it doesn't matter for using MeshMagick as a lib and that's how I used it with Ogre 1.7 so far.
Building meshmagick in Windows is a bit of a hassle right now due to cmake makefiles and other changes. freetype has to be linked manually in static builds and Ogre cannot be built statically and dynamically at once anymore.

I will have to figure out a way to make building in windows as comfortable as it was with Ogre 1.6.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by Svenstaro »

Ok thanks :)

I don't mind it being a bitch to build in Windows since I merely use AUR's meshmagick-svn package (which appears to be yours or your team's).
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: [New Tool] Ogre MeshMagick - First official release

Post by haffax »

Effective from today MeshMagic is released under the MIT license, just like Ogre.
In other news, Sinbad contributed a new optimisation tool utilizing Tootle. It reorganises face ordering in order to minimize pixel overdraw. For details see this thread.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Official MeshMagick thread - now licensed under MIT

Post by jacmoe »

That is awesome news, Haffax! :D
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Official MeshMagick thread - now licensed under MIT

Post by cyrfer »

I just want to give a big 'thank you' for making MeshMagick. We had some animations in 3DS Max that were in the wrong orientation. I never could figure out how to change the orientation in Max without destroying the skeletal animation. I used the rotate transform tool (2 transform ops on one line, very cool) and I now have what I need. MeshMagick is a life saver when you can't get your regular tools to work the way you want.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Official MeshMagick thread - now licensed under MIT

Post by cyrfer »

Hi,
Again, thanks for making this tool available.

I'm having a problem to rotate a character with skeletal animation. The character starts out seated on the floor (hind end touching floor, knees out in front, feet touching the floor). The animation is for the character to stand up. My export from Max is fine except for the orientation, meaning when the character stands, the feet consistently touch the floor. However, after using the rotate tool in MeshMagick to correct the character for my coordinate system, the pivot point seems to have changed and the feet go through the floor, as if the pelvis was used as the point of rotation.

How can I clamp the rotation so that the feet never go below a specific plane? Thanks!
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Re: Official MeshMagick thread - now licensed under MIT

Post by haffax »

Hi cryfer,

glad you found meshmagick helpful.
Regarding your problem: I don't know why this happens. Rotating a mesh/skeleton should not change the pivot. Rotation is always around the origin of the mesh's local coordinate system, its 0/0/0 position vector.

What orientation did you change, around what of its axes? Where is the meshes pivot supposed to be? In its center, between its feet or elsewhere?
What is the command line you used for rotation?
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: Official MeshMagick thread - now licensed under MIT

Post by xadhoom »

Hi haffax!

Quick comment to the OptionsParser in MeshMagick. Currently it seems that missing manadatory parameter are only recognised when the parameter is provided with an empty value on the command line (according to the condition structure in OptionsParser::parseOptions()). To get generally an exception in case of a missing mandatory parameter I added the following code snippet at the bottom for a final check (sorry no direct patch because its taken from a different project):

Code: Select all

      // now we need to check if all mandatory options are present
      OptionDefinitionSet::const_iterator it = optionDefs.begin();
      while(it != optionDefs.end())
      {
         OptionDefinition optionDef = *it++;
         if(optionDef.isMandatory && !isOptionSet(options, optionDef.name))
            throw std::logic_error("option " + optionDef.name + " expects a parameter");
      }
This leads to correct exceptions in case of any missing parameter on parsing level but considering default values implicitly (this makes the other exception check in this method redundant, too)...

xad
Post Reply