object matrix exportation



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 13:24, xxxxxxxx wrote:

    i am trying to export the objects so called "world matrix" for further usage in .. let's say .. direct 3d (or any other 3d api). hope now it's clear. =)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 13:30, xxxxxxxx wrote:

    You just want the matrix? and you need it in the same format? in that case you just use GetMg(), that is it! but you'll need to make sure you need the same format, left/right-hand coordinate system etc.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 13:33, xxxxxxxx wrote:

    yes. indeed. you got it. i just want the matrix. because all the other stuff is already working. and just getting the matrix with GetMg and passing it thru to d3d does not work. maybe it is indeed a coordinate system problem, i'm not sure, that's why i am asking here.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 13:46, xxxxxxxx wrote:

    Ok, I'm not sure what system D3D uses, but you can easily find out by running a basic test, just place an object in C4D (just one!) at say (100,100,100) and do your export, then see if the object is at the correct position in D3D, if so, it uses the same coordinate system. I -think- D3D is left-handed, and so is C4D, so you should be ok for that bit. Try breaking down the steps, test one object, then one with a single child etc. If you only use GetMg() and do no other matrix maths (don't try and combine mg with ml or anything else, mg -is- the objects world matrix provided the points are all local, when combined it will be fine, the other alternative is to use a unit matrix and change the points, just export them multiplied by mg) then for each object it will be correct.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 13:48, xxxxxxxx wrote:

    already did that. no success.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 14:04, xxxxxxxx wrote:

    does it work for a single object? which parts fail, have you tried just the position, then just rotation, then just scale etc. which one (if any) work and what combinations fail, can you set the values manually in your export (or D3D display?) and then compare with the mg from C4D to see where the difference is, hard to help really since it isn't a c4d problem, more some break down between the c4d matrix, how you export it, and then how it is used :-/ maybe someone with D3D experience will be able to help.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 14:12, xxxxxxxx wrote:

    yes, i did those tests. and they failed all somehow. i started by just applying the translation part to the matrices only ... it looked somehow right translated, but - of course - not properly rotated... then i added the rotation and the translation was wrong ... not to speak about the scaling. it's all a little bit weird with all those matrices ... besides, i am not sure the global matrix that GetMg returns can be used for handling subobjects ... because a subobject matrix has to be relative to all previous parent's matrices. and it is not said to be in the sdk documentation. only the separated Rotation, Scale and Position vectors are said to be relative to the parent object. but that doesn't work either, as said ...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 14:59, xxxxxxxx wrote:

    I have the impression you've misunderstood the GetMg() and GetMl() and hierarchy system :-/ keeping to just one object first, then you don't need to worry about anything else (like subobjects and hierarchy structure), when you apply a translation to the object, just do it say to (100,0,0) [100 along X], and check it? does translation -only- work ok along each axis and all axes combined? (for one object only using GetMg(), not other matrices). If it fails, how do you mean? do you mean you set it to 100 along the x-axis and it moves 100 along Y in D3D?
    As for GetMg() and the hierarchy, it depends on how you then intend on using the objects, if you are keeping the hierarchy structure from C4D then you want to be using GetMl(), that gives you the local matrix for the object, it also depends on D3D, does this use a hierarchy structure where the subobjects are combined with the parent matrix?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 15:09, xxxxxxxx wrote:

    let's discuss this one by email. i have to send you some screen shots. i'm speachless :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 15:28, xxxxxxxx wrote:

    sure :) send them to sdk_support@maxon.net
    I'll be able to get them or if I'm not around (like I have a day off tomorrow :) then dev support will, if you can send some screenshots, maybe example source of the export bit, what you are using it in (your own D3D app?) any import source/display info, we'll try and help out, try anyway!
    Just as a reminder to all plugin coders...
    A good policy to try and keep to when sending info to the sdk_support mail is to supply as much info as possible with source clips and comments if possible, even screenshots if needed, but not too much source (like entire plugins). I know it is hard to balance (experience is the best solution), but if we get too much then it takes ages to sort out and if we don't get enough information, we just have to ask again which delays your answers, and just imagine what would happen if every developer sent entire plugins sources ;-)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/03/2003 at 15:42, xxxxxxxx wrote:

    uhm. eh. well... i tried a little bit more ... and - it's unbelivable - it finally works!
    what i am doing is ..

        
        
        
        
          Matrix ObjectRotation = HPBToMatrix (PolyObj->GetRot ());  
           
          Matrix ObjectScale  = MatrixScale (PolyObj->GetScale ());
        
        
        
        
          Matrix ObjectPosition = MatrixMove (PolyObj->GetPos ());
        
        
        
        
          Matrix ObjectMatrix;
        
        
        
        
          ObjectMatrix = ObjectScale * ObjectMatrix;  
          ObjectMatrix = !ObjectRotation * ObjectMatrix;  
          ObjectMatrix = ObjectPosition * ObjectMatrix;  
        
        
        
        
    

    somehow i noticed that the rotations are going in the opposite direction, so i just invert the rotaion matrix and it's going. the problems with subobjects are gone, too.
    as always .. i helped myself again. but thank you very much for your advice to try even more and WATCH and LOOK :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/03/2003 at 00:15, xxxxxxxx wrote:

    Ok, I'm not quite sure how that can work based on the info you gave ;) you had said it fails even basic translation (single object, no scale, no rotation), which would imply that code above should fail too ;-) also, inverting the rotation matrix is the same as a transpose since it is an orthogonal matrix (transpose is faster too), that suggests the direction of D3D rotations is opposite to the C4D direction... anyway, glad it now works for you :o)


Log in to reply