Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
11 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 mconstant · Aug 13, 2015 at 06:56 AM · uiguicanvasoculus

[VR] How to display a canvas with Oculus

Trying to make a crosshair follow the oculus using the canvas. Currently I'm using images on the canvas to draw the crosshair. I was originally using screen space- overlay and it was showing up in the unity editor but when the project was built it would not appear in Oculus. I also tried screen space - camera and it was appearing but it was far in the distance and hiding behind objects. I tried changing the plane distance but Unity would crash when I tried running it in the editor. Does anyone have any suggestions on how to make this work.

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

5 Replies

· Add your reply
  • Sort: 
avatar image
8

Answer by RicusMaximus · Jun 01, 2016 at 01:37 PM

Hey, I don't know if you're still struggling, but I found a solution for the UI with the Oculus.

Create a 2nd camera and make it a child of your main camera (CenterEyeAnchor if you use OVRCameraRig)

  • Set the Clear Flags on Depth only

  • Set the Culling Mask on Nothing first, then only enable UI

  • Make the depth 1 (or anything higher than your main camera)

Where to find the instructions for the UI camera

This covers the camera, now you have to make the Canvas render in Screen Space - Camera Select the camera you just created, I call it UI camera, as the screen space renderer.

The canvas settings

Now you have a transparent camera overlay with only UI elements that renders in the oculus.

I also want to add, the oculus renders the frustrum not as usual, you have to place your UI elements much closer to the center, but that is up to you.


camerarigoculusui.png (479.4 kB)
camerarigoculusui2.png (501.8 kB)
Comment
Add comment · Show 7 · 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 steveh2112 · Dec 19, 2016 at 05:45 AM 0
Share

thanks. at first i couldn't get it to work then i realized i had to replace my main camera with an OVRCameraRig available here https://developer3.oculus.com/blog/unitys-ui-system-in-vr/

also i planted a huge text button in the middle of the canvas so it was easy to see until i figure out where everything was

avatar image soorajkbabu · Jan 06, 2017 at 12:18 PM 0
Share

Will interaction be possible with the UI elements? Say, I need to use a button using controllers. Will it be possible?

I'm using HTC Vive. I believe the concept remains same whether its Vive or Oculus.

Thanks

avatar image RicusMaximus soorajkbabu · Jan 07, 2017 at 12:40 PM 0
Share

Hi soorajkbabu, looking back on my answer here there's something very important which I didnt know at the time. If you stick a canvas to the camera in VR, this means it will move with the player's movement. For a normal HUD this is logical and preferred, in VR however, it's not. As of this moment there is no eye tracking software in the H$$anonymous$$D's, which means you can only focus on the center part of the screen, for the rest you have to turn your head. This means that, if you use the above solution, you will glue a canvas at a distance from someone's eyeball, never letting be able to focus on it. This can get really frustrating for users.

A better approach to this problem is to use canvases which are in world space and don't turn with the head of the player (unless it's a reticle or something)

Another point of attention is scaling. UI elements tend to stay the same size no matter the view. In VR this will result into the player not being able to focus if the world behind it is really small. For example if you have a reticle in the middle of the screen which doesn't change size, if you look very close at a wall in the VR space, you will not be able to focus on the reticle because it's in front of it due to the $$anonymous$$imal focal point of your eyes. Although they're being deceived, it's uncomfortable.

$$anonymous$$y solution (for now) is to have 2 sorts of UI elements, several that scale and several that don't. The non-scaling UI renders behind an extra 1m - 5m camera, so all UI elements are perceived to be at least 5m away. The UI elements that do scale, like the reticle, are raycasted to whatever object is in front of the player and adjusts it's position and scale to that, so it looks like it's in the VR space. This allows the player to keep focus on both objects.

It's a lot of trial and error, but the Unity Tutorial helps a lot too!

avatar image Tariql RicusMaximus · Oct 02, 2017 at 08:56 PM 0
Share

This method doesn't seem to be working for the VIV$$anonymous$$ I am using unity 5.6.3p2. Having a UICamera inside the CameraEye or the parent Camera Head and then a Canvas set to Screen Space - Camera and the UICamera selected does not seem to render anything. It's odd because, in the Display $$anonymous$$irror window of S$$anonymous$$m, you can see the UI element, but not when you have the headset on. Any solutions for how to get this to work on the VIVE? Essentially, I am trying to achieve the effect of having color show on the edges of the screen.

Show more comments
avatar image EnriqueMM · Mar 09 at 12:32 PM 0
Share

Good morning, I followed the steps and I have a problem, it is as if a lot of cameras are created, any idea why it could be? alt text

275164648-489223205986319-1537312559471078257-n.jpg (120.2 kB)
avatar image
0

Answer by SelfishReplicator · Nov 21, 2016 at 02:39 PM

This worked great for me. Thanks for your clear description!

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

Answer by unity_8AEPtfJUp3c0YA · Mar 20, 2019 at 12:52 PM

Awesome solution! Thank you @RicusMaximus :),Awesome solution. Thank you very much!

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

Answer by kirstyearley · Mar 25, 2019 at 10:40 AM

Thank you so much for this tip, @RicusMaximus :D It works brilliantly!

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

Answer by tasaif · Jul 25, 2021 at 07:53 AM

Thank you so much

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

12 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

Related Questions

Good way to scale 3D GameObjects in a Canvas (Screen Space - Camera)? 1 Answer

Custom Dropdown Sorting Order problem 2 Answers

Unity 4.6 adding a Canvas Text onto a gameobject prefab?? -1 Answers

Move UI object to center of screen while maintaining its parenting 2 Answers

How to Render Unity UI Canvas in between two 3D Objects? 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