• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By RoKabium Games
      While looking out for that pesky Terrator, our little alien is doing a bit of relaxed mining down on the new gas planet "Lelantos" this weekend.... 
      #gamedev #indiedev #madewithunity #screenshotsaturday
    • By vividgamer
      I have a native iOS game (objective c, XCode build) which I am considering to port to other platforms.
      Core gameplay is based on solely on geographical maps, and custom drawing over maps. It also has Core Data. This part is complete in development.
      What is not done yet is: monetization, gamification (leaderboards, challenges) and multiplayer functionality.
      As I think more about it, I am tempted to think if this is the right time to move to a cross platform tool such as Unity. But before dedicating time to port my 5 years side-project effort in Objective C, I really want to know if its worth it.
      - Does Unity support such plugins / assets that will fulfill all my above requirements?
      - Unity Personal seems to have only 20 concurrent users - is it too costly scaling if I decide for extending to web and android platforms?
      - What is the general workflow involved in publishing to iOS, Android, PC, and web platforms while using Unity? I mean to ask about various points of signing stuff, paying fees and getting certified.
      - How long will it really take to port my entire Objective C project into Unity? I am somewhat familiar with C# but I am finding it hard fidgeting with Unity IDE as lot of things are focused around FPS and 3D while my game is still 2d - not much action involved. I seem bit overwhelmed by the list of features I see there. All in all, I do not want to lose my momentum while still making sure its portable to everywhere.
      - Any assets I could use (for free to try basis in debug) that are relevant for my game?
      - Last but not the least, are there any costs that I need to be paying upfront to Unity, for using it (apart from their monthly subscription model)? I don't understand their costing for multiplayer in conjunction with their subscription fees - if someone could kindly elaborate.
      Thanks in advance for your time reading a newbie
    • By GytisDev
      me and few friends are developing simple city building game with unity for a school project, think something like Banished but much simpler. I was tasked to create the path-finding for the game so I mostly followed this tutorial series up to episode 5. Then we created simple working system for cutting trees. The problem is that the path-finding is working like 90% of the time, then it get stuck randomly then there's clearly a way to the objective (tree). I tried looking for some pattern when it happens but can't find anything. So basically I need any tips for how I should approach this problem.
      Use this image to visualize the problem.
    • By aymen
      please any know how can i' calculate the centroid from any number vertices
    • By Henry Fernandez
      Good day sir/maam. I am developing a game for my thesis and im done with multiplayer and plan to start the implementation of AI but i dont know how/where to start. Please give an advice. I am developing it in C# using UNITY. 
      Im am now collected all pieces that has possible moves but i am stuck on which best move to select. I hope you will help me. This is link explained the game https://en.wikipedia.org/wiki/Game_of_the_Generals 

  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Exporting MAYA skinning mesh and boneoffset matrix problems

This topic is 2938 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've gone though almost all the tutors on web like RobTheBloke and florian.loitsch's gpExport. And I already sucessfully export a static mesh and render it in my engine. But I still failed to render an exported skinned mesh. I had the exp about render a .X file animation so I know the formula for skinning: vertex pos = vertexbindpos * boneoffset * jointworldtranform * bindweight I tried to extract the boneoffset like the following (a mix of RobTheBloke and gpExport and Chad Vernon's cvxport) but I got a distorted result and hope someone can tell me where the problem is.
BoneIT it = g_Bones.begin();
for( ; it != g_Bones.end(); ++it ){
	MFnTransform fnX(bone.path);

	//---------------------Get BindPoseMatrix using the function in gpExport---------------------
	MFnIkJoint joint(bone.path.node());
	MMatrix bindPoseMatrix = getBindPoseMatrix(joint);
	bindPoseMatrix = bindPoseMatrix.inverse();

	//---------------------Get Joint's Transform matrix---------------------
	MMatrix mat = fnX.transformation().asMatrix();
		MStatus s = bone.path.pop();
		if(s == MS::kSuccess){
			MFnTransform fnXP(bone.path.node());
			mat *= fnXP.transformationMatrix();
		else break;
	mat = mat.inverse();
	MMatrix boneoffset = bindPoseMatrix * mat;

But obviously this is not boneoffset, what I saw were all pure rotations, its weird that there's no translation, and the rotations are incorrect either. I just wonder that the joint's transform matrix, Using while(true) to accumulate the transform of all its ancestors. Actually I modified it(Chad's cvxporter in python) to C++, but I'm not sure if I've done it in a correct way. The bindpose matrix I used that from gpExport http://florian.loitsch.com/gpExport/index-4.html#Extraction It's like
MMatrix getBindPoseMatrix(MFnIkJoint joint)
    // get bindPose-plug on joint
    MPlug tempBindPosePlug = joint.findPlug("bindPose");

    MPlugArray mapConnections;
    tempBindPosePlug.connectedTo(mapConnections, false, true);

    if (mapConnections.length() != 1)
        //cout << "returning currentMatrix" << endl;
        // certainly not the most correct way of dealing with the problem...
        return joint.transformation().asMatrix();

    // find the other end. actually we shouldn't call it "bindPosePlug",
    // but worldTransformPlug (as that's where it enters).

    // theoretically someone could bind the bindPose to other nodes,
    // than the bindPose-node. in this case there's a problem.
    MPlug bindPosePlug = mapConnections[0];

    // this node should be a "dagPose"-node (in case you want to look it
    // up in the help)
    MFnDependencyNode bindPoseNode(bindPosePlug.node());

    // and as such, has the "xformMatrix"-attribute.
    MObject xformMatrixAttribute = bindPoseNode.attribute("xformMatrix");

    MPlug localTransformPlug(bindPosePlug.node(), xformMatrixAttribute);
    // xformMatrix is an array. to get our localmatrix we need to select
    // the same index, as our bindPosePlug (logicalIndex()).
    localTransformPlug.selectAncestorLogicalIndex(bindPosePlug.logicalIndex(), xformMatrixAttribute);

    MObject localMatrixObject;
    // extract the matrix out of the object.
    return MFnMatrixData(localMatrixObject).matrix();

BTW, I'm confused about the transforms in MAYA, http://www.gamedev.net/community/forums/topic.asp?topic_id=517946 And I've tried Rotation = RO * R * JO That's Rotation = Rotate Orient * Rotation * Joint Orient
BoneIT it = g_Bones.begin();
for( ; it != g_Bones.end(); ++it ){
	MMatrix test;
	MQuaternion JO(0,0,0,1);
	MQuaternion RO(0,0,0,1);
	MQuaternion Rcomb;
	MMatrix RcombMat;

	// Rotation

	if( fnX.object().hasFn(MFn::kJoint) )
		// Joint Orientation
		MFnIkJoint fnJ(fnX.object());
	// Rotate Orientation
	RO = fnX.rotateOrientation(MSpace::kObject);

	// Test Rotate = [RO] * [R] * [JO]
	RcombMat = RO.asMatrix() * R.asMatrix();
	RcombMat = RcombMat * JO.asMatrix();
	Rcomb = RcombMat;

	MVector trans = fnX.translation(MSpace::kTransform);
	// Test Transform = [S] * [RO] * [R] * [JO] * [IS] * [T]
	MMatrix translationMat; translationMat.setToIdentity();
	translationMat(3,0) = trans.x;
	translationMat(3,1) = trans.y;
	translationMat(3,2) = trans.z;

	test = RcombMat * translationMat;

I think this should be the jointworldtranform that transform the origin to joint position, but it's not, I was wrong. Really hope someone can help me. I've spent a lot time on it but still can't work out. Any idea is appreciated. [Edited by - Quaid Tseng on March 4, 2010 7:44:22 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement