Custom 3D format

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
FroggestSpirit
Posts: 5
Joined: Sun Nov 08, 2015 2:49 pm

Custom 3D format

Post by FroggestSpirit »

Hello, I'm new to Iirlicht, and have been wanting to start porting my game over to it (a 3D platformer).
I have made a custom model format a while back along with my own animation format. I was hoping to port these over to the Iirlicht engine. I've spent some time looking through some of the source for the various model loaders, and I'm a bit confused. I figured I would start looking at the C3DSMeshFileLoader.cpp file, and It seemed to make some sense, except I feel like there are still parts missing that must be defined somewhere else (like the buffer structure for the model). I figured I would come on here to ask, because I haven't made much progress myself.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Custom 3D format

Post by CuteAlien »

For animated models you should probably better take a look at CXMeshFileLoader.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
FroggestSpirit
Posts: 5
Joined: Sun Nov 08, 2015 2:49 pm

Re: Custom 3D format

Post by FroggestSpirit »

Thanks, I'll look into that, but I thought it would probably be easier to start with static models first. I've never done skinning before, but I think I have a basic Idea how I want to implement it. X format does use skinning though, right?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Custom 3D format

Post by CuteAlien »

Yeah, static model is easier.

For static meshes Irrlicht has classes like SMesh (derived from IMesh) in the include folder which can be used in custom loaders. For skinned meshes you need to create a mesh which is derived from ISkinnedMesh. Seems the only implementation of that is currently inside source/Irrlicht/CSkinnedMesh.cpp/.h it seems. So if you implement a loader outside of Irrlicht you probably have to copy that (better also rename it to avoid any confusion).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
FroggestSpirit
Posts: 5
Joined: Sun Nov 08, 2015 2:49 pm

Re: Custom 3D format

Post by FroggestSpirit »

I took a look in SMesh.h, and was trying to find a way to add vertices and faces. I'm a little new to using irrlicht still, but I was wondering if I can just basically load my whole model into RAM, and have pointers to the different parts, like vertices, faces, etc. I just haven't found where this would be defined, or what the variables would be. Or if there's a structure I could load my model into RAM as
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Custom 3D format

Post by CuteAlien »

Maybe the gloassary in the wiki helps to get a rough overview: http://irrlicht3d.org/wiki/index.php?n= ... ommonTerms

A mesh consists of meshbuffers - so you have to fill those and add them to the mesh.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
FroggestSpirit
Posts: 5
Joined: Sun Nov 08, 2015 2:49 pm

Re: Custom 3D format

Post by FroggestSpirit »

I think I understand. I came across this too http://irrlicht.ru/api/classirr_1_1scen ... l#_details
If i'm reading that right, I can use that to point to buffers of vertices (which I'm guessing are 32bit floats, X,Y,Z) and indices (which I'm guessing are ints or something, and that draws triangles).
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Custom 3D format

Post by CuteAlien »

You are right with the indices. The vertices have some additional information. Currently Irrlicht supports 3 different vertex-types:
S3DVertex, S3DVertex2TCoords and S3DVertexTangents.

So you have to decide which features you need. Generally you start with S3DVertex. If you need more then the other two are derived from that(and if all 3 are not enough... we plan a more flexible format one day).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
FroggestSpirit
Posts: 5
Joined: Sun Nov 08, 2015 2:49 pm

Re: Custom 3D format

Post by FroggestSpirit »

I think the first two will be plenty enough since I'm going for more of a super mario 64 type game. Thank you for all your help! I think this is enough info to get me started
Post Reply