Yet another Blender -> egg

Wanted to let any who was interested in knowing.

Simple page explaining a bit about it, with a link to the zip file.

Its currently exporting meshes, and animation. The only animation coming out of it currently is through Armatures with vertex groups. In the zip is an example blend and that blend’s .egg export with a texture mapped onto it. It has a few frames of animation.

Its currently exporting points broken up by material+texture so your point counts will be what they are in blender if you don’t map multiple materials or textures onto the same object.

I’ll probably look at collisions next, I’m not sure if collisions are currently solvable by the scene editor, but if they are I’ll probably not implement them.

Thank you very much, it worked without a hassle for me. I didn’t even have to bake the animation first. Great stuff.

I did notice a small quirk. In the egg file the name you use for the texture is the name it has inside Blender, not the name of the actual image. I don’t know if there’s a way to fix that but it’s not a big deal anyway.

Might I suggest you give an option to export only the animation? That would be useful for people who want to export every animation to a separate file.

EDIT: I just noticed there’s something wrong with UVs. Apparently around seams it’s generating incorrect UVs cause I get distortion that I don’t get in blender or in Panda by going through an X file.

I think I figured out what the deal is with the faulty UVs. I noticed that the number of vertices you are outputting is the same number of vertices that the mesh has, but I think it should be the number of vertices the UV map has. Otherwise, how would seams be possible? I guess that explains why the abnormalities are only noticeable around seams.

I checked the output from an .egg file produced via x2egg, and it has much more vertices (probably one for every vertex on every face, which is definitely not optimal cause you have vertices with the same position AND uv that way, but at least seams work). I guess an easy way to solve it is to do that, and then merge the vertices that share both position and UV.

Hey, just a small update: I fixed it. It now identifies vertices with (index, uv[0], uv[1]) as a key. Works well. It only produces new vertices for the ones required by the seams.
If you want the fixed version I can e-mail it to you or something.

I also realized why you didn’t notice this problem: your test mesh already had duplicate vertices for seams, that is you didn’t use blender’s internal seam facilities for it.

Also note that the egg loader will automatically collapse separate but identical vertices on load anyway, so there’s no need to fret about wastefully duplicating vertices in an egg file. An egg file that shares every vertex, and one that duplicates every vertex, will both produce the same result when loaded–a model in which only the minimum necessary vertices are duplicated.


Sure you can email me the change I’ll put it in. should get it to me, or PM me here.

Yeah its my first blender/panda3d thing so I’m bound to miss stuff.

I didn’t know that about panda drwr, heh guess I didn’t need to write the code in there, good experience anyway imo.

Okay, I e-mailed you the fixed version.

I guess there is one advantage to not outputting unnecessary duplicate vertices: the egg file is a quite a bit smaller.

Thanks for the fix its up there now.

Hi again, I seem to have found another issue, although I’m not sure yet what is causing it. There appears to be a problem with complex armatures, where the root is getting exported more than once. I’m not sure if it’s as a result of that, but a simple animation I made doesn’t work despite the animation tables being exported to the egg. It might be that this armature has some floating bone chains. Is that not supported in egg files?

Also, I’m getting flipped normals on some open meshes (non-manifolds).

I’ll keep trying to find the causes for these issues.

Ahh I found the problem, was simple to fix. If you check the site again there will be a new version.

Not sure on the flipped normals. Are the pointing the right way in Blender?

Heh, it seems I accidentally caused a small regression there with the UV thing (didn’t think of geometry without textures, sorry :blush:).
I tested your new version and it does animate something but it’s totally wrong. My guess for the cause is this: the model I’m testing is composed of three different objects using the same armature.

[EDIT] Hmmm, seems that’s not it… I tried joining the objects and it’s even worse. I guess floating bones are not handled properly [/EDIT]

Also, the normals are pointing out correctly in Blender, in fact I have to flip them in Blender for them to be viewed correctly in panda.

Okay, I figured out what was causing the problem. The armature had a transform on it, most importantly a scaling down. When I changed that back to 1 everything worked fine.

The normals thing I still haven’t figured out though.

EDIT: Okay, I figured that out too. Turns out some pieces of the model had a negative scale on the x-axis… Well, at least I’ve learned what to watch out for.

I got some new problem with this exporter. I hope it’s appropiate place for asking for help.
I’ve tried to export this file:
Error traceback is:

Traceback (most recent call last):
  File "<string>", line 254, in gui
  File "<string>", line 218, in buildExportables
  File "<string>", line 1136, in doExport
  File "<string>", line 531, in End
  File "<string>", line 609, in WriteMeshes
  File "<string>", line 624, in write_AnimBundle
  File "<string>", line 646, in write_AnimBones
AttributeError: evaluatePose

Output fil:e

Version 2 of exporter works fine with this example. Same situation with about 4k poly model with more bones.

Maybe I just need to do some things in blender in other order? Really dunno…

Which version of Blender and the exporter did you try that gave that error? I tried a modified version 6 (but I didn’t touch the part about bones) on Blender 2.42a and it worked fine; although your example helped me find an exception in some new code I was adding.

I got blender 2.41 and exporters v5 and v6 didn’t work.

I can’t seem to find the Python API documentation for 2.41 anymore so I don’t really know if it doesn’t have that function.
Why not upgrade to 2.42a? As far as I’ve seen it’s much improved over 2.41

EDIT: I tried it in 2.41 and you’re right, it doesn’t work. But it does in 2.42a :slight_smile:

Thank you psiberpunk. I’m sitting on Ubuntu edgy package, I don’t like compiling big programs with g++.

I’ve changed the Anim bone section to this from v2. Works well for me, I’ll use it like that until I have got package with 2.42.

I just want to say “Thank you” for all who make this exporter. Really good stuff, helps me a lot.

I rewrote the exporter to better support multiple objects. This version is called eggX2 . It should support objects owned by an armature, and keeping them in logical groups, and exporting those with a Model flag so you can get at them in panda. It also has some alpha/basecolor material texture support.

Heh it should work :slight_smile: I didn’t actually construct a scene like that, and don’t have time at the moment, if anyone wants to take a look I put it up on my site. Other then that I’ll be doing more testing when I get back

Made a modifiction to export Poly’s in a specified material/face texture into a tag. Now textured polys are targetable by eggoptchar to get nodepaths to geometry in a loaded model.