Blender --> Ogre animations UV inverted or animations wro

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
NeOmega
Halfling
Posts: 86
Joined: Mon Apr 04, 2005 2:30 am
Location: Washington State, USA

Blender --> Ogre animations UV inverted or animations wro

Post by NeOmega »

Hi,

When I export a model, and view it in the mesh viewer, one of two things are wrong:

If I use "global coordinates", with x = -90, the animation is perfect, just like in blender.... except all of the faces are inverted, like the see through side is pointing "out", and the solid side is pointing "in".

To correct this, I have tried:

flipping normals and exporting: same thing
making faces "two sided" and exporting: same thing

I can't figure it out......


The other option is not to use "global coordinates"

The model looks great bu the animations are messed up. I have played around with the X, Y, and Z rotations, but cannot get the model to animate correctly. Some things move in the right direction, but others do not.

I have played around with the 3 rotations in the exporter more than I care to mess around with anymore, and always one thing rotates in the wrong direction, not to mention the whole model may be upside down.... so I'd really prefer the global coordinates solution.
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Blender --> Ogre animations UV inverted or animations

Post by reimpell »

NeOmega wrote:The other option is not to use "global coordinates"
Instead of using the "global coordinates" option, you can use Ctrl+A (resp. "Object->Clear/Apply->Apply Size/Rotation") on your object before exporting.

The object transformation correspond to a SceneNode transformation in Ogre. You can use local coordinates and transform your SceneNode according to the object transformation in Blender to get the desired result.

There seem to be some problems with Blender's current animation system that result in corrupted animations on export. Sometimes this alternative export script is a workaround. Fortunately, Blender's animation system is currently under heavy development. As soon as the new Python API is available, I will implement a new armature exporter.
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

Re: Blender --> Ogre animations UV inverted or animations

Post by reimpell »

NeOmega wrote:If I use "global coordinates", with x = -90, the animation is perfect, just like in blender.... except all of the faces are inverted, like the see through side is pointing "out", and the solid side is pointing "in".
I just realized that Blender itself sometimes has the problem of flipping the normals while using "Apply size and rotation" (ctrl+a). Therefore I recommend the following procedure to export in global coordinates:
  1. Select the mesh in "Object Mode".
  2. Apply size and rotation with "ctrl+a".
  3. Switch to "Edit Mode".
  4. Correct the normals if necessaray (e.g. with "ctrl+n" or "w,9").
  5. Export with "World Coordinates" disabled.
  6. Kindly ask the artist to use transformations in "Object Mode" to transform the SceneNode and to use transformations in "Edit Mode" to transform the Entity.
User avatar
NeOmega
Halfling
Posts: 86
Joined: Mon Apr 04, 2005 2:30 am
Location: Washington State, USA

Post by NeOmega »

Thanks reimpell,

I am the artist, as things got even more confusing. I did the ctrl+A thing, and then exported without global coordinates.

Now the animation is fine, but once again, everything is inverted. This has nothing to do with the normals on the model.

Maybe it's the viewer? I am using the Ogre mesh viewer. And when I convert the skeleton, it gives an unknown file format error.

The ony way I have figured how to stop this is I went into the materials XML file and threw in:

cull_hardware none
cull_software none

It worked. But I just do not understand wh having the armature would invert the faces, or more accurately, lock them inverted.


EDIT: this is using the revised script

EDIT2: I am not sure what step 6 means......
reimpell
OGRE Contributor
OGRE Contributor
Posts: 570
Joined: Mon Mar 01, 2004 10:35 am
Location: Hamburg, Germany

How Blender organizes scenes

Post by reimpell »

NeOmega wrote:Now the animation is fine, but once again, everything is inverted. This has nothing to do with the normals on the model.
Apply size and rotation (ctrl+a) will result in wrong normals, if you have a negative scale in the object transform properties. You have to fix the normals before exporting, otherwise your mesh will look inverted.
NeOmega wrote:I am not sure what step 6 means.
Like Ogre, Blender uses the concept of a "scene". If you look at Blender's "Outliner" window, you can see that your scene is composed out of several objects, e.g. Camera, Cube and Lamp in the default scene. These objects are displayed with a trihedron icon. The transform properties in "Object Mode" determine the position, rotation and scale of this object in the scene. This correspond to the SceneNode transformation in Ogre. If you expand the Cube object in the outliner, you see that it contains a mesh (triangle icon). If you want to see how your mesh looks like (and how the corresponding Entity in Ogre will look like), select your object in object mode and clear position (alt+g), rotation (alt+r) and scale (alt+s). To edit the mesh (and not the object), switch to "Edit Mode". In other words, if you intend to export a mesh only and not the corresponding object (i.e. if you don't intend to use the dotScene exporter), be sure your mesh looks correct, if you set LocX=LocY=LocZ=RotX=RotY=RotZ=0 and ScaleX=ScaleY=ScaleZ=1.0 in the Transform Properties in Object mode.
User avatar
NeOmega
Halfling
Posts: 86
Joined: Mon Apr 04, 2005 2:30 am
Location: Washington State, USA

Post by NeOmega »

Thank you very much. I can't believe it, as I knew better than to edit the object instead of the mesh, but in those thousands of steps of refining the low poly mesh, I guess I must have done it.

So I re-edited the mesh, and numerically set LocX=LocY=LocZ=RotX=RotY=RotZ=0 and ScaleX=ScaleY=ScaleZ=1.0 in the Transform Properties in Object mode, as you said, and then I saw my mesh was kind of messed up. So had to readjust it. Amazingly, somewhere in a save, my jet's wing names got switched also, adding to the confusion, (even though for some reason the preview animations worked fine.... I think I must have had negatvie rotation values somewhere also).

But now, without global coordinates, it exports great.

Thanks for helping me untie this knot!
Post Reply