Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Lachee1 · Jan 16, 2013 at 09:19 AM · camera2dbackgroundorthographicperspective

Making a camera semi-orthographic

Hello unity community, I am asking if it is possible to make only the bottom of a perspective camera orthographic, in Unity Free. Here why,

I am creating a 2D game, and today was the first day of development and i already encounter an issue that has no easy fix. I want to add a scrolling like background in my game, like what is scene in unity. The issue is that to get the effect right, i need to use a perspective camera. However, this type of camera has a nasty feature, the bottom view goes down. This i bad because every layer has to be slightly lower than the other, and its really frustrating trying to fix it

One way i have thought about to fix it is possibly making the bottom of the camera straight, like orthographic, unfortunately I don't know if its possible and if it is, how do i do it?, so that is why i am posting this question.

EDIT: This is what i am wishing to achieve

alt text

answerquestion01.png (35.8 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image senad · Jan 16, 2013 at 09:36 AM 0
Share

What exactly do you mean by "the bottom view goes down"?? Do you have a screenshot maybe?

avatar image senad · Jan 17, 2013 at 08:06 AM 0
Share

Hmm, I still do not see your problem. :) Why do you want perspective projection for the upper half of the screen?

If you are making a 2D screen, you can have a plane which is orthogonal to the z-axis and place your character on that plane. The background plane will be the same but further from the cam. That should actually look fine, no?

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Loius · Jan 16, 2013 at 09:42 AM

You need to make changes to your camera's projection matrix.

Projection matrices is hard stuff. The internet has lots of resources; I can't give any specifics. It's been way too long since basic 3D graphics class :)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lachee1 · Jan 16, 2013 at 09:49 AM 0
Share

Thanks, just the answer i needed. Glad to know it is possible, just have to try and figure how to work it now :D

What would be really handy though is a tutorial to lead me into matrix, its way ro complex for me at the moment.

avatar image Loius · Jan 16, 2013 at 08:00 PM 0
Share

I think this is the link you want to stare at until your brain bleeds: http://www.songho.ca/opengl/gl_projectionmatrix.html

It terrifies my soul, but it looks like it's got all the right maths and stuff to actually build an entire matrix to do what you need.

You essentially want to make the bottom half of your matrix into an orthographic projection (just lines straight away from the camera), and the top half stay like it is (at an angle). The ortho stuff is at the bottom of the link, and it's very simple - you might be able to just get the current camera matrix and make simple adjustments to it (I've never tried).

avatar image $$anonymous$$ · Jan 17, 2013 at 09:42 AM 0
Share

I don't really see the point of this but I'm interested :D Even if you can construct a matrix that will be ortographic at the bottom and perspective on the top (??), that's not very flexible, since in ortho mode distance doesn't matter, so you'll have a hard time adjusting the background layers to actually seamlessly "transition" into an ortho view without artifacts. So I just don't see the point of the question, nor the proposed solution. Why not just use two cameras and render the background differently?

avatar image Loius · Jan 17, 2013 at 06:20 PM 0
Share

The fact that the projection region blends smoothly should smooth the transition on its own. I imagine it'd be a weird, but unique look. Lots of style to it.

I didn't even think of multiple cameras, though; that could be an easier solution depending on what exactly is wanted.

avatar image
0

Answer by Wolfram · Jan 23, 2013 at 06:15 PM

What you are looking for is an off-axis projection where the optical axis is "shifted" from the center of the screen to the bottom. You can accomplish that by setting the element m[1,2] of a regular projection matrix to 1 instead of 0. (usually denoted as "b", for example here. Instead of top=1 and bottom=-1, you need to use top=2 and bottom=0, the new vertical "distances" of your screen corners from the optical axis. this results in B=1).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Camera 2D RPG in perspective 1 Answer

Why is part of object outside camera frustum visible? 1 Answer

Background Image as Orthographic 2D Game Background - and quick 2D parallaxing question 1 Answer

2d orthographic camera follow 1 Answer

Using a perspective camera can an object act as if viewed by orthographic camera? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges