Creating a texture out of multiple images

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
legacyblade
Posts: 1
Joined: Thu Apr 17, 2014 10:13 pm

Creating a texture out of multiple images

Post by legacyblade »

Hello everyone! I have until very recently been developing my game in 2D. But as development has gone on, I realized I'd like to switch to a 3D environment (as I'm going through great lengths to mimic 3D for my landscape via psudo mode7-ish stuff). I wish for my characters to be 2D sprites in the 3D environment.

I figured the simplest way to do this would to be to create an image plane and render the sprite to that, then draw the plane in the world. However, my sprites are comprised of several parts that are rotated dynamically to create smoother movement. I'm trying to do something similar to what's done in the paper mario games. (https://www.youtube.com/watch?v=g6hw-tJy6QU).

How would I go about creating a texture by combining and rotating various images? The head is one file, the arms are each their own file, the three animation frames for the foot are a file, etc. I want to place the head down, rotate the arm into whatever location it should be for the animation it's in, place the torso, then place two copies of the feet in their proper animation frame. Then I want to render this texture to a plane the dimensions of the resulting texture.

If the above is infeasible, would it be better to have a separate image plane for each part of the body (including eyes and mouth)? Or is this beyond the scope or Irrlicht?

There will be dozens of these sprites on the screen at any given time, so efficiency is a consideration.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Creating a texture out of multiple images

Post by hendu »

You're considering ~20 sprites * N drawcalls. N = 1 if premade texture, but with cpu overhead; N = 6? if you draw each body part separately.

120 vs 20 draw calls is not a big difference even on a four-year old mobile ARM cpu. You can easily afford it, and have more than good performance everywhere. Further, as you don't have the cpu overhead of creating a texture and moving the data over, it may even be faster.

Summary: both ways are feasible, using one plane per body part is easier and likely faster.
Neirdan
Posts: 39
Joined: Tue Aug 14, 2012 10:29 pm

Re: Creating a texture out of multiple images

Post by Neirdan »

Code first, optimize later.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Creating a texture out of multiple images

Post by Mel »

I'd recomend you to use simple skinned meshes created using planes which always faced the screen, or using a shader to perform such effect on its own, that's the simplest and fastest way. In fact, drawing a rotated image is the same as drawing a quad with the image as a texture and rotate the quad, hence, the skinning solution is your best bet here, and it is not a bad bet.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply