• 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 developer_dodo4story · Feb 14, 2019 at 10:28 AM · camerascripting problemoptimizationstereoscopic

Display a stereoscopic scene in Frame Sequential technology

I'm working on a project to display a stereoscopic scene in Frame Sequential technology.

Due to large differences in the projection system compared to the standard approach (with one active 3D display) - we try to implement the stereoscopic display technique ourselves, the projection system consists of 6 projectors configured in Nvidia Mosaic mode. However, we have a problem. We perform the projection technique through software page flipping - we switch cameras for both eyes with a general frequency of 60 Hz (30 Hz per eye) according to the algorithm presented below:

     void Start()
     {
         StartCoroutine(BlinkCamsSave());
         Application.targetFrameRate = (int)refreshRate;
     }

     IEnumerator BlinkCamsSave()
     {
         while (blinkingEnabled)
         {
             rightcams = Time.time % ((1 / refreshRate) * 2f) > (1 / refreshRate);

             if (rightcams)
             {
                 foreach (Transform cam in leftCameras)
                 {
                     cam.gameObject.SetActive(true);
                 }
                 foreach (Transform cam in rightCameras)
                 {
                     cam.gameObject.SetActive(false);
                 }
             }
             else
             {
                 foreach (Transform cam in leftCameras)
                 {
                     cam.gameObject.SetActive(false);
                 }
                 foreach (Transform cam in rightCameras)
                 {
                     cam.gameObject.SetActive(true);
                 }
             }
             yield return null;
         }
     }

During the projection, however, there is a problem: there are random delays in displaying frames for the appropriate eyes (for example, displaying the image for the right eye for 20 ms causes that after 16.7 ms, the eye is switched to the left eye on the projector, which in turn results in the fact that for the remaining 3.3 ms, the image for the right eye is incorrectly displayed in the left eye). The situation described results in an unpleasant effect of image shake, together with the loss of stereoscopic effects.

The algorithm presented above was tested in various places on the Unity main loop (according to Lifecycle Flowchart), among others as coroutine, or in FixedUpdate (the frequency of physics was also increased). These activities, however, did not bring the expected results. Is there any way to control the display times of consecutive picture frames (more specifically - setting this time as an invariant)?

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
0

Answer by xxmariofer · Feb 14, 2019 at 12:13 PM

Hello, can you test this code?

 IEnumerator BlinkCamsSave()
 {
     while(blinkingEnabled)
     {
         foreach (Transform cam in leftCameras)
         {
             cam.gameObject.SetActive(rightcams);
         }
         foreach (Transform cam in rightCameras)
         {
             cam.gameObject.SetActive(!rightcams);
         }

         yield return new WaitForSecondsRealtime(frequence);//time that will stop untill next call i.e. 0.5f waits half second
     }
 }
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 developer_dodo4story · Feb 14, 2019 at 04:33 PM 0
Share

Don't work.

avatar image xxmariofer developer_dodo4story · Feb 14, 2019 at 04:47 PM 0
Share

why didnt work? i need extra explanation for understanding your issue. and why fixedupdate didnt work? it is suppost to be call every X amounts of times per second, always the same amount. so i dont understand why it is not working, you can set the fixeddelta time to be like 0.02 so that will be called once 50 times per second.

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

233 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 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 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 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 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

How Do I Not Render Objects That My Player Doesn't See 1 Answer

Camera cut the sides 0 Answers

Coroutine are making my code architecture miserable 1 Answer

Change Camera With a Script 1 Answer

How to move the main camera in Google Cardboard? 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