Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML + 3D animations  (Read 6635 times)

0 Members and 1 Guest are viewing this topic.

Alejandro

  • Newbie
  • *
  • Posts: 27
    • View Profile
SFML + 3D animations
« on: April 06, 2011, 10:30:47 pm »
First of all I would like to say hello to the community as I believe this is my first post in the forum, though I have been viewing the progress on this library and am currently using it in my project.

The game I am trying to make is isometric, which can be pretty easily achieved with 2D images for just about anything, besides the character since it is always in the center of the user's vision and the gamer tends to inspect the character model more in it's behavior and complexity.

I know that character animations could be stored in pre-rendered sprite sheets, but making enough renders to achieve some quality of movement and rotation (and possible weapon/armor combinations), it would take a lot of time and effort to make them.

Anyway to the main subject of the thread.

I have seen in previous threads that SFML could be used with 3D engines that support OpenGL and a particular example was Horde3D. I found the there used to be a link to show an example of using it, but it doesn't work since it was posted about 3 years ago.

Could somebody take his time and explain how I could possibly load 3D models and render their animation in SFML through any engine/library capable of that as it seems that I am not the only one that has requested such information and I doubt that there aren't people who have achieved this.

Cheers, Alejandro

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFML + 3D animations
« Reply #1 on: April 07, 2011, 01:43:34 am »
Hello Alejandro,

the advantage is that you can use any OpenGL calls you want to. You only have to make sure to keep your OpenGL states clean and activate the proper window/rendering context.

A nice 3D model library I'm also currently using is Assimp. It's open source and capable of loading a whole bunch of 3D model formats. It also supports animations (keyframe and armatures/bones).

However, you still have to render the triangles by yourself. If you want help in that case, you'd need to stick to a more complete engine like Ogre, Irrlicht, Horde3D, whatever.

In most 3D engines you can choose when you want your scene to be rendered, so it's no problem to make it work together with SFML since any OpenGL calls are absolutely no problem.

Alejandro

  • Newbie
  • *
  • Posts: 27
    • View Profile
SFML + 3D animations
« Reply #2 on: April 07, 2011, 11:10:13 am »
Thank you for your post, Tank.

I looked at the OGRE and Irrlicht engines. It seems to me that OGRE is too complicated and demands high-end software. Horde3D has an irritating resource loading system, which canceled it as an option for me as well.

From the features of Irrlicht I realize that it can load the file formats that it can animate on it's own so I don't think that AssImp will be needed if I stick to Irrlicht.

However I find it hard to manage the rendering of the 3D character from Irrlicht on top of the map drawn by SFML. Irrlicht requires it's own window/context (I am not keen on graphics programming so excuse me if I am getting it wrong) to render things on, while SFML requires it's own as well.

I decided to google on this topic before making another post, but the only thing I found was this thread: http://www.sfml-dev.org/forum/viewtopic.php?p=7130&sid=7ecffa447d1925a4265be68dd0f11420 in which nothing was explained on how to synchronize the 2 rendering engines.

If someone could provide me with a written code solution, rather than hints on how to achieve this I would appreciate it very much :)

Edit1:
With the help of a friend of mine I got to use the Irrlicht engine inside the SFML window, but I can't seem to render things correctly, probably due to openGL states. I tried whatnot but it doesn't seem to fix the rendering.

Anyway for those interested in making a valid device for Irrlicht here is the code I used (found it on an old french forum and made it work with sfml)

Code: [Select]

IrrlichtDevice* device;
SIrrlichtCreationParameters Parameters;
    Parameters.DriverType = video::EDT_OPENGL;
    Parameters.Bits = 16;
    Parameters.Fullscreen = false;
    Parameters.Stencilbuffer = true;
    Parameters.Vsync = true;
    Parameters.AntiAlias = true;
    Parameters.HighPrecisionFPU = false;
    Parameters.WindowId = App.GetSystemHandle();

    device = createDeviceEx(Parameters);