Hello, I was wondering if you guys could help me out. I’m in the early stages of development on my game and I was wondering if it is possible to use a 3d depth of field while using the Unity 2d mode? Here is what I mean.
My game is a 2d platformer so it is viewed in the classic 2d side view. I want the background layers to be displayed in the correct depth so if i make a mountain to scale, i want to stick it far enough in the background so that it is scaled in the distance. The reason being is that I want the player to be able to jump into the background. I realize this can be done but just wasnt sure if you use the 2d perspective that means losing any 3d depth while maintaining a proper 2d illusion. Does any of this make sense? I appreciate any feedback.
Just change the Camera from Orthographic to Prospective, that’s the only way I can see it properly done, so you would technically have a 2.5D game… But from what I’ve seen an Orthographic camera works, but it doesn’t allow any depth that I can tell that makes it show 3d depth.
Now, I know it will work as you have stated but what Im wondering is if the camera will show the edges of my sprites since everything in my scene is a 2d sprite.
There isn’t really any 2D mode. Everything in Unity is 3D, even if you put the scene view in 2D mode. So yes just use a perspective camera; it works fine. Example
–Eric
1 Like
Now i played the game. That looks like what Im talking about. Is that just using a perspective camera instead of the 2d?
The camera is using perspective instead of orthographic, yes.
–Eric
Yeap yeap yeap…
Just change the field of view if you want it more almost like an ortho cam. It will condense the image, so you may have to move camera back a little bit to desired effect.
(what I said is untested) just an assumption, so just remember your settings.
Cool. Now the camera won’t show the edges of the sprites at any point? Also, could you technically zoom in and out of background if the game required the player to jump between foreground and background?
Thanks for the reply guys. You are a big help
One quick tip: you can do all of your physics in 2d, but just attach them to 3d object. 2d physics just ignores the Z axis, which saves on CPU. However that does mean that if two objects pass each other on the X and Y axis, but are not touching on the Z axis, Unity will still register that as a collision.
If that makes sense…
Ok. Cool. Thanks for the tip. I appreciate it.
What do you mean by “show the edges of the sprites”? Sprites don’t have depth, so they won’t look like cardboard cutouts on standees (with thickness) if that’s what you’re asking about.
Thats actually what i was thinking. I was hoping that when the camera moves that it didnt show any edges. So your saying while the game is running, the sprites will look flat no matter where the sprites are?
Sprites are textures on quads, so, being 2-dimensional, it’s impossible to see “edges” under any circumstances. Put a sprite in the scene view, then move the camera around (with 2D mode off) and tell me what you see.
–Eric
Ok. I will do that. Thanks for your input.