Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by equalsequals · May 10, 2016 at 08:00 PM · vrrendertexture

Oculus VR and Sharing RenderTextures Across Both Eyes

I am attempting to leverage a RenderTexture drawn with screen-space coordinates of an object in VR. I have a separate Camera with a target RenderTexture and a replacement Shader that is told to render during the OnPreCull event of the Main Camera.

The object that gets rendered with the replacement Shader to the RenderTexture then, during the Forward Base pass of the Main Camera then uses that RenderTexture to be rendered.

In doing this I am assuming that the Main Camera will render for the left eye, the RenderTexture will receive the results from the left eye's perspective and the object will then be rendered with that RenderTexture, and repeat for the right eye.

To reiterate, the process occurs like this:

  1. OnPreCull of Main Camera (from left eye perspective) the off-screen Camera is told to render an object into its RenderTexture.

  2. The object is rendered by the Main Camera (from left eye perspective) with the RenderTexture as a property of its Material.

  3. OnPreCull of Main Camera (right eye perspective), the off-screen Camera is told to render an object into its RenderTexture.

  4. The object is rendered by the Main Camera (from right eye perspective) with the RenderTexture as a property of its Material.

With other APIs such as Google Cardboard, where there are actually 2 Cameras, this works as expected; the perspective of each eye is correctly used for the RenderTexture and the buffer can be shared. However, it seems that in OVR, #3 (or possibly #1) from above is not actually happening as both eyes' perspectives seem to be looking up the same RenderTexture, causing the resulting image to appear as "double vision".

I can only speculate that my assumptions of how the Camera is working when rendering to the Oculus headset is incorrect, but I can't seem to find any information that gives an explanation as to what is going on with the Camera.

If anyone has any ideas it would be greatly appreciated.

Thanks in advance.

==

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 equalsequals · May 12, 2016 at 03:01 PM

For posterity, I figured out the issue.

My assumptions were correct in all instances except for one detail: the OnPreCull hook seems to only function once for both eyes.

I can only speculate that this is an optimization of only doing the frustum culling once as opposed to processing for each eye. Moving my off-screen buffer Camera.Render call to OnPreRender of the Main Camera allows for the RenderTexture to be drawn with the correct perspective for each eye and there is no more "double vision".

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

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

Related Questions

RenderTexture.active for a non-VR camera in a VR project 0 Answers

Unity crashes - multiple cameras with image effects and fade to black 0 Answers

RenderTexture in VR/3D 0 Answers

Best approach for alpha blending multiple webcamtexture is renderTexture? 0 Answers

How to synchronize laggy stereo VR video with AudioSources? 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