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
1
Question by ignotuscaligo · Oct 19, 2011 at 09:53 PM · timeframerateframerefresh

vBlank Drift - Locking unity to the vBlank?

I'm working on a project where I need something to move -exactly- in time with the refresh rate of the screen (in my case, 60hz). vBlank gets really close to this, but there is a little drift, and this severely harms the look of my project. I have also tried syncing the motion with the "Time.frameCount", but that also leads to the same drift.

I have set the render settings to use vBlanks on single intervals (ie, 60hz), but it appears that it gets slightly out of sync when it cant completely render a frame. The object I'm displaying is just a cube in blank space, so it should render as fast as possible.

Any ideas?

Comment
Add comment · Show 3
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 CHPedersen · Oct 20, 2011 at 08:53 AM 0
Share

Can you try to elaborate a little further on why you need to lock on to the actual rendering framerate? Is the framerate a key element in the project in a manner that prevents you from using FixedUpdate? You can totally control the rate at which something occurs using this method and Time.fixedDeltaTime ins$$anonymous$$d, if this is your goal.

avatar image ignotuscaligo · Oct 23, 2011 at 07:59 AM 0
Share

Im outputting to a 3D display that uses a "sequential-frame" technique to get the two images. It refreshes at 60hz, and every other frame is a frame for an eye (ie. frame 1 is left, 2 right, 3 left, 4 right, so on). I have a script setup that moves the camera to the needed position every Update(). I'm not using FixedUpdate() because it does not lock to the vBlank. This method is very close to working, I -do- get a 3d image, but due to the drift, the eyes will invert every 5 seconds or so (causing a painful headache, heh).

avatar image syclamoth · Oct 23, 2011 at 08:08 AM 1
Share

That is probably one of the best possible reasons for needing to do this.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by syclamoth · Oct 23, 2011 at 08:15 AM

How about this- change the Fixed-update time to be exactly 1/60 of a second, then in your Fixed Update render the camera manually using Camera.Render, to make sure that all the frames fall on the exact right times. Make sure that you disable the camera before doing this, since you will be manually managing all the camera work yourself. Pseudocode (mostly C#)-

 void FixedUpdate()
 {
     // Move the camera to the right place, be it the left or the right eye
     camera.Render();
 }

Have you tried doing the rendering manually? I think that is the solution to your problem, there.

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 syclamoth · Oct 23, 2011 at 08:16 AM 0
Share

One added bonus to this method- you will never have any weirdness happening because of physics happening at a different time from the render step, because it all happens at the same time!

avatar image ignotuscaligo · Oct 28, 2011 at 10:15 PM 0
Share

At first I thought it wasn't working, then I realized the display was incorrectly telling me it was in 3D mode. It wasn't switching the views, nothing worked, then I changed it's mode, and it was working fantastically. Near the bottom of the screen I get a bit of splitting, but that's much better than the eye-switching. We're going to be getting a more powerful video card soon, so that should fix the breakage.

Thanks for the help!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How does Time.deltaTime provide smoother physics functions? (Frame rate question) 2 Answers

Big frametime on iOS + intermittent cpu-waits-gpu 0 Answers

How to synchronize frame updates across a network of multiple (UDP) clients? 0 Answers

Animation frame size workaround? 0 Answers

Make Unity delay frame until VideoPlayer seek completed 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