Followup
| Message |
 |
- Date: 2010-12-26 11:20
- Sender: Dominique Lorre
- I have reproduced the issue with the latest import_3Ds.py, cylinder 1 and cylinder 10 are not correct (scale, position or rotation).
| - Date: 2010-12-26 12:25
- Sender: Ton Roosendaal
- Well; are hierarchies even supported to import? Campbell will know, but he has a short holidays.
| - Date: 2010-12-26 15:15
- Sender: Dominique Lorre
- Cylinder01 and Cylinder10 have incorrect X positions everything else is fine. You can drag the red arrow and they fit in place. There must be a translation parameter somewhere that I have missed.
| - Date: 2010-12-26 16:28
- Sender: Dominique Lorre
- I have found the issue: object->(data)mesh->transform must be zeroed.
| - Date: 2010-12-26 16:49
- Sender: Dominique Lorre
- Median needs to be zeroed. I don't know how to do that in python. Please look at the attached screenshot.
| - Date: 2010-12-30 09:31
- Sender: Lance Mao
- Hi Guys, I think do the following steps will correct this (check out the attachment on my Android phone):
1. Transform each object back to its local space using the inverse of the object matrix. This matrix is read at case MESH_MATRIX: // 0x4160
2. After read the KFrame data and hierarchy. do the following: a. translate object to its pivot point b. rotate&scale it using each frame` s data (ROT_TRACK_TAG, SCL_TRACK_TAG) c. translate object using each frame` s POS_TRACK_TAG step 2 should be applied for each object` s parents also. In Java, it` s like this:
private static void setMatrix() {
for (int i = 0; i < mHierarchy.size(); i++) {
HNode cur = mHierarchy.get(i);
HNode node = cur;
do {
// first translate to pivot point where we will do rotating
cur.getTransform().translate(-node.getPivot(). x,
-node.getPivot(). y, -node.getPivot().z);
// rotate and scale here
cur.getTransform().scale(
(node. mScaleX),
(node. mScaleY),
(node. mScaleZ));
cur.getTransform()
.rotate(node. mRotateAxisX, node.mRotateAxisY,
node. mRotateAxisZ, node.mRotateAngle);
// translate it back
cur.getTransform().translate(node. mHierarchyTransform[12],
node. mHierarchyTransform[13],
node. mHierarchyTransform[14]);
node = node. mParent;
} while (node != null);
}
} and one more trick about our missile is that for some wing it` s mirrored (reflection) which makes the determinant of the local2world matrix negative, so we need to multiply -1 for matrix[0], here is the code after reading local2world matrix:
if (HMatrix.Determinant4f(matrix) < 0){
matrix[0] *= -1;
mesh. mNegDeterminant = true;
} of course, since we are flipping our mesh, the normal should also be flipped. Last thing, I found a very useful project in sourceforge, called assimp. Hope it helps
| - Date: 2010-12-31 11:58
- Sender: Campbell Barton
- This problem is from commit r33155, patch [#24736] from Dominique Lorre (dlorre).
from my tests this patch worked well in some very complicated cases, but probably this is a case where it fails.
I've mailed Dominique about this report, if he doesn't respond Ill take a look.
| - Date: 2010-12-31 12:48
- Sender: Lance Mao
- sorry for one mistake I have made in the previous code, don` t flip the matrix like this:
matrix[0] *= -1; Instead, flip vertex x and normal x. This is how assimp and lib3ds did.
However, we are not done yet. Because when I mirror one object say a teapot in 3ds Max along Z axis. Our flip-x-pos-and-normal approach failed. So, there must be a general approach that can handle all kinds of reflection: X, Y, Z, XY, YZ, ZX
Note that ASSIMP can not display some model exported from Max.
| - Date: 2011-02-01 19:36
- Sender: Andrew McDonald
- I think I've just hit the same problem. I have a Max scene with some objects away from the origin, but whose pivot points are all at the origin. When exported to .3ds and imported into Blender, all the objects appear at the origin.
Is there an ETA on when a fix for this will be committed?
| - Date: 2011-02-07 14:50
- Sender: Dominique Lorre
- Yes, I finally figured out Lance's explanations. The pivot must substracted to the translation part of the invert matrix. I'm trying to figure out the best way to write it in python (not a specialist) but that should be available soon.
| - Date: 2011-02-08 01:02
- Sender: Campbell Barton
- Committed fix by Dominique Lorre, noticed there are still incorrectly rotated objects towards the back of the missile, but think this is a different problem.
closing.
| |
|