• 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
1
Question by Fawar · Feb 24, 2015 at 08:47 PM · renderingunity 4.6post-process-effectprojection

Skew entire game for projection

We have a projector and it needs to be at a certain angle toward the screen so the player can be infront of the screen and infront of the kinect without blocking the projector.

Doing so result in horizontal skew, which our projection does not have internal support to fix.

We are looking for a way to ''skew'' the entire game with arrows and fix it manually when set up or booth.

Anyone as an idea on how to do this simply? Post process effect? Idk precisely what I'm actually looking for, but it's generaly named a solution :)

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by gfoot · Feb 24, 2015 at 09:01 PM

You can directly write to camera.projectionMatrix to get the kind of effect you want. The trick is knowing what to write, but you should probably look elsewhere for that - e.g. this StackOverflow thread:

http://stackoverflow.com/questions/16723674/skewed-frustum-off-axis-projection-for-head-tracking-in-opengl

Regarding setting the projection matrix in Unity, here is an example that sets an off-centre projection, though not the maths you need for your case:

 public void Update()
 {
     camera.projectionMatrix = PerspectiveOffCenter(left, right, bottom, top, dist, camera.nearClipPlane, camera.farClipPlane);
 }

 static Matrix4x4 PerspectiveOffCenter(float left, float right, float bottom, float top, float dist, float near, float far)
 {
     float x = 2.0f * dist / (right - left);
     float y = 2.0f * dist / (top - bottom);
     float a = (right + left) / (right - left);
     float b = (top + bottom) / (top - bottom);
     float c = -(far + near) / (far - near);
     float d = -(2.0f * far * near) / (far - near);
     float e = -1.0f;
     var m = new Matrix4x4();
     m[0, 0] = x;
     m[0, 1] = 0;
     m[0, 2] = a;
     m[0, 3] = 0;
     m[1, 0] = 0;
     m[1, 1] = y;
     m[1, 2] = b;
     m[1, 3] = 0;
     m[2, 0] = 0;
     m[2, 1] = 0;
     m[2, 2] = c;
     m[2, 3] = d;
     m[3, 0] = 0;
     m[3, 1] = 0;
     m[3, 2] = e;
     m[3, 3] = 0;
     return m;
 }
Comment
Add comment · Show 1 · 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 Fawar · Mar 02, 2015 at 04:05 PM 0
Share

Ill try this out sooon, seems a promising way of fixing our problem

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Modify values on VolumeProfile URP. 1 Answer

Grab a texture from camera, before it adds the skybox? 0 Answers

make your camera see through an Image!! 2 Answers

URP: How can I view ScriptableRendererFeature in scene view? 1 Answer

How to properly use RTHandles in HDRP for post effects 0 Answers


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