COLLADA importer

Return to Panda Features in Development

Postby rdb » Sun Nov 23, 2008 6:53 am

Ah, okay. Are the transforms an EggXfmSAnim also relative to the parent or global, like the vertices?
Currently I'm just copying those from collada without any conversion, but that might explain why my animations look like this. :)

Also, is it possible to apply ColorBlendAttribs per-primitive instead of per-group? Collada stores them in the materials, which are applied per primitive.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby drwr » Sun Nov 23, 2008 2:13 pm

Transforms in an EggXfmSAnim are relative to their parent. Transporter accidents like you're getting are real common when first writing an egg converter, though. I'd start debugging it by converting just the rest pose as a single-frame animation. In the rest pose, the transform in the EggXfmSAnim should exactly match the transform in the joint. If that doesn't come out looking like the model in his rest pose, then it must be that your joint and anim transforms don't exactly match. If it works properly, then try a slightly modified pose (move the arms a bit or something), so that the rest transforms in the joints are no longer exactly the same transforms as in the animation frame, and see what happens.

Sorry, the color blend can only be applied per group. You'll have to subdivide your mesh into collections of polygons with the same color blend applied.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby rdb » Tue Nov 25, 2008 9:57 am

Thanks for the useful advice. However, exporting with the bind pose as anim transform doesn't look much different. I am guessing I did something wrong with the vertex references or so.
Sorry if this is a noob question, but what exactly is this bind-pose matrix? It's a relative transform that transforms the joints to the original position, right?
FCollada provides both a joint transform and an inverse bind-pose matrix, should I somehow transform one with the other or so?
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby drwr » Tue Nov 25, 2008 3:06 pm

The transform that appears in the <Joint> entry is the initial transform of each joint, when the actor has not yet had any animations bound to it. This also defines the transform space of the vertices.

When an animation is playing, this initial transform is replaced with the transform that appears in the current frame of the animation. (There are other animation systems in which the animation modifies the initial rest transform. Not so with Panda; here it completely replaces the initial rest transform.)

Thus, if you correctly export a one-frame animation of the initial rest pose, then it will have the following two properties:
(1) The transform defined within each <Joint> will describe the exact same transform as the one defined in within the corresponding <Table>.
(2) The model with the animation playing on it will look unchanged from the model without the animation playing on it.

If (2) is not the case, then it follows that (1) is also not the case. Therefore, you should take a look at your egg files and convince yourself that they are, indeed, different. (You can compose the components of the transform in the <Table> to compare it to the matrix, of course, or decompose the matrix and compare it to the components, to help you determine what went wrong.) Then you should examine your inputs and see what you need to do to make them be the same.

I don't know what is meant by FCollada's joint transform and inverse bind-pose matrix.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby rdb » Wed Nov 26, 2008 4:15 am

Ah, thanks. I did some more research and found out that collada actually provides three matrices for the joint. One is the initial joint transform, the other is the global skin bind matrix, and a third is the per-joint inverse bind pose matrix.
I also found out that the world-space joint transformation can be calculated through:
Code: Select all
initialWorldspaceJointTransform * bindPoseInverse * skinBindMatrix

How to convert this global transform into joint-space? Sorry, I suck at matrices and transformations.

I found another curiosity though:
http://pro-rsoft.com/screens/goblin-weird.png
As you can see, part of the model does show up -- that leads me to believe that it's actually the vertex influences are wrong.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby drwr » Wed Nov 26, 2008 3:12 pm

Does:
Code: Select all
initialWorldspaceJointTransform * bindPoseInverse * skinBindMatrix

really compute the worldspace joint transform per each frame? Then perhaps:
Code: Select all
initialRelativeJointTransform * bindPoseInverse * skinBindMatrix

computes the relative joint transform per each frame. But it's probably not that easy, because you probably need to account for the transforms that are animating above. So what you really need is:
Code: Select all
currentNetRelativeJointTransform * inverse(currentNetWorldspaceJointTransform) * above calculation

for each frame.

Still, this is all a little beside the point. If the vertices are coming out moved at all with a single-frame animation, it means that the <Joint> transform does not exactly match the <Table> transform. This is true regardless of the vertex influences. Whether the vertex influences are wrong or right, if the transforms exactly match, they won't move from the original rest position--because you're replacing transform A with transform A. Since they are moving, it follows that the transforms don't exactly match.

If Collada insists on giving you worldspace transforms instead of relative transforms, you can hack around that by flattening out the hierarchy and moving every joint to the root of the hierarchy. That makes the relative transform the same thing as the worldspace transform. If that works, then you just need to figure out how to convert worldspace to relative transforms.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby rdb » Wed Nov 26, 2008 3:48 pm

Thanks! I got a step further.
Collada indeed gives the bind-pose matrices in world-space coordinates. But, I found out the actual per-frame animation matrices are in joint-space coordinates! So, I exported one with the matrix of the first frame, and it looks like this:
http://pro-rsoft.com/screens/goblin-frame0.png
Looks like the first frame is set to the bind pose this time or so?

However, the rest of the matrices still don't look right yet:
http://pro-rsoft.com/screens/goblin-weird.avi
But at least they are not as much out of proportion as they were before.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby drwr » Wed Nov 26, 2008 4:24 pm

That's looking better all right!

Hmm, the next step might be to try to export the same thing using a different static pose. If that works properly, then try mixing and matching: apply the animation for pose B onto the model for pose A, and vice-versa. They should apply correctly, and after binding, should move the model from the rest pose to the anim pose you have applied. If that doesn't work, then I think the vertex influences must be wrong.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby rdb » Mon Dec 22, 2008 3:06 am

I didn't entirely figure out the problem yet, but I did add it to CVS. I don't think I broke anything (ppremake will only build it if you have HAVE_FCOLLADA set) but I did make some changes to main files like Global.pp and Package.pp, so let me know if I broke anything.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby SylHar » Thu Jan 15, 2009 4:37 am

Hi pro_rsoft !

I'm currently trying to incorporate your collada importer in our pipeline.
Since I need only basic stuff ( that's it : no animation) I figured it will be ok.
( Fyi I need :
* Scene graph with transforms.
* Basic geometry, including normals, uvcoords, binormals, tangents, etc.
* Multitexturing.
)

Problem: it seems nice on some meshes, but fail on other: by "fail" I mean that the converter work without error, and the egg file seems correct. But once loaded in panda, no polygon are displayed.

After some test, it seems that it fails with meshes created with collada exports plug-in from maya ( maya 2008, colladaMaya v3.05B )

I don't know if it's related to the bug you already speak of ( with group or joint)

I'm still using panda3D 1.5.2, and I'm using the compiled version that you provided here.

I can give you some of the meshes that don't work if you need them

anyway, thank for your work, it will really help us!
User avatar
SylHar
 
Posts: 222
Joined: Wed Feb 06, 2008 12:21 pm
Location: roanne, France

Postby rdb » Thu Jan 15, 2009 9:25 am

I've seen the issue before that parts of the scene were not exported. Can you give me a (preferably small) .dae file that doesn't work? Then I can look into fixing it.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby SylHar » Thu Jan 15, 2009 9:36 am

I'm pm you that immediately
User avatar
SylHar
 
Posts: 222
Joined: Wed Feb 06, 2008 12:21 pm
Location: roanne, France

Postby rdb » Thu Jan 15, 2009 9:37 am

Please email instead. My PM box is full, as usual.

My e-mail address is available through the forum software.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby rdb » Thu Jan 15, 2009 11:00 am

Hmm, I looked at the files, and it's a very weird problem.

Your materials have the transparency set to 1. Meaning, the converter makes it not visible. However, I have other models lying around with a transparency of 0, that are supposed to be visible too. Now I'm confused. :?

To work around, find this part in the resulting .egg file:
Code: Select all
    <Scalar> blend { add }
    <Scalar> blendop-a { one_minus_constant_color }
    <Scalar> blendop-b { constant_color }
    <Scalar> blendr { 1 }
    <Scalar> blendg { 1 }
    <Scalar> blendb { 1 }
    <Scalar> blenda { 1 }

Entirely remove that part.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby SylHar » Thu Jan 15, 2009 11:54 am

Hmm.

This hack work, true.
I've try to change/destroy all the transparent/transparency attribute I could on the dae but with no change on the resulting egg

I hope you can find a solution !

We had trouble with these files ( created by the collada plugins for maya) before :
we can't referenced the node in these files from scene in another file, like we suppose to do ( and like we do with other collada files)
So the problem may be with the exporters plugin, I don't know

good luck !
User avatar
SylHar
 
Posts: 222
Joined: Wed Feb 06, 2008 12:21 pm
Location: roanne, France

Postby rdb » Fri Mar 20, 2009 9:48 am

Actually, the problem was that google tools export stuff with inverted transparency in some modes. I've mainly tested transparency with sketchup models, so I ended up writing it inverting the transparency.
Your model did it the correct way. I've corrected it on CVS, this does break sketchup + googleearth models, but well, that's google's fault.

I didn't fix the skeletal animations problem yet, I'll probably have time for that after I get 1.6 out the door.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby SylHar » Wed Apr 29, 2009 5:59 am

Hi !
with the 1.6.1 I'm retrying to use dae2egg in our pipeline.
I have problem with some meshes that we have created ourself.
dae2egg forgot a lot of triangle and place other incoherently.

but this mesh pass the collada coherency check ( and import in maya correctly using the collada importer)

the dae2egg doesn't display any error. Any idea ?
User avatar
SylHar
 
Posts: 222
Joined: Wed Feb 06, 2008 12:21 pm
Location: roanne, France

Postby rdb » Wed Apr 29, 2009 7:42 am

Can you email me the .dae file? Also maybe a screenshot how it's supposed to look?
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby rdb » Wed Apr 29, 2009 10:35 am

Thanks for the model. It appears there was a bug with handling multiple types of primitives (triangles, tristrips) in the same mesh object.
Will be fixed in 1.6.2. If you want me to export your models for now, let me know.

Thanks for reporting the bug!
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Non-FCollada importer?

Postby whitelynx » Mon Jul 12, 2010 11:54 am

Hey... I haven't seen anything more recent than this mentioning Collada in the forums. I'm wondering whether there has been any work on a non-FCollada importer, since FCollada seems to have been changed to closed-source since 3.05. (according to Feeling Software's site it costs money now)

ThomasEgi mentioned in IRC that you might be working on a non-FCollada importer. Has there been any progress on this? If not, I was thinking that OpenCOLLADA might be a good basis for such a converter.
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby rdb » Mon Jul 12, 2010 2:30 pm

Yeah, we've been developing a whole new loader that is TinyXML-based on the 2.0 branch on CVS. The basic functionality is there already, although it is still far from being finished.

In the meantime, if you want a copy of the MIT-licensed 3.05B source code of FCollada, just send me an e-mail.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby whitelynx » Mon Jul 12, 2010 3:22 pm

I actually just found a copy in an SVN repo somewhere online, and I put together a waf build system for it. (I had also found a zipped version with a Scons build system, but it failed to build and I couldn't fix it) I'm having some issues getting makepanda to recognize it, though.

I have installed it to /usr/local, so the installed files are:
    /usr/local/include/FCollada.h
    /usr/local/include/FColladaPlugin.h
    /usr/local/lib/libFColladaSD.so


However, when I run makepanda with --use-fcollada and --verbose, I get the following output:
Code: Select all
$ python makepanda/makepanda.py --everything --no-ffmpeg --use-fcollada --verbose
Generating library cache...
Couldn't find library libAR
Couldn't find header file AR/ar.h
WARNING: Could not locate thirdparty package artoolkit, excluding from build
WARNING: Could not locate thirdparty package fcollada, excluding from build
Couldn't find library libfftw
Couldn't find library librfftw
Couldn't find header file fftw.h
Couldn't find header file rfftw.h
WARNING: Could not locate thirdparty package fftw, excluding from build
Couldn't find library libOSMesa
WARNING: Could not locate thirdparty package osmesa, excluding from build
<snip>


Any ideas what could be wrong, or how to get more information on what's failing?
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby whitelynx » Mon Jul 12, 2010 4:36 pm

I started adding prints all over the makepanda source to try and figure out where it was failing, and it seems to be failing on the 'FCollada' include. (not 'FCollada.h'; that exists and is detected correctly)

Where should the 'FCollada' file come from?
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby whitelynx » Mon Jul 12, 2010 5:45 pm

I fixed it by installing FCollada.h and FColladaPlugin.h to both $PREFIX/include and $PREFIX/include/FCollada; now, makepanda seems to pick it up perfectly. I've uploaded a copy of my FCollada 3.05 source tree with the new wscript build system and a minor fix for building on x86_64 under Linux; it can be found at http://development.g33xnexus.com/fcollada-3.05.tar.bz2. It should also still be mostly usable to build under MSVC, since I left the project files in.
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby whitelynx » Tue Jul 13, 2010 10:32 pm

Ok, my FCollada doesn't seem to actually be working. I'm going to email you about your copy of the FCollada source.
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby whitelynx » Sat Jul 17, 2010 8:57 pm

Ok, now that I've gotten the Collada import working, I have another question: How do I put tags in a .dae file so that they'll import into Panda correctly? I need to be able to create colliders and entities correctly, and I haven't found any information on how to store tags in a Collada file.

Also, if anyone knows how to populate that data from Blender 2.5, that would also be helpful to know... that's becoming our model/level toolchain.
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby rdb » Sun Jul 18, 2010 3:57 am

Hm, I could add that functionality. How does Blender 2.5 export properties in COLLADA? Using an <extra> tag?
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby whitelynx » Sun Jul 18, 2010 4:14 pm

As far as I can tell, it doesn't export properties at all, which is pretty annoying... I've tried adding properties to everything I could think of, and nothing seems to ever make it into the Collada file. If <extra> looks like a good way to do it, though, I can always add those by hand until Blender's exporter is changed to work.
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby whitelynx » Tue Jul 20, 2010 2:38 pm

rdb: If you could implement tag importing using the <extra> tag, that would at least give me a way to hand-edit Collada files to be useful as levels. From everything I've been able to determine, it looks like Blender doesn't actually have any sort of mechanism for exporting properties to Collada.

If you get a chance, could you implement <extra> tag importing?


Thanks!
David H. Bronke
Vice President of Project Development
G33X Nexus Entertainment
Skewed Aspect
User avatar
whitelynx
 
Posts: 54
Joined: Wed Dec 31, 2008 2:56 pm
Location: Lubbock, TX

Postby rdb » Wed Jul 21, 2010 1:52 am

OK, I'll get to it soon. My development environment doesn't build with the FCollada-based exporter because of my work on the native loader, so it's a bit inconvenient but I'll get to it soon.
rdb
 
Posts: 9499
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

PreviousNext

Return to Panda Features in Development

Who is online

Users browsing this forum: No registered users and 0 guests