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
2
Question by Saduras · Oct 03, 2013 at 09:20 PM · camerarender textureportalportals

Creating portal camera view with render textur

Hi there,

I'm trying to build a simple portal mechanic like the one in Valves Portal and Portal 2. Currently I'm struggling with the visual part. I'm using the Unity Pro feature Render Texture. The Camera creating the render texture for the blue portal is a child of the orange portal game object and is moved by an script relative to the position of the main (player) camera to the blue portal. Rotation and other camera properties are equal to the main camera. Still if I place both portals like an two sided mirror I don't get the wanted window-effect since somehow the render texture doesn't fit right...

In the picture the orange portal is on the back side of the blue one and is rotated by 180 degree. On the left side you see both cameras (main camera & texture camera) having almost the same position. Which seam to be the wrong approach. Can anybody help me to figure out how to move position the texture camera properly?

Thanks alot!

You can find my project here: https://github.com/Saduras/Testchamber

Example of portal Camera

portal-problem-screenshot.jpg (224.5 kB)
Comment
Add comment · Show 4
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 Hoeloe · Oct 03, 2013 at 09:45 PM 0
Share

You're not going to get it perfect like that. You're rendering one angle, while your camera is looking from another. You need to do some maths to rotate your portal cameras to match your main camera, otherwise you've essentially got a TV screen.

avatar image Saduras · Oct 03, 2013 at 09:50 PM 0
Share

Sounds like my approach is not completely wrong. Any hints for the direction of math I should look for? I'm actually pretty good at math, but feels like and don't understand the rules of 3D cameras well enough...

avatar image Hoeloe · Oct 03, 2013 at 09:59 PM 1
Share

Well, you essentially want to match the projection matrix, such that the inner camera's projection point (the frustum of the pyramid) matches the projection of the main camera. Not quite sure how you'd achieve it, but that should work.

avatar image jzx · Dec 31, 2015 at 07:37 PM 1
Share

Working on this myself. This was very helpful for the maths: OpenGL Program$$anonymous$$g/$$anonymous$$ini-Portal

0 Replies

· Add your reply
  • Sort: 

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

16 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Making Portal-Like Objects 2 Answers

Portal effect using render textures: how should I move the camera? 2 Answers

True Portal Effect 1 Answer

create a portal with texture render 3 Answers

Save RenderTarget (Color Format: Depth) into a png as a heightmap 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