-
|
|
|
For the same game as my previous post, I want to have the players be models and interact with a 2D enviornment around them. How do I have the 2D and the 3D coexist?
-- Sir Cmpwn
|
|
-
-
- (0)
-
premium membership
-
Posts
101
|
|
I think that you may have the concept of 2.5D backwards. 2.5D means 2D sprites/objects exists in a simulated 3D world. It deals with depth buffers, billboarding, etc to give the illusion of a 3D world using the resources of a 2D one. To answer your post above, if you already have the 3D models, you might try the simple brute force method. Pose all your models how you want them, and take screenshots to use as sprites and animations. Kind of time consuming but rather simple, and you cant really go wrong. Hope this helps.
Good Luck!
-Merc
|
|
-
|
|
|
MercilessShadow:I think that you may have the concept of 2.5D backwards. 2.5D means 2D sprites/objects exists in a simulated 3D world. It deals with depth buffers, billboarding, etc to give the illusion of a 3D world using the resources of a 2D one. To answer your post above, if you already have the 3D models, you might try the simple brute force method. Pose all your models how you want them, and take screenshots to use as sprites and animations. Kind of time consuming but rather simple, and you cant really go wrong. Hope this helps.
Good Luck!
-Merc
I was thinking of doing something similar with my game. How would you go about forcing them into 2d?
|
|
-
-
- (0)
-
premium membership
-
Posts
101
|
|
Most modeling software has a very simple solid color background. After you pose the model the way you want it, you orient the viewport of the modeling software to look at the object so you get the objects side view for example. Then you move through the "walking" animation for example, and with a certain interval you take a screen shot. You can now take this collection of screenshots into any pixel editing software, like photoshop, paint, etc. and delete the background, so all that is left in the image file is your object. After you do this for all of them, and resize as necessary, etc, and you now have a collection of sprites, that if you play in the correct sequence will make up an animation. I hope that clarifies it!
Good Luck!
-Merc
|
|
-
|
|
|
Oh, thank you. I was thinking that there was a way to do it in real time within the code itself, but I guess that would be very impractical :p. The only problem I could see with this would be the lighting, but I guess if you just had all the sprites oriented the same way in the game, it wouldn't look too weird.
|
|
-
-
- (0)
-
premium membership
-
Posts
101
|
|
You know, now that I think about it, there might be. What you might be able to do is copy the DrawModel function code from the 3D Tutorial and instead of passing it 3D Camera information, just pass it your 2D camera and viewport information. You would have to play with the orientation of the model, so that it displays as intended in your viewport, but I think that might actually work.
Good Luck!
-Merc
|
|
-
|
|
|
2.5D is quite an ambiguous term, some say a game like Doom is 2.5D, others say New Super Mario Bros is 2.5D.
I'm using 3D models in a 2D game if that's what you're talking about. There's not really anything particular special you need to do for it to work. Just render them with an orthographic projection. There's a few little things like changing render states between rendering models and using a spritebatch, but the concept is simple.
I guess orienting the model correctly is a bit tricky. I do it with two separate steps. First the model is rotated in all 3 dimensions to get the base orientation. This is just for display purposes. Then I rotate again by the new Z axis. This is the rotation as it's seen by the 2D game world, and it's used for collision detection and physics.
|
|
-
|
|
|
In the gaming world, 2.5D is when a 3D enviornment is rendered and all of the gameplay is in 2D, such as Kolona and the new Sonic games. 2.5D is where there is 3D enviornents, but the player can only move in 4 directions (as opposed to 6). Even though I know that this idea really isn't 2.5D, its the best word I can come up with. How would this kind of idea be executed as to where the backgrounds and such were just sprites, but the players were models. The animations I want to use are very complex, and a lot of sprites is utterly impractical. I considered the idea, but if I want tranistions between animations, and different sequences, and combining different animations, I'm not going to take the time to make that work in 2D. But I want the gameplay to be 2D, and don't want to render and build an entire 3D environment.
-- Sir Cmpwn
|
|
-
-
- (2165)
-
premium membership
-
Posts
587
|
|
If you check out TorqueX 2d and 3D they can be combined, you can have 3D objects in torqueX 2D, and use the 2D editor, code etc.
|
|
-
|
|
|
Sir Cmpwn:In the gaming world, 2.5D is when a 3D enviornment is rendered and all of the gameplay is in 2D, such as Kolona and the new Sonic games. 2.5D is where there is 3D enviornents, but the player can only move in 4 directions (as opposed to 6). Even though I know that this idea really isn't 2.5D, its the best word I can come up with. How would this kind of idea be executed as to where the backgrounds and such were just sprites, but the players were models. The animations I want to use are very complex, and a lot of sprites is utterly impractical. I considered the idea, but if I want tranistions between animations, and different sequences, and combining different animations, I'm not going to take the time to make that work in 2D. But I want the gameplay to be 2D, and don't want to render and build an entire 3D environment.
Sounds like we are doing the same thing then. I do it by rendering all my sprites with a spritebatch, then using a side-on (i.e. looking down the Z axis) orthographic projection to render the 3D models. An orthographic projection means that there is no perspective. So however far away an object is, it will appear the same size as things that are closer. If you set up your projection matrix right, if you place a model at say (300,300,10) and a sprite at (300,300) they will appear at the exact same place on screen.
|
|
-
|
|
|
Thanks for the info
How would I make a orthographic projection work? Odd are that it would not be needed because I would just not move the models on the z, though. More importantly (neglected to mention this earlier), how would I sync the 2D camera with the 3D?
-- Sir Cmpwn
|
|
-
|
|
|
Sir Cmpwn:Thanks for the info
How would I make a orthographic projection work? Odd are that it would not be needed because I would just not move the models on the z, though. More importantly (neglected to mention this earlier), how would I sync the 2D camera with the 3D?
If you want to accurately synch it with a 2D camera, you will need to use orthographic projection. Even though you won't be moving things on the Z-axis, it's still important to remove perspective if you want coordinates in your 3D world space to map directly to 2D screen coordinates. Otherwise, things near the edge of the screen would appear smaller than things towards the centre because they would be further away from the camera which is located at a single point in space.
To create an orthographic projection you create your projection matrix with this method. If you set the width and height to be the width and height of your viewport, then you have a direct mapping between 3D and 2D coordinates. Although one thing to be careful of is that using this method the origin is at the centre of the screen, where as the spritebatch places the origin at the top left.
|
|
-
-
- (1015)
-
premium membership
-
Posts
576
|
|
You don't have to do orthographic projection, or sync 2D cameras with 3D. My game has 3D terrain (just platforms really) and the rest is pretty much 2D. The easiest way to do it is to render all of your 2D parts as billboards. Just a 2 triangle object in the 3D world. You can still use SpriteBatch for the menu and hud, but if you render your 2D game elements as quads in the 3D world, you get all the benefits of the depth buffer and avoid any camera sync issues. Also, you can make great use of the 2D physics engines out there.
|
|
-
|
|
|
Thanks for the link, Psyk60. I'm going to try the orthographic projection and see if it works. The billboard idea seems a little complex to me, so I'll try that after the orthographic method. Fortunately, I know 3D projection in and out, and am pretty sure that an orthographic projection will do the trick. With the perspective matrix and billboards, it won't look as crisp, and will be a bigger toll on the graphics card.
-- Sir Cmpwn
|
|
-
|
|
|
Roonda:You don't have to do orthographic projection, or sync 2D cameras with 3D. My game has 3D terrain (just platforms really) and the rest is pretty much 2D. The easiest way to do it is to render all of your 2D parts as billboards. Just a 2 triangle object in the 3D world. You can still use SpriteBatch for the menu and hud, but if you render your 2D game elements as quads in the 3D world, you get all the benefits of the depth buffer and avoid any camera sync issues. Also, you can make great use of the 2D physics engines out there.
That would work too, but it would give a different effect, so it depends exactly what look you are trying to achieve. I dabbled with the idea of doing that but it wouldn't have worked very well in my case. The plan was to have 2D backdrops that might be of things that are meant to be quite close to the foreground, and then platforms that extend out from that. But I figured that would look weird because it would be very obvious to the player that those backgrounds were not 3D as they moved around. So in the end I went with something that is intended to look entirely 2D, but uses 3D models for certain scenery pieces and characters. If you want your game to actually look 3D, then your approach makes sense.
You might ask why I'm bothering with 3D assets at all since in the end it's all going to look 2D. The main reason really is that the artists I'm working with are more experienced with 3D modelling and animation than drawing sprites. Of course we could have done it in the style of Donkey Kong Country and pre-rendered animation sequences and then used them as sprites. But why bother when we have perfectly good real time rendering capabilities? Putting the models directly in the engine seems more flexible because we can freely rotate them and can apply effects such as dynamic lighting with shaders.
|
|
|