MD5 Loader
MD5 Loader
Today, after i regained access to my beloved forum account ^^ i started writing a MD5 model loader. Currently it's able to load the bare meshes and to display them. The hardest thing is getting familiar with the irrlicht source again ^^ The loader is at the moment just a loader which loads the data and passes it to the SkinnedMeshNode. I'm not yet sure, whether i need to extend the SkinnedMeshNode or not, cause there are several meshes in one md5mesh file and i'm not yet familiar to the details of the way SkinnedMeshNode animates and handles animations.
I have also written a converter to convert the .md5mesh files to a binary format, cause that's easier to handle, at least if one uses c++.
(It's kinda late over here, so if something sounds weird, feel free to ask The same holds true if you have any general questions, comments or wanna blame me ^^ )
[TODO-LIST]
- implement bounding boxes
[FEATURE-WISHLIST]
- attaching sceneNodes to a specific joint
- hardware skinning
[last update]
14.08.09
[Current-Win32-Demo]
[Current-sourcode-release]
greetz
r2
I have also written a converter to convert the .md5mesh files to a binary format, cause that's easier to handle, at least if one uses c++.
(It's kinda late over here, so if something sounds weird, feel free to ask The same holds true if you have any general questions, comments or wanna blame me ^^ )
[TODO-LIST]
- implement bounding boxes
[FEATURE-WISHLIST]
- attaching sceneNodes to a specific joint
- hardware skinning
[last update]
14.08.09
[Current-Win32-Demo]
[Current-sourcode-release]
greetz
r2
Last edited by r2d2 on Fri Aug 14, 2009 5:15 pm, edited 4 times in total.
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Yeah sio2 was also working on one, but i couldn't find his sourcecode and afaik he doesn't use the SkinnedMeshSceneNode.
The shading and lightning of the model are on the bottom of the priority list, cause implementing that is not that hard. Oh yeah the priority list, here you go:
r2
The shading and lightning of the model are on the bottom of the priority list, cause implementing that is not that hard. Oh yeah the priority list, here you go:
- correct handling of multiple meshes in one md5mesh file
- animations
- implementing the shaders
r2
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
The SkinnedMesh stuff didn't exist when I did my MD5 stuff (or it was not not part of official Irrlicht). I'd advise continuing what your doing in trying to load the MD5 data into the skinmesh node if you can.
If I remember correctly there were shaders for GLSL and HLSL in my demo download. Feel free to use those as a base, but lighting didn't quite seem right in my demo - though it sounds that you can easily fix that.
If I remember correctly there were shaders for GLSL and HLSL in my demo download. Feel free to use those as a base, but lighting didn't quite seem right in my demo - though it sounds that you can easily fix that.
Irrlicht Demos: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=6&t=45781
r2d2: From what you know about about the MD5 format, do you think that you could add the capability to get a positional and rotational vector of a submodel? I ask because a game I'm working on is in need of a format where we can get the position to fire a weapon from in the model as well as other special points.
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
"I'll find out if what I deleted was vital here shortly..." -d3jake
You could do collision checks against the boundingboxes of the meshes joints and retrieve the joint name, but i don't know much about collision detection and what would be needed to integrate something like that into Irrlicht, but it's basically possible and i would recommend joint based (other people call it bone based) models to do something like that.
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Sure, but we will have to think of a way how Irrlicht should handle the animations cause MD5 animations are saved in different files than the meshes and if the bone/joint structure of two models match, they may use the same animations, that's one reason why i created that thread.
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Hmm... Interesting idea.. Thanks for the information.r2d2 wrote:You could do collision checks against the boundingboxes of the meshes joints and retrieve the joint name, but i don't know much about collision detection and what would be needed to integrate something like that into Irrlicht, but it's basically possible and i would recommend joint based (other people call it bone based) models to do something like that.
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
"I'll find out if what I deleted was vital here shortly..." -d3jake
Bitplane: yeah that sounds good.
Does anyone have some pseudocode which explains how the SkinnedMesh handles the weights, cause it seems to be quite strange and if it really works the way i think it works, we might run into a severe performance problem. Is the way the SkinnedMesh uses weights adapted from the B3D modelformat? If it is then we need to implement a new mesh, converting the MD5 joint data to B3D joint data would create a severe performance impact if it is possible.
The B3D format uses a main model in which every vertex is affected by several joints according to a weighting factor. The MD5 format uses different vertices (called weights) which in turn are affected by a joint to construct one "real" vertex like this:
So one "real" vertex is affected by many weights, which are affected by the joints they belong to. Every single weight may affect several "real" vertices. In contrast, the B3D vertices are affected by several joints. They are just single vertices not consisting of several weights. Trying to create a relationship which is equal to the one used in B3D models out of MD5 models would be an overkill. So i would suggest writing a whole new Mesh, if the SkinnedMesh Irrlicht uses really works that way.
I hope this post is not too confusing ^^
Greetz
r2
Does anyone have some pseudocode which explains how the SkinnedMesh handles the weights, cause it seems to be quite strange and if it really works the way i think it works, we might run into a severe performance problem. Is the way the SkinnedMesh uses weights adapted from the B3D modelformat? If it is then we need to implement a new mesh, converting the MD5 joint data to B3D joint data would create a severe performance impact if it is possible.
The B3D format uses a main model in which every vertex is affected by several joints according to a weighting factor. The MD5 format uses different vertices (called weights) which in turn are affected by a joint to construct one "real" vertex like this:
Code: Select all
for(int j = 0; j < meshes[curmesh].vertices[i].countWeight; j++)
{
MD5Weight weight = meshes[curmesh].weights[meshes[curmesh].vertices[i].startWeight + j];
MD5Joint joint = frames[0].joints[weight.joint];
core::vector3df rotatedWeight = weight.pos;
joint.orientation.getMatrix().rotateVect(rotatedWeight);
vert.Pos += ((joint.pos + rotatedWeight) * weight.bias);
}
I hope this post is not too confusing ^^
Greetz
r2
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Update:
after finally finishing my Bachelorthesis and the accompanying exams i got back to work on this loader. I am currently rewriting parts of the SkinnedMesh class, to fit the bonesystem md5 uses, it shouldn't be a big problem to convert the other models to this system, too. As for now, i am able to load the basic models. Now i have to think about animations. I'm not yet sure how i should handle them. The big advantage of boneanimation is that you can apply an animation to every model (as long as they got the same bones). No more messing around with frame ranges. No more messing around with models which only got 5 and a half animation and especiall no need to animate every single model in 3ds max by hand
But as i said i am not yet sure how i should handle animations cause Irrlicht hasn't got a real animation system, just that frame based stuff you have to take yourself care of. I am not sure whether i should make everything fit to that framebased system Irrlicht uses or whether i should extend the SkinnedMesh and Irrlicht even more. Any suggestions, comments, criticism?
so far
greetz
r2
after finally finishing my Bachelorthesis and the accompanying exams i got back to work on this loader. I am currently rewriting parts of the SkinnedMesh class, to fit the bonesystem md5 uses, it shouldn't be a big problem to convert the other models to this system, too. As for now, i am able to load the basic models. Now i have to think about animations. I'm not yet sure how i should handle them. The big advantage of boneanimation is that you can apply an animation to every model (as long as they got the same bones). No more messing around with frame ranges. No more messing around with models which only got 5 and a half animation and especiall no need to animate every single model in 3ds max by hand
But as i said i am not yet sure how i should handle animations cause Irrlicht hasn't got a real animation system, just that frame based stuff you have to take yourself care of. I am not sure whether i should make everything fit to that framebased system Irrlicht uses or whether i should extend the SkinnedMesh and Irrlicht even more. Any suggestions, comments, criticism?
so far
greetz
r2
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Update:
ok i managed to rewrite the most important parts. Faty is now able to move but the shading looks somewhat incorrect and the lightvector is moving when the camera is moving, i think i am just a little bit too tired ^^
ok i managed to rewrite the most important parts. Faty is now able to move but the shading looks somewhat incorrect and the lightvector is moving when the camera is moving, i think i am just a little bit too tired ^^
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL