Preview of the next Blender exporter

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm

Post by lf3thn4d » Fri Aug 29, 2008 11:24 am

wasted: The vertex colour stuff is some legacy code. It was supposed to be fixing for some Ogre's GL problem. Maybe it's already fixed on ogre's side. If that's the case I'll do an official fix.

As for your UV thing, that hack of your's is bad. I'm not exactly sure what you are trying to do. Can you elaborate?

ppClarity: Your mesh might be having inverted normal. Try invert the normal in blender before export.

Vylaroth: Your crash may be due to old XML converter. I'm not really sure here. Still, blank animations is kinda redundant isn't it? :P
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Fri Aug 29, 2008 1:49 pm

lf3thn4d wrote:ppClarity: Your mesh might be having inverted normal. Try invert the normal in blender before export.
I've tried recalculating normals outside and inside. The results of inside hurt my eyes as the far side of the mesh would render. Could the Y-Z axis swap be affecting this?
0 x

User avatar
Wasted
Gnoblar
Posts: 19
Joined: Thu Mar 20, 2008 11:50 pm
Location: Poland
Contact:

Post by Wasted » Fri Aug 29, 2008 2:31 pm

I had few problems with exporting multi UV. When I had 2 channels, one with texture and second with lightmap, and I selected first UV when exporting, the result was strange (some faces with texture matrial but most of them was using lightmap material). When exporting and second channel selected - all faces in .xml use second channel texture (lightmap) as they should. But I want to get .xml using first channel textures, as patched reimpell's exporter did it. So I have made little change here:

Code: Select all

tlayer = bMesh.activeUVLayer
		for uvlayer in bMesh.getUVLayerNames():
			bMesh.activeUVLayer = uvlayer
			if bMesh.faceUV:
				self.texcoords.append((bMFace.uv[bIndex][0], 1 - bMFace.uv[bIndex][1]))
			elif bMesh.vertexUV:
				self.texcoords.append((self.bMVert.uvco[0], 1 - self.bMVert.uvco[1]))

if tlayer:
     bMesh.activeUVLayer = tlayer
And everything is being exported as it should. Basically I think your version lost the active UV channel info.
0 x
www.wasted.pl << Our games, using OGRE :D

User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm

Post by lf3thn4d » Fri Aug 29, 2008 7:09 pm

No, Y-Z flipping doesn't affect the normals. I'm using normal mapping extensively in my own game. I've no problem with the exporter. You must have missed something. Most likely your mesh is screwed up.

[edit]
Wasted:
That's weird. But keeping the active layer state might be a good idea. I'll add this fix. :) Thanks :)

Update with Wasted's UV and colour fix:
http://www.xullum.net/lefthand/download ... atched.zip
[/edit]
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Sat Aug 30, 2008 3:05 pm

lf3thn4d wrote:You must have missed something. Most likely your mesh is screwed up
I am very new to Blender and have been avoiding trying to figure out shaders, so I'm rather lost. I reposted over in the Help forum.

I did go back and made sure that I ran recalculate normals outside on both the hi and low poly meshes. No difference.

The .blend file is here
http://www.projectplasma.com/BLENDER/lowpolytest.zip [warning nudity]
0 x

User avatar
Wasted
Gnoblar
Posts: 19
Joined: Thu Mar 20, 2008 11:50 pm
Location: Poland
Contact:

Post by Wasted » Sun Aug 31, 2008 8:35 pm

@lf3thn4d:
Sorry for my bug, first version of mine crashes when no UV on mesh and I see that you use this hack in your last update. I figured it out in my last post. I have just forgot about one "if" :P

Anyway Here is working script:
BlenderOgreExporterPatched.zip (31.08.2008)
0 x
www.wasted.pl << Our games, using OGRE :D

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Mon Sep 01, 2008 2:11 pm

I have a problem with animation and I'm trying to narrow down if it could possibly be the exporter.

I have animations running at 30FPS.

In release mode my game runs ~120fps (60 with vsync on), but my animations seem to be skipping frames...I'm getting about 10 animation frames/second.

Any insight on whether this could possibly be the exporter or if I'm barking up the wrong tree? Before anybody mentions it, I am updating the animation in my code like so:

Code: Select all

mAnimationState->addTime( evt.timeSinceLastFrame );
and only once/frame so it's not like I'm skipping frames that way.

Is there a specific frames/second that Ogre expects the animations to be? Should I be baking my actions to IPOs? I must be forgetting something.
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Mon Sep 01, 2008 4:59 pm

lf3thn4d wrote:I'm using normal mapping extensively in my own game.
If you don't mind my asking, what's your workflow? Are you using the object baking feature or a different technique? Are you using the material and shaders from Examples-Advanced or ones you or your team has built?
0 x

User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm

Post by lf3thn4d » Tue Sep 02, 2008 9:15 am

Wasted: Noted and updated. thanks. :)

ppClarity: I don't see anything wrong with your model. It's likely that your normalmap is not tangent normal map? For my own game, i'm using custom shaders to do stuffs. It's a very specific optimized shader specially for my game. That's why I came out with that custom material export system. ;)

mcaden: No, Ogre doesn't care about your animation fps. It uses time based on seconds. And that's how the exporter is exporting it. Note though that due to IK support and stuffs, the exporter "bakes" the animation. Which means it doesn't actually follow your animation keyframes. It's doing one key frame at a time right now. So if it's a 30fps keyframe animation, it will export 30 keyframes a second.

Maybe there should be an option that says "FOLLOW KEY FRAME" or something. But you loose the feature of baking IK that way. :P So it's a give and take. I'm rather busy right now so I can't actually work on this. When I find time to, i'll try to add support for this.

At anyrate, I don't think your problem lies there. I'm not quite sure what your problem is. Are you seeing slow motion animation? or are some keyframes missing?
0 x

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Tue Sep 02, 2008 9:20 am

Looks to me like what it's actually getting is JUST the keyframes, and nothing in-between.


EDIT: Eliminated Blender as the problem...I just finished installing all the prerequisites on my wife's computer - VS 2005 SP1 redist, directx redist, and physx system files (I'm using NxOgre) and after running my program on her computer the animation is smooth and beautiful. However, I notice it's nowhere near the framerate of mine (Vsync off I get 200+ at 1280x1024 resolution fullscreen ...she got 45 at 800x600 fullscreen).


I'm guessing it'd be the video card? I've got a gForce 7600GT, she's running a 7300 LE I'm running a 2.0 GHz Athlon 3200+ x64 on windows xp x64 - she's running a 2.4 GHz Athlon x64 dual-core on windows xp x64. She's got 1Gig ram, I've got 2.
0 x

User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm

Post by lf3thn4d » Tue Sep 02, 2008 12:45 pm

Ah.. ok. That's rather odd. Unless you are using some different build on the other machine, both shouldn't have any difference as far as animation goes.

7300LE is considered the lower end category of graphics card. It may be that reason that it's not performing very well with shaders. If not, it might be bad drivers. Try updating drivers from nvidia website and see if there's any improvements.
0 x

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Tue Sep 02, 2008 6:38 pm

Same build, both with up-to-date video card drivers.

Animation issue exists in both directx and opengl.

Framerate worries me a bit. Yes my computer is built for both development and for gaming, but her's was built for gaming as well. It makes me feel good seeing the animations smooth on her computer - helps me narrow it down, but I've had friends reporting that they are running my game with 10-30 fps in release mode...hers is running at ~45 in release mode, and I can run it at 200+ at 1280x1024 resolution fullscreen.

All of these computers have the ability to run World of Warcraft at at least moderate settings with a good framerate.

My game is using NxOgre, and the stock ogre debug window is showing ~4600 tris. I don't expect everybody to be able to run my game - I don't expect it to run on computers that are 5+ years old...but my comp is actually the oldest one of the current ones I've used to test - and this is a very small scene...basically just making sure my character can move around. Due to the rigorous testing Betajaen puts NxOgre through with a ton of different cubes, and the fact that I'm using simple cubes for collisions, I'm certain it's not NxOgre. Seeing as the anims work on other computers I'm certain it's not the blender exporter so from this point I'll take it away from this thread.

Since it works on my wife's computer I'll assume the animation issue isn't blender. But at the same time I've never heard of anything causing this problem, especially with up-to-date video card drivers. Regardless of the drivers I don't see how this could be a driver or video card issue.
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Tue Sep 02, 2008 11:20 pm

lf3thn4d wrote:For my own game, i'm using custom shaders to do stuffs. It's a very specific optimized shader specially for my game. That's why I came out with that custom material export system. ;)
;)
I don't see anything wrong with your model. It's likely that your normalmap is not tangent normal map?
“Curiouser and curiouser!â€
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Thu Sep 04, 2008 7:01 am

I have a working normal map.

I used xNormal and its output works just fine with the Example shaders. So the trick now is to convince Blender to bake its normal map the same way.

Of note: the Ogre Mesh Exporter ignores any outstanding scaling and rotation transforms and I'm guessing that the mesh's center is placed at the origin. So to get them to behave in xNormal, I had to apply the scaling and rotation to the ObData and make sure that both meshes had the same center.

Maybe add a button to "Apply Scaling and Rotation Transforms"? Or is that something experienced Blender artists know to compensate for?
0 x

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Thu Sep 04, 2008 7:07 am

That's one of the most common things people forget.

I believe the hotkey in blender is Ctrl+A to apply. Or simply do all edits in edit mode and ignore object mode except for scene placement.

Also, I don't remember if this is a necessity but I've just gotten into the habit of doing it and I do it every time: "Object->Transform-ObData To Center"
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Thu Sep 04, 2008 1:56 pm

mcaden wrote:Also, I don't remember if this is a necessity but I've just gotten into the habit of doing it and I do it every time: "Object->Transform-ObData To Center"
Heh... I tried that and it made a right mess.

I'm not done with the low-poly mesh, so the hands, feet and some of the neck are missing. Consequently the center of the lo-poly mesh does not match that of the hi-poly mesh. Centering the cursor on either one, switching to the other and hitting Object->Transform-Center Cursor does the trick. There are other subtle differences between the two that make me distrust ->ObData To Center for this purpose.

Still, it's all valuable stuff to know.
0 x

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Thu Sep 04, 2008 2:45 pm

I've had problems with bounding boxes and skeletons if the ObData isn't at center. I have a character that was correct attached to the skeleton, but the bounding box was larger than the model. I was basing physics/collisions based on the model so the bounding box was holding it up off the ground, and bumping into things well in front of it.

I set ObData to Center and moved it in object mode to line back up with the skeleton and it fixed all problems. So I do it more to keep things clean and avoid unwanted side-effects.
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Thu Sep 04, 2008 3:00 pm

mcaden wrote:I've had problems with bounding boxes and skeletons if the ObData isn't at center.
That's good to know, animation and then physics are next on my ToPlay list :lol: I only need to have a common center between the two meshes for xNormal, just as easy to use the lo-poly's center.
0 x

akem321
Bronze Sponsor
Bronze Sponsor
Posts: 153
Joined: Mon Jul 31, 2006 8:29 pm
Location: France
Contact:

Invalid base type in VertexElement::multiplyTypeCount

Post by akem321 » Fri Sep 05, 2008 6:55 pm

Hi,

I' m using the new exporter, i got a little problem when exporting
a skeleton animated character mesh with it, it has 80 bones, and i used
the bone heat feature to generate the vertex groups/weight automaticly.

The mesh is clean, exporting the mesh without skeleton/animations is ok,
but when i add the skeleton and animations i got this loading error:

Code: Select all

19:46:10: Mesh: Loading HumanMale.mesh.
19:46:10: Skeleton: Loading HumanMale.skeleton
19:46:10: OGRE EXCEPTION(2:InvalidParametersException): Invalid base type in VertexElement::multiplyTypeCount at ..\src\OgreHardwareVertexBuffer.cpp (line 186)
I only got warnings about more than 4 bones per vertex, but no errors while exporting.
any help?
0 x

User avatar
buckED
Greenskin
Posts: 133
Joined: Fri Feb 15, 2008 9:51 pm

Post by buckED » Sun Sep 07, 2008 1:58 pm

Hello.

I have a little issue here with exporting content from blender with the latest expoter.
I have made an animtion, where my character raises his arm.
In blender it looks perfectly ok.
But when imported into Ogre I get odd deformations. vertices are moved by bones they have not been assigned to and the arm deformation looks completely wrong. instead of just risng up, the characters arm gets moved into the characters body aswell. As if it was not rotated around it's parent bone, but aroung some fixed point within the characters body.

anyone experienced something similar? Any idea on how to solve that?

Another problem I am facing is that when running the script I get the error message "Vertex without bone assignment", even though I weightpainted the whole mesh.

In other words:
the animations in Ogre look different than in blender. is that normal?
what can I do to change this or lower the effect

[edit]Ok seems like I finally found the solution. For everyone who encounters the same thing in the future read this one: http://www.ogre3d.org/wiki/index.php/Tools:_Blender.
Sorry for posting too hastly :oops: [/edit]
0 x
Many of life's failures are people who did not realize how close they were to success when they gave up.

~ Thomas Edison ~

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Sun Sep 07, 2008 3:44 pm

Whups, forgot to post here...

I was able to convince Ogre to display the Blender produced Normal map by modifying the Example shader as outlined in this post: http://www.ogre3d.org/phpBB2/viewtopic. ... 842#303842 and adding "compile_arguments -DINVERT_X_COMPONENT=1" to each of the fragment_program definitions in my material.
0 x

ppClarity
Gremlin
Posts: 194
Joined: Sat Sep 02, 2006 12:27 am

Post by ppClarity » Tue Sep 16, 2008 5:25 pm

Wrestled with an issue when I added a skeleton. Looked great in Blender, but in Ogre my poor headless woman looked like an orangutan! :shock: :lol:

Another one for the 'duh' file: The centers of the skeleton and the mesh must be at the same point (Select one object, Shift-S -> Cursor to Selection, Select the other object, Object->Transform->Center Cursor).
0 x

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Fri Sep 19, 2008 4:32 pm

Got a weird mesh issue.

I export my mesh successfully and load it into my game...suddenly my framerate drops to ~7 (I get 300 normally).

This mesh only has 353 polys and a skeleton of roughly 25 bones (I counted, but wasn't very careful and might've missed a couple).

I did notice in the OgreXMLConverter.log file
23:23:40: Skeleton: Loading Rat.skeleton
23:23:40: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Rat.skeleton in resource group General or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 604)
23:23:40: Unable to load skeleton Rat.skeleton for Mesh conversion. This Mesh will not be animated. You can ignore this message if you are using an offline tool.
23:23:40: XMLMeshSerializer import successful.
No errors or warnings in ogre.log

Mesh creation code is normal

Code: Select all

SceneNode* levelNode =  mSceneMgr->getRootSceneNode()->createChildSceneNode("levelNode"); 
Entity* ent = mSceneMgr->createEntity( "myRat", "Rat.mesh" );
levelNode->attachObject( ent );
I haven't tried to animate it, move it or anything...simply load and display it.

If I don't attach it, I get ~300FPS. If I attach it, I get ~7. The mesh exporter I'm using was one from a few pages back, but I updated to the one above by Wasted, and no change.

Any ideas?


EDIT: randomly - instead of going down to 7, it'll only go down to 12 instead...but it won't display the texture on some of my other meshes.
EDIT2: if the event I just mentioned occurs, the framerate doesn't matter whether the rat is on-screen or not - framerate is still low. If the texture does render, the framerate will be 7...but only if the rat is on-screen. Additionally, I coded in for my rat to use one of my animations...it animated.

I'm at a total loss.
0 x

User avatar
mcaden
Goblin
Posts: 206
Joined: Wed Jul 02, 2008 9:29 am
Location: Texas, USA
Contact:

Post by mcaden » Fri Sep 19, 2008 6:21 pm

umm...solved...

I closed Blender, and the problem went away. It doesn't make any sense to me, but that's all I did and the problem disappeared completely.
0 x

User avatar
almondega
Halfling
Posts: 67
Joined: Mon Jun 23, 2008 7:34 pm
Location: Brazil

Post by almondega » Sun Sep 21, 2008 5:54 am

what is the last version?
that from Wasted dated 31.08.2008
or from the first topic page?
or that from lf3thn4d dated Fri Aug 29 ?

i saw some bytes diferense between this releases..
we need luck to have the right release..
0 x

Post Reply