About 3D and animations

edited May 10 in raylib: models
I originally posted this question in the raylib subreddit, but I think it's abandoned, so I will do it again here.

I've been exploring the different examples that come with raylib and experimenting a little. I also have been considering the possibility of starting to develop a complete game with the library.

I'm thinking about starting development of a simple 3D project. Thanks to the examples I understand how to load a 3d model with it's textures. Nevertheless, I don't see any facilities for 3D animation. Is it possible to get 3d models to be animated in any way?

All the games that I've made before have been exclusively 2D, so I'll admit that I'm not very experienced on this subjects.

I'm working with blender.

Thanks in advance!

Comments

  • Sincerely, 3D models animation is not an easy topic, to some extend, it works similar to 2D sprites animation: you got multiple frames and you draw one at a time, you only need to change from one to another. Imagine the same but replacing each sprite frame by a 3D model keyframe, you can load all the model frames (multiple .obj models) and just draw the right one at a time.

    Probably you think: wow! that's crazy! I've got a model with up to 20 frames for only one animation! yes, you can load those 20 versions of the same model and draw the same way as sprites, most commercial old 3D games worked that way (they usually packed the multiple .obj models into some custom format).

    Nowadays, there are alternatives like using bones, to some extend it's the same, you use bones to affect multiple vertex of the model, that way, you just load bone changes and then update the required vertex of the model (affected by that bone) before drawing. That principle has been exported to 2D with tools like Spine.

    Summarizing, there is no automatic way to do it with raylib (like LoadAnimation(), PlayAnimation()...), at least yet.
  • Yes, I read about the possibility of just exporting multiple .obj models to animate 3D objects as one would animate 2D sprites, but I thought that this approach would not be very memory-efficient, compared to having only one model and the animation data.

    The good thing is that, well, at least I think, that this frame by frame animation method shouldn't be too difficult for me to implement with the tools that raylib already gives me, and could make a very interesting animation style for a game if well utilized. It would probably look like stop-motion, to some extent.

    But the memory problem worries me a little: If I take, for example, the dwarf.obj model that comes with the examples, it occupies 2.6 MB of memory, and with a hundred frames, I would need to use 260 MB of ram just for this animated 3D object, right?

    Maybe I will just make my game purely 2D, or use 2D sprites for animated characters and 3D for static backgrounds, to simplify things.

    The original Quake used the frame by frame approach, right?
Sign In or Register to comment.