Chicken, an Egg exporter for Blender 2.49 and lower

psiberpunk, I really appreciate the efforts that you put in for us, blender users.

Thank you so much :smiley:

Kind regards,

Me too! Psiberpunk, I use your exporter, and it is excellent! Thank you for this work and for all your efforts.

i fiddled around a little and found a way to actually get the correct matrices of bones. with all constraints applied.

thanges really are minor… just 4 lines :slight_smile: 2 added 2 changed

starting on line 795 of chicken 1.0 :

		srbIMatPrev = IDENTITY

		###### adding stuff to get access to the currentFrame
		scn = Blender.Scene.GetCurrent() #added
		context = scn.getRenderingContext() #added
		###### done with preparing change frames

		for f in xrange(minframe,maxframe+1):

			context.currentFrame(f) #added
			scn.update(1) #added

			#i dunno if we really have to use update(1) for FULL update.. 
			#maybe update(0) works aswell. dont ask me :)
			#armature.evaluatePose(f)  #removoed
			#armature.getPose().update()   #removed
			# and updating the full scene instead of the armature.

			pbones = armature.getPose().bones
			if srb:

really minor change. but takes all constraints of the armature into account. like copy rotation/location aswell as propper export of ik-solvers with external target opbjects and so on… happy animating!
@psiberpunk can you merge it into the chicken svn?

edit:fixed some code-indentation typos^^

@ Thomas:

I’d love to give it a go~! (After changes applied to SVN) :smiley:

Thank you.

Kind Regards,

for those who absoutely cant wait:
a small demo-model + animation demonstrating external motion targets on ik-solvers and look-at constraits aswell as copy rotation/location
and my modified for those who wanna actually export it.

have fun :slight_smile:
ps: textures are packed in blender. to see the model textured you have to unpack them first or else chicken wont be able to export them at all.

I’ve merged your changes with the latest SVN revision and tried them out, but I haven’t yet committed it to the repository, because the last SVN revision had some problems and unfinished features. I’ll finish that off, commit and post a release on the site. I’ll update this post and provide a link when I’m finished. I’ll also update the test model while I’m at it.

Thanks, ThomaEgi for this fix, and everyone else who showed their support for this project.

after playing around with this I’ve found that it’s pretty easy to use the new shader generator with Chicken’s eggs. You have to modify some lines in the textures to get the glow maps etc.

I’ve got a question though- I’ve built a model, I’ve painted the model and I’ve got a normal map that I want to apply as well. I know how to do this with Blender.

The issue I have is that in this case each polygon has multiple texture information- there is the regular texture data, then the glow map (which is built into the alpha channel of my texture) but now I want to add a normal map to the polygons. I have the normal map in RGB format.

My question is- Can I have multiple textures as a TRef on a given polygon?

if so- can chicken be modified to pick up the normalmap texture- in the current situation I have to would have to add the line { normalmap} to each polygon- which gives impractical pretty fast. I’ve tried doing it with macros on my text-editor but it hasn’t worked.

Certainly. The egg syntax document describes all of the ins and outs of multiple textures in an egg file.

I have achieved this trick with a text editor in the past by doing something like Find: “” Replace: " { my-other-texture } ". In other words, let both TRef’s be on the same line. Text editors are pretty good at making changes to a single line, and the egg syntax doesn’t require that the TRef’s be on different lines.


Ok guys, here’s the new release:
Chicken R42
and the R42 test model

I haven’t marked this release with an official version number (yet) because it hasn’t been tested that thoroughly but it seems to work fine and it does have some cool things over version 1.0, so you might want to try it out if you didn’t try version R33 or if you want ThomasEgi’s fix for external constraint targets.

I would like to post a feature request, if possible. It would be great to lightmap the scene in Blender, and then export it with Chicken. I am not sure what is needed, but as I heard it is possible with Maya exporter…

What do you mean by lightmap the scene?

Blender can be used as lightmapping tool (it has lightmap-baking feature). It would be great to export this lightmap together with other textures, and use it in Panda.

Well, if the textures you are baking to are images that have been saved and are not packed, Chicken can export them just fine. I tested this just now.
What you might want is another script that processes your geometry, creates appropriate UVs and assigns appropriately sized images to faces, bakes a render and then saves those images. That would be awesome, but I don’t think it fits in with an exporter because you probably wouldn’t want to do that every time you export and it has nothing to do with exporting to specific format like .egg.

Hmm… I think what is needed is possibility to export multiple UVs and several texture layers. At the moment Chicken can export only one layer of textures (I can be mistaken).

It does export multiple UV sets, however it can’t map textures to them because that information is currently inaccessible from Python scripts. However editing your .egg file to do that by hand is very simple.
Basically you have to add the following line to the block you want associated with a specific UV set.

 <Scalar> uv-name { name }

where the name within the brackets is the one you gave to the UV set.

EDIT: after trying to test exporting the lightmap with another texture I realized it does have a problem. It’s currently only exporting a texture for the image associated with the currently active UV set so it also doesn’t export a reference to the other texture. So, I guess you’re right and it does need some work to export lightmaps in a useful way. I’ll look into this.

Great! Thanks for the info. I am going to try :slight_smile:

I’ve just committed revision 43 of Chicken with the following changes:

The only modified file was so you can just grab that from the SVN repository here

To clarify, if you want to use lightmaps you can now have two UV sets, each with their associated face image. These will be exported as separate textures properly referencing their UV set.
For materials with textures, I’ve made some placeholder logic that assumes textures use UV sets in the order they’re listed in the material’s texture list if there are enough UV sets, otherwise they use the first UV set. Hopefully in a future Blender version Python scripts will be able to access which UV set a material’s texture is mapped to.

Anyway, I think you can’t bake lightmaps to material textures, so you’ll probably want to use face images instead. I guess this’ll only start being a problem when I add support for normal maps which can only be specified in a material texture. I’m not sure how I should handle the situation where you have a normal map in a material texture, and a lightmap in a face image.

The Blender Python API documentation is pretty shitty after all. The material texture UV layer is accessible from Python even though the documentation has no mention of this fact. Therefore revision 44 will fix the fake logic that’s in place with the actual working logic.
Also, I forgot to mention when I replaced NMesh with Mesh I put some code in there that should allow exporting the effects of any modifier on static meshes. I haven’t tested it, but it should work in principle

Hi psiberpunk, would it be possible to make a few requests for your exporter? What i need may be a bit complex and i’m not good enough with Blender to make the changes myself.

My request is about adding more ways to export a scene. The interface would be added with a combo box to choose the scene export mode. We could choose 3 different ways to export our scene. When the user presses this combo box it shows a list with the items:


Maybe each export mode could be a separate script in bpymodules.

  1. is the way Chicken works at the moment. I think you could ignore exporting animated objects in this mode since in most cases what people want is to export animated objects as a library of objects that will be placed dynamically as game actors.

In alternative we could export a huge static mesh representing the entire scene and use Blender texture baking to bake a lightmap into a texture.

  1. is for animated actors and objects that will move in the scene. This mode would ignore hierarchy and export only meshes, materials and textures - like a library of things. Perhaps this way you could remove the restriction of exporting only one armature and one action anim at a time.

  2. the only interesting thing to export in this mode is an hierarchy of transforms and the tags with user info that are attached to each object, together with a tag “$OriginalMesh”=“the mesh linked” or some other name. Meshes, textures and materials would be discarded when exporting.
    NOTE: Empties can’t be used to do this because we need some geometry pieces to help us visualize the scene we are making. We then discard the geometry and export only the hierarchy with the transforms and tags. This is useful to build a random dungeon or town where all geometry pieces will be assigned to their positions dynamically at runtime.

OGRE supports modes 2) and 3) with separate scripts and this is the most flexible way since mode 1) can be build by linking meshes and materials at runtime and then flattening the geometry and convert it to an octree.

Hi guys, I just committed revision 44 of Chicken to SVN. Here are the relevant changes:

  • Added basic support for exporting Normal Maps (also displays errors in cases where you’re doing something suspect). Automatically calls egg-trans to calculate tangents and binormals for appropriate UV sets
  • Fixed support for modifiers on static objects, modified errors so it only complains about modifiers for animated objects

I’ll briefly explain the new features:
-To export a normal map, you have to assign a material to the object, assign an Image texture to it, that takes UV as map input (you can leave the specific UV set empty and it’ll take the first one you have on your mesh) and maps to Nor. Chicken will warn you if the material is not marked as using Tangent Space normal maps (which is what you’ll use in Panda), and also if the Texture doesn’t have the Normal Map toggle active (because that would mean it’s a height map, not a normal map).
Basically the warnings it throws indicate stuff that won’t affect export but that it won’t look like it does in Blender when you render your object.
To turn on the Tangent Space Normal Maps, look for the Nmap TS button in the material buttons panel (F5) under the Shaders tab.
To flag your texture as being a normal map, go to the texture buttons (F6) and activate the Normal Map toggle button (this will only appear if the selected texture is of Image type).

-To use the new support for modifiers for static objects, you don’t need to do anything special. Just select a static object that has modifiers on it and export it. You should see the effects without the modifiers needing to be applied before export. Note however that this is currently impossible for animated objects and you won’t see any effect for modifiers that aren’t the Armature modifier.

I’ll probably be working on exporting other special textures (gloss, height, etc.) for the next revision.

Those are interesting features. In fact I had something of that sort in mind. I’ll get back to you when I’ve thought some more about it. For now, I’ll just say I agree we need something like that, but I’m not sure I like the “modes” approach so much anymore.

Hi psiberpunk,
I just downloaded and installed your chicken exporter for Blender (took me a while to find out where to put the scripts exactly), but it doesn’t seem to work.
As soon as I select the script from the list in the scripts window, Blender shuts down immediatly, without giving any error messages.
I’m using Blender 2.45 on Ubuntu 7.10 and the only thing I did was open up Blender and try to open the script, nothing else.
If you could help me get this exporter running without crashing blender that’d be great.