Google

Blender export script

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.

Moderators: OGRE Team, Moderators

Postby sinbad » Sun Feb 22, 2004 6:20 pm

Great update, love the new docs, thanks. It's in CVS.
User avatar
sinbad
OGRE Founder, Ex-Lead
OGRE Founder, Ex-Lead
 
Posts: 25661
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands

BlenderExport-0.13.tar.gz

Postby reimpell » Tue Feb 24, 2004 11:28 am

BlenderExport-0.13.tar.gz is now available!

Although the display of the version number would justify a release on its own ;) the script now saves and restores your exporter settings. As Blender does not allow to store script variables in the .blend file yet, the settings will be saved into a file named after the current .blend file with extension ".ogre". Bundle this file with your .blend file if you want to share your animation settings, too.

The file ogrenew/Tools/BlenderExport/README.txt is obsolete and source of confusion (e.g. people bother to install libxml2). Hence it would be nice if README.txt could be removed form CVS. Thanks!

Regards,
Michael

[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.php?func=detail&aid=815849&group_id=2997&atid=302997
reimpell
 

BlenderExport-0.13.1.tar.gz

Postby reimpell » Fri Feb 27, 2004 11:23 am

BlenderExport-0.13.1.tar.gz is out now!

It manly fixes a bug with uv coordinates and smoothed normals that was already there in the original release by Jens Hoffman. I'm a little depressed that this bug wasn't reported before which basically means that not so many people use the exporter at the moment :cry:.

Anyway, I think I have my first feature request:
At the moment animations look a bit jerky, since interpolation between keyframes is basically linear. I would really appreciate it, if I could write bezier handles into the .skeleton.xml file and OGRE would interpolate accordingly.

Please still consider to remove ogrenew/Tools/BlenderExport/README.txt from CVS.

Regards,
Michael

[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.php?func=detail&aid=815849&group_id=2997&atid=302997
reimpell
 

Postby sinbad » Fri Feb 27, 2004 1:42 pm

Thanks for the update.

Anyway, I think I have my first feature request:
At the moment animations look a bit jerky, since interpolation between keyframes is basically linear. I would really appreciate it, if I could write bezier handles into the .skeleton.xml file and OGRE would interpolate accordingly.


Actually OGRE can interpolate keyframes using splines already; this is changeable at runtime, just use animation->setInterpolationMode(Animation::IM_SPLINE), or if you want it to apply for everything, Animation::setDefaultInterpolationMode(Animation::IM_SPLINE). It makes a big difference when animating scene nodes (see Demo_CameraTrack), and can smooth out the animation on models too.
User avatar
sinbad
OGRE Founder, Ex-Lead
OGRE Founder, Ex-Lead
 
Posts: 25661
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands

animation interpolation

Postby reimpell » Fri Feb 27, 2004 2:47 pm

sinbad wrote:Actually OGRE can interpolate keyframes using splines already

The SkeletalAnimation sample application, which I used to do a quick check of exported files, does Animation::setDefaultInterpolationMode(Animation::IM_SPLINE); by default. However, the animation is jerky nevertheless. Since bezier curves only require 3 points as parameters at any given keyframe and can be computed efficiently, it would make animating things a lot easier (e.g. you can set up a smooth walkcycle with only 4 keyframes). The skeleton DTD could be extended in that way without loosing backward compatibility, also.
reimpell
 

Postby sinbad » Fri Feb 27, 2004 6:16 pm

I'd have to see an example of the benefits it can bring, I don't see how calculating a bezier automatically from the keyframes will differ substantially in effect from calculating a catmull-rom spline like the IM_SPLINE mode does...
User avatar
sinbad
OGRE Founder, Ex-Lead
OGRE Founder, Ex-Lead
 
Posts: 25661
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands

still wants that bezier stuff in ;)

Postby reimpell » Sat Feb 28, 2004 4:12 pm

sinbad wrote:I'd have to see an example of the benefits it can bring, I don't see how calculating a bezier automatically from the keyframes will differ substantially in effect from calculating a catmull-rom spline like the IM_SPLINE mode does...

You may want to play around with bezier control points yourself: http://www.math.ubc.ca/~cass/gfx/bezier.html. In fact bezier types are so powerfull, you must actually restrict them to represent a parameter in time unambiguously. If you can do the same with the already implemented splines, I would be eager to know how to write such a parameterized spline into a skeleton.xml file, because I couldn't find out from staring at the DTD. By the way, Blender has three interpolation modes: Bezier, linear and constant. This combination seems to be suitable to please the artists.
reimpell
 

Postby sinbad » Sat Feb 28, 2004 5:19 pm

Well, IM_SPLINE uses uniform b-splines so there are no other parameters to supply except the basic control points, that's one of the benefits; you just turn them on and you immedately get smoother interpolation without requiring any additional data like you need for beziers. This is most noticeable in translations, see the smooth path of the camera in Demo_CameraTrack for example.

If you want more control at each point you would need non-uniform b-splines (the basis for NURBS) which we not support right now. What I'm saying is that I've yet to see an animation which looks significantly different using non-uniform splines as opposed to uniform splines, and the latter require much less work from both the engine and the exporter to implement. I'm willing to be proven wrong though, just show me an example :) I'd prefer non-uniform b-splines to beziers because they are much easier to generalise over multiple points and locality of influence is much better.
User avatar
sinbad
OGRE Founder, Ex-Lead
OGRE Founder, Ex-Lead
 
Posts: 25661
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands

upcoming improvements

Postby reimpell » Wed Apr 07, 2004 2:13 pm

There are some good news about blender!

Recently two patches came up for the python interface to the armature animation system. The first is about getting ipocurve names for action ipos, the second is about getting the action ipos corresponding to a specific bone. At the moment the mapping of the exporter is just a wild guess, so the animation export will be much more robust in feature releases.

Another good news is that blender's internal game engine is supposed to be back in version 2.33. It then can be used for rapid prototyping of your 3D models or game ideas before actually exporting to OGRE.

There is still no (or at least no easy) way to "bake" textures (also known as "render to texture"). This makes texturing of organic structures, e. g. human skin with realistic looking muscles, unnecessarily difficult. On the other side this is a known problem and therefor might be solved in the near futuer, too.

I also plan to add support of vertex colors to the exporter. Is there a shader around that adds vertex colors as extra light?

Also there are two options which I like to support regarding shadows:
"Shadow" makes material receive shadows from spotlights,
"OnlyShadow" renders shadows falling on material only.
Are there any changes to the material scripts/ogremeshxml.dtd planned?

Michael

@sinbad:
sinbad wrote:I'm willing to be proven wrong though, just show me an example :)

Actually you are asking a programmer to create to create an awesome animation...
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Postby Aglanor » Wed Apr 07, 2004 2:49 pm

Reimpell,

I am working on a blender exporter / importer too, and would like to use your ogre exporter as a reference (for starters I've grabbed all the mathematical stuff ;)) and was wondering if you could help me a bit.

There's something I don't understand atm, and it is how do you separate a mesh into submeshes according to the material. I know that blender materials are assigned to each face, what is the procedure you do to to separate then to sub-meshes (I have oogled at the code but I can't really grasp it).

Oh, and it seems the next blender will also have support for creating Armatures in python. Something really needed for importers!
User avatar
Aglanor
Regular
 
Posts: 61
Joined: Tue Nov 26, 2002 10:39 pm
Location: Sevilla

Material and submeshes

Postby reimpell » Wed Apr 07, 2004 5:47 pm

Aglanor wrote:There's something I don't understand atm, and it is how do you separate a mesh into submeshes according to the material. I know that blender materials are assigned to each face, what is the procedure you do to to separate then to sub-meshes (I have oogled at the code but I can't really grasp it).

The export_mesh function in line 1746pp does the job. In there you will see the lines
Code: Select all
# materials of the object
# note: ogre assigns different textures and different facemodes
#       to different materials
objectMaterialDict = {}
# faces assign to objectMaterial keys
objectMaterialFacesDict = {}

or more detailed:

You must clearly distinct between blender materials and OGRE materials since some of blender's face properties are also mapped to OGRE material settings, e.g. the uv texture and the blend mode are face properties in blender and no material properties.

The separation into submeshes is done with two dictionaries. Every distinct OGRE material has a unique name which serves as the key for both dictionaries. For each face in the mesh object, the unique material name is created. If there is already such a material (the objectMaterialDict has such a key), the face is appended to a list stored in objectMaterialFacesDict with the same key, otherwise the material and the list are created.
The splitting into two dictionaries is for historical reason, since the material dictionary is a global property of your .blend file and the face dictionary is a local property of the current mesh. As the name suggest, the objectMaterialDict is now object specific and is synchronized with the global material dictionary only if there is at least one valid face belonging to the material.

Hope that helps,
Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Postby Guest » Thu Apr 08, 2004 7:40 am

I've tried to download this, but all the "Download" links on https://sourceforge.net/tracker/index.p ... tid=302997 just go to a blank page. Is there something wrong with sourceforge? is there somewhere else I can get this script?
Guest
 

getting OGRE

Postby reimpell » Thu Apr 08, 2004 8:54 am

Anonymous wrote:is there somewhere else I can get this script?

Yes, it is part of the OGRE v0.13.1 release. Of course it is also in CVS.

Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Postby Guest » Fri Apr 09, 2004 2:24 pm

I am working with an application that will not currently accept .mesh files created with meshserializer 1.20 (only up to 1.10), so I was wondering which blender export script would be best to use. I have had some troubles with blender exports as I am using the newest version of blender and it seems to have very limited python libraries.
Guest
 

Blender and Python

Postby reimpell » Sat Apr 10, 2004 10:29 pm

Anonymous wrote:I have had some troubles with blender exports as I am using the newest version of blender and it seems to have very limited python libraries.

The export script needs Python 2.2 installed as described in the Blender community documentation. The exported files are for use with OGRE version 0.13 and newer.

Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Blender and Python

Postby Guest » Sun Apr 11, 2004 2:57 pm

I'm another guest trying to use your export script.

I finally got it to work inside Blender, nice functional GUI btw!, but the files exported are almost empty?
Am I missing something or are they supposed to be like this?
Code: Select all
<mesh>
  <submeshes>
  </submeshes>
</mesh>


I open my blender-file, select a few object and press file->export->Ogre XMl.
And chose export. No matter what settings I chose, the result is the same - except sometimes I get "Error in normalize"...

Any help or suggestions would be very appreciated![/code]
Guest
 

Re: Blender and Python

Postby reimpell » Sun Apr 11, 2004 4:17 pm

Anonymous wrote:I finally got it to work inside Blender, nice functional GUI btw!, but the files exported are almost empty?

I guess you neither gave your mesh a material nor a texture. Just go the material buttons (F5) and press "new" while your mesh is selected.

Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Blender and Python

Postby Guest » Sun Apr 11, 2004 11:54 pm

I guess you neither gave your mesh a material nor a texture. Just go the material buttons (F5) and press "new" while your mesh is selected.

You are right, just tested it with one of my simple meshes.
Tried it with something with texture and materials - and it works! :D

Thanks a lot for a great exporter script!
Guest
 

no materials or textures defined

Postby reimpell » Tue Apr 13, 2004 10:29 am

The next version will not write empty meshes and warn if a mesh has no visible face as well as if there is no material or texture defined. Thanks for reporting.

Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Some questions

Postby groggy » Tue Apr 20, 2004 9:18 pm

The exporter has worked great with my humble collection of test objects, so big, big thanks for that. :)
And for two questions:

1.Can the script export "raw" splines/curves? (Usage would mostly be cameratracks I guess.)

2.Would there be any way to support the game support? This might be a feature better integrated into an Ogre framework dependent exporter, than a generic, but it would be really cool!

Anyway, thanks for the exporter!
groggy
Regular
 
Posts: 72
Joined: Wed Jun 11, 2003 2:12 pm

Re: Some questions

Postby reimpell » Wed Apr 21, 2004 4:10 pm

groggy wrote:1.Can the script export "raw" splines/curves? (Usage would mostly be cameratracks I guess.)

2.Would there be any way to support the game support? This might be a feature better integrated into an Ogre framework dependent exporter, than a generic, but it would be really cool!


Unfortunately, for several reasons, there is no "raw" splines/curves export at the moment. Blender does support NURBS and Bezier curves, where OGRE supports Catmull-Rom splines. I haven't looked into the mathematics yet, but I guess there will be no "raw" translation. Instead you have to solve a variational problem to minimize the distance between two representations of the same curve. I tried to convince sinbad to include native support for Bezier curves but failed (see thread above). Also the interpolation type (linear or spline) is hardcoded into your application (see the Animation class), so there is no way of switching it in the .mesh or .skeleton files generated by the exporter. You can still export a blender curve into a mesh by using "Object->Convert Object Type -> Mesh".

The game enginge in blender is announced to be back by version 2.33. As far as I know it will use the SOLID or the ODE engine for collision detection resp. pyhsics. It is very likely that parameters for the physics engine will be available in the python interface. Hence writing an exporter should be easy if there is a standard file format to write to. Time will show.

Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Postby rogma » Sat May 08, 2004 1:16 pm

Hi, I have used the blender to ogre exporter on a model sent by a friend :

first I have
"error in normalize" when I select material export and no error message when I do not select material export

second point very weird (but perhaps not for this topic)

The converted mesh is correclty displayed by the GUIMeshUtil from ogre but not by Ogre himself : the textures seem not to be mapped correctly on the faces

regards
rogma
Regular
 
Posts: 67
Joined: Fri May 07, 2004 5:03 pm
Location: Issy les Moulineaux, France

normalization error

Postby reimpell » Sat May 08, 2004 10:49 pm

rogma wrote:first I have
"error in normalize" when I select material export and no error message when I do not select material export

This error happens if the length of the vector to normalize is below some threshold. This may happen in the calculation of face normals (likely) or in the conversion of the armature (not likely). In the case of the face normal you have some really small faces in your mesh, which is usually not what you want. In this case you can use the "Remove Doubles" option in Blender's "Mesh Tools" to get rid of them.

Michael
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Postby rogma » Tue Jun 01, 2004 6:03 pm

Thanks, there is no more "error in normalize" anymore with your advice.

There is still this strange texture mapping issue : the mapping in ogre and in the MeshViewer is not the same at all, we have tried with .bmp texture instead of .jpg ones and it seems to work on simple examples.
rogma
Regular
 
Posts: 67
Joined: Fri May 07, 2004 5:03 pm
Location: Issy les Moulineaux, France

Re: BlenderExport-0.13.1.tar.gz

Postby reimpell » Fri Jun 04, 2004 7:57 am

BlenderExport-0.13.2.tar.gz is out now!

I just submitted this new version of the blender exporter. Most notably it supports the receive_shadows material option. Also, it warns if no materials or textures are defined and it warns if there are no visible faces in the mesh, instead of writing empty mesh files. Another small change is the display of a message during the export process. This gives you a hint that the export process actually startet, since exporting can last a few seconds on big meshes. Of course the docs are also updated.

I also realized that in OGRE's 0.14.0 download version the tutorial link in
Docs/Tutorial/index.html points to the wrong place (the online version works).

@rogma: Can you provide a screenshot (blender, ogre, meshviewer)?

Regards,
Michael

[ 815849 ] Blender export script updated
https://sourceforge.net/tracker/index.php?func=detail&aid=815849&group_id=2997&atid=302997
reimpell
OGRE Contributor
OGRE Contributor
 
Posts: 674
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

PreviousNext

Return to Artists & Content Creators

Who is online

Users browsing this forum: No registered users and 3 guests