Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Kourosh · Sep 24, 2010 at 08:43 AM · guiinterfacestereoscopic

GUI and stereoscopic 3D

I'm trying to work on GUI for a stereoscopic 3d package(It includes 2 cameras, left and right and some scripts which divides the screen into two and each shows related camera view. The problem is GUI is rendered on the entire screen rather to be rendered on each camera. How can i tell each camera to render GUI separately in its own screen?

Thanks.

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
Best Answer

Answer by Wolfram · Sep 24, 2010 at 09:43 AM

You can reference the actual pixel Rect of any camera with Camera.pixelRect. So to create a centered button of half the camera's dimensions in each camera, attach a script like this to each camera where you want the button to show:

var myRect:Rect; void Start(){ myRect=camera.pixelRect; myRect.x+=myRect.width/4; myRect.y+=myRect.height/4; myRect.width/=2; myRect.height/=2; }

 void OnGUI(){
     if(GUI.Button(myRect,"blub")){
         // do something
     }
 }

Another ppossibility would be to use the "older" GUIText/GUITexture objects instead of UnityGUI, which are always placed in a normalized coordinate system relative to each camera. However, I don't think you can selectively show such a object on only one camera, or even at different relative positions within these cameras. You can only switch all such objects on or off for a camera globally, by enabling/disabling the camera's GUILayer.

Comment
Add comment · Show 2 · 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 Kourosh · Sep 24, 2010 at 03:36 PM 0
Share

This seems to work! the only problem I'm afraid to face while presenting on a 3d projector is that, in this code we are creating two separate buttons ins$$anonymous$$d of having one appearing in both, therefore there might a possibility of two buttons run a same function at the same time and cause some errors? but other than that it looks the way it should be. I'll try to check it first on a 3d projector. thanks!

avatar image Wolfram · Sep 27, 2010 at 10:10 AM 0
Share

Not sure how you're going to interact while doing the 3D projection. But I guess if you're doing passive stereo with the two stereo views rendered next to each other, you would interact only in one of these views, and therefore only one of the buttons will receive interaction events. Otherwise you could use a flag to distinguish between GUI elements shown in the left/right view, which could also help you to render these buttons at different positions (e.g., if you don't want them to be shown at screen depth).

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

No one has followed this question yet.

Related Questions

Resolution & aspect ratio GUI 1 Answer

Interface 3D 1 Answer

How can I disable the transparency on GUI? 0 Answers

How to render GUI on a stereo scene, with Samsung Gear VR and Android? 1 Answer

IGUI IOS error 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