Sprites to Models.

Yes, I’ve been here before, but an absolute final decision has just been made. I’ve really enjoyed creating all the sprites I need for the game animation, all the modelling and rendering, all the software I wrote to create shadows and effects. But it’s getting too complicated and I can’t show all the animation sequences I want to, stitching them together is staring to impact game play, and that’s not acceptable. So, Sprites to Models! Well, a highbrid, I’ll still need my particles and game control graphics to be sprites.

I have a small bit of sample code where I’m loading models and moving around in an Orthographic view which it what I need. So I have the basics. However I’m missing a whole load of knowledge about models so I’m going to ask you lovely people a few questions, and beg for small samples of code if you have any.

  1. Being orthographic, I reckon the best thing to do is keep all the models at the same ‘depth’ allowing enough space for cross over/under. Then I can run collision checking in 2 dimensions?

  2. How can I control the ‘depth’ at which sprites get drawn? I will want some to be underneath models, and some will have to be on top.

  3. How - in code - do I apply textures to a model? I’ve looked but can’t find examples.

  4. How do I apply an animation to a model that has moving parts? These aren’t overly complicated, mostly 360’ rotations. I’m using Blender for modelling if that makes any difference.

  5. And all the other things I’ve forgotten!

Many thanks folks, I really do appreciate all the help you’ve provided.

Well, lets get started.
1 you will in fact do 3d collision with the model’s collision boxes or spheres, and if you need more precision, submeshes’ ones.
2 sprites will be a sort of plane always facing the camera (=billboard) so you can place them in 3d too, on the z axis for ex

  1. It’s a 2D game and switching to 3D is an artistic/practical decision, so it shouldn’t matter for collision detection. If you just used Rectangles before, I recommend you stick with that. It doesn’t matter for game logic of your game uses sprites or 3D models if you use proxies for collision anyway. You could render your animated models to a sprite sheet and use that, that way you can keep everything else the same. You can’t do that if you want 3d dynamic lighting for your models of course. I don’t think there’s a way to export like that from Blender (maybe a plugin?), so it might require custom tooling.

  2. The depth you render at with SpriteBatch is the position of the sprites along the z-axis. With models it will be the same, but vertices will be transformed first. In the end all vertices - whether they are rendered through SpriteBatch or Model or in any other way - must end up in this normalized space.

  3. Most 3d model formats can embed textures. MonoGame should be able to handle that as long as the textures are at the same location relative to the model as they were when exporting. The Pipeline Tool will build the textures without you having to add them explicitly.