load meshes from blender
load meshes from blender
Hi everyone,
first, I'm french, so excuse me for my approximative english.
I try to load my meshes from blender to irrlicht. I didn't know which format to use. I want to use OpenGl so I don't want to use the .x format.
I'm actually trying with the .oct format. I've exported my meshes with the python script "oct_export.py" found in the OCTTools.
Now I load it in irrlicht, no compilation error, the file seems to be loaded (the output window says : "loaded texture : #default font, loaded mesh : gus6.oct"), everything seems to be ok... but I can't see my mesh...I got an empty screen!
This is my code :
#include <stdio.h>
#include <wchar.h>
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ISceneNode* node = 0;
IrrlichtDevice* device = 0;
int main()
{
device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(800, 600),
16, false, false, false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
smgr->addAnimatedMeshSceneNode(smgr->getMesh("media/gus6.oct"));
smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
device->getCursorControl()->setVisible(false);
while(device->run())
{
driver->beginScene(true, true, video::SColor(255,113,113,133));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Does anyone could help me, please? Or do you know a good way to import file from blender to irrlicht?
Thanks a lot for your answers!
first, I'm french, so excuse me for my approximative english.
I try to load my meshes from blender to irrlicht. I didn't know which format to use. I want to use OpenGl so I don't want to use the .x format.
I'm actually trying with the .oct format. I've exported my meshes with the python script "oct_export.py" found in the OCTTools.
Now I load it in irrlicht, no compilation error, the file seems to be loaded (the output window says : "loaded texture : #default font, loaded mesh : gus6.oct"), everything seems to be ok... but I can't see my mesh...I got an empty screen!
This is my code :
#include <stdio.h>
#include <wchar.h>
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ISceneNode* node = 0;
IrrlichtDevice* device = 0;
int main()
{
device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(800, 600),
16, false, false, false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
smgr->addAnimatedMeshSceneNode(smgr->getMesh("media/gus6.oct"));
smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
device->getCursorControl()->setVisible(false);
while(device->run())
{
driver->beginScene(true, true, video::SColor(255,113,113,133));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Does anyone could help me, please? Or do you know a good way to import file from blender to irrlicht?
Thanks a lot for your answers!
Re: load meshes from blender
There is no problem with using the x format with OpenGL!Fanfan wrote:I want to use OpenGl so I don't want to use the .x format.
Get the latest X exporter here:
http://development.mindfloaters.de/Downloads.12.0.html
(Version 1.2.1 is included in Irrlicht, current version is 1.3)
It is like it is. And because it is like it is, things are like they are.
Ok, I've just tested the version 1.1.3 of the x exporter...
1)It is ok, with a simple scene (the default one : just a cube, a lamp and a camera), the export is ok, I import it in irrlicht, got no error message,... but I can't see my mesh on the screen! Is there a probleme in my code?
2)I can't export a more complex scene with the script. The error message is :
Traceback (most recent call last):
File "<string>", line 1529, in ?
File "<string>", line 1470, in my_callback
File "<string>", line 573, in writeRootBone
File "<string>", line 493, in exportMesh
File "<string>", line 964, in openMeshBlock
IndexError: list index out of range
I've tried to install python 2.3.5 on my computer, I've tried to select only one object to export, but it still doesn't works...
1)It is ok, with a simple scene (the default one : just a cube, a lamp and a camera), the export is ok, I import it in irrlicht, got no error message,... but I can't see my mesh on the screen! Is there a probleme in my code?
2)I can't export a more complex scene with the script. The error message is :
Traceback (most recent call last):
File "<string>", line 1529, in ?
File "<string>", line 1470, in my_callback
File "<string>", line 573, in writeRootBone
File "<string>", line 493, in exportMesh
File "<string>", line 964, in openMeshBlock
IndexError: list index out of range
I've tried to install python 2.3.5 on my computer, I've tried to select only one object to export, but it still doesn't works...
1) Maybe your camera is to far away, so the mesh is just to small to see it?
smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
2) Have you selected the object(s) to export in object mode? This error message doesn't help so much. It would be great if you could you send me an example *.blend file to track down the problem. You find my email address in the exporter python file.
smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
2) Have you selected the object(s) to export in object mode? This error message doesn't help so much. It would be great if you could you send me an example *.blend file to track down the problem. You find my email address in the exporter python file.
It is like it is. And because it is like it is, things are like they are.
1) oops, you're right, my camera was on/inside the cube, so I couldn't see it!
next question : is there a way to obtain natives blender's textures? (I mean non-UV textures)
Now it's ok to load it, but only if I put "EDT_SOFTWARE" in this line of my code : device = createDevice(video::EDT_SOFTWARE, core::dimension2d<s32>(800, 600), 16, false, false, false);
It doesn't works with the parameters EDT_OPENGL (can't see anything) or with EDT_DIRECTX (bug message and close Dev-cpp)...
2)yes i've selected all the objects in object mode...Ive just send you the .blend...
thx
next question : is there a way to obtain natives blender's textures? (I mean non-UV textures)
Now it's ok to load it, but only if I put "EDT_SOFTWARE" in this line of my code : device = createDevice(video::EDT_SOFTWARE, core::dimension2d<s32>(800, 600), 16, false, false, false);
It doesn't works with the parameters EDT_OPENGL (can't see anything) or with EDT_DIRECTX (bug message and close Dev-cpp)...
2)yes i've selected all the objects in object mode...Ive just send you the .blend...
thx
@Fanfan: Sorry for the late reply. Yes I received your blend file. The problem is, your Object is a "SubSurf" mesh not a polygon mesh. You have to convert it first. To do this go to object mode, select your object and choose "Convert Object Type" in the Object menu. You might want to replace the old (SubSurf) object with the new mesh object in your object hirarchy afterwards.
It is like it is. And because it is like it is, things are like they are.
ok, thanks for your analysing jox!
I removed the subsurf and changed my object hierarchy. My new hierarchy is : the armature is the parent of all other objects : the body of my perso, his eyes, his mouth, and the buttons of his jacket.
I removed the textures and added an uv texture.
The export seems to be ok, it says : "has uv : yes", "materials : 0"
But when I load it in Irrlicht, I still can't see anything, it says : "no opening brace in mesh material found in x file".
And when I open my .x, I can see the old materials I've remove in the blend file... wow... think I've got a problem to remove definitely the textures from my blend file.
And what about my hierarchy? does the exporter export my perso with his mouth, eyes and buttons? or only the perso?
well, I think I still need your help...
I removed the subsurf and changed my object hierarchy. My new hierarchy is : the armature is the parent of all other objects : the body of my perso, his eyes, his mouth, and the buttons of his jacket.
I removed the textures and added an uv texture.
The export seems to be ok, it says : "has uv : yes", "materials : 0"
But when I load it in Irrlicht, I still can't see anything, it says : "no opening brace in mesh material found in x file".
And when I open my .x, I can see the old materials I've remove in the blend file... wow... think I've got a problem to remove definitely the textures from my blend file.
And what about my hierarchy? does the exporter export my perso with his mouth, eyes and buttons? or only the perso?
well, I think I still need your help...
The exporter will export all and only selected meshes.
Can you send me your current blend and x file?
"no opening brace in mesh material found in x file" sounds a bit scary to me. I wonder how that can happen.
Btw. I have released version 1.3.1 of the exporter. This one checks if the objects contain SubSurf meshes and shows a warning if so.
http://development.mindfloaters.de/Downloads.12.0.html
Can you send me your current blend and x file?
"no opening brace in mesh material found in x file" sounds a bit scary to me. I wonder how that can happen.
Btw. I have released version 1.3.1 of the exporter. This one checks if the objects contain SubSurf meshes and shows a warning if so.
http://development.mindfloaters.de/Downloads.12.0.html
It is like it is. And because it is like it is, things are like they are.
Hi,
ok, I've got now the new exporter. (I don't have anymore subsurf )
I think my problem comes from a bad link between the uv texture and the .blend...
(in fact, i'm not an expert of blender and it seems to me that the uv is not attached to the mesh, but i tried in vain...)
Moreover, the textures I've removed are still in the .x
How can I definitely remove them?
ok, I've got now the new exporter. (I don't have anymore subsurf )
I think my problem comes from a bad link between the uv texture and the .blend...
(in fact, i'm not an expert of blender and it seems to me that the uv is not attached to the mesh, but i tried in vain...)
Moreover, the textures I've removed are still in the .x
How can I definitely remove them?
ok, I solved my texture problem : the problem was that I hadn't well linked my UV with my mesh : I didn't do a new material in the material panel and didn't click on "Texface"...
I now got two new problems, probably due to a bad object hierarchy :
1)my gingerbread man is exported and loaded into irrlicht, but without his eyes, his mouth, his buttons, ...
2)his head his deformed in irrlicht
3)when I execute my program, the console says :
Unknown Joint referenced in x file : HautJamb_R
Unknown Joint referenced in x file : BasJamb_R
Unknown Joint referenced in x file : HautJamb_L
Unknown Joint referenced in x file : BasJamb_L
...and this for every bones!
I now got two new problems, probably due to a bad object hierarchy :
1)my gingerbread man is exported and loaded into irrlicht, but without his eyes, his mouth, his buttons, ...
2)his head his deformed in irrlicht
3)when I execute my program, the console says :
Unknown Joint referenced in x file : HautJamb_R
Unknown Joint referenced in x file : BasJamb_R
Unknown Joint referenced in x file : HautJamb_L
Unknown Joint referenced in x file : BasJamb_L
...and this for every bones!
For the head deformation problem, have you given the same origin to both
armature and mesh before exporting? (They must have same rotation and origin)
For 3) I have had your same problem (Unknown Joint reference) I have tried
to make a single armature for Gus and in this way it works but I do not know
what to do to export more than one armature without getting these errors
armature and mesh before exporting? (They must have same rotation and origin)
For 3) I have had your same problem (Unknown Joint reference) I have tried
to make a single armature for Gus and in this way it works but I do not know
what to do to export more than one armature without getting these errors
well, thanks for your answer.
For 2) I think you're right : they don't have the same origin. With NKEY I can see that my mesh has (x=0.296, y=0.012, z=0) and the armature has (x=1.070, y=0.053, z=0.494). But how can I arrange that? Because when I enter the same values, the bones are no longer centered with the mesh...
For 3 : I have only one armature, constituted of 6 bones : 2 for the leg, 2 for the other leg, one for each arm.
but I still have the message....
For 2) I think you're right : they don't have the same origin. With NKEY I can see that my mesh has (x=0.296, y=0.012, z=0) and the armature has (x=1.070, y=0.053, z=0.494). But how can I arrange that? Because when I enter the same values, the bones are no longer centered with the mesh...
For 3 : I have only one armature, constituted of 6 bones : 2 for the leg, 2 for the other leg, one for each arm.
but I still have the message....
@jox : when you told me to convert my mesh from subsurf to polygon, I first thought it was ok.
But now I can notice a problem : when I look my vertex, which are assigned to the closest bones...well they have changed and are no longer well assigned...
and when I re-assign them correctly, I can't export anymore... arf!
But now I can notice a problem : when I look my vertex, which are assigned to the closest bones...well they have changed and are no longer well assigned...
and when I re-assign them correctly, I can't export anymore... arf!