Forum Discussion
phileday
11 years agoMHCP Member
Turning off Vsync in 0.4.3?
i have a video plugin in my Unity project that goes very juddery when Vsync is on. I'd like to turn it off but don't know how to do it. I've read other post that refer to Vsync via EnabledCaps but don't how to do it. If anyone can help with the code to switch off the forced Vsync that would be great.
Phil
Phil
5 Replies
Replies have been turned off for this discussion
- philedayMHCP MemberForgot to mention that I programming in Unity Java.
- moltonExplorerAs far as I know you can enable/disable vsync in project settings-> quality settings, set it per quality setting. I'm sure there's a toggle too, maybe by accessing the QualitySettings class.
- philedayMHCP MemberI have set the quality setting to no sync but I think that the SDK forces it on. There is a line in the OVRManager.cs that reads.
// Except for D3D9, SDK rendering forces vsync unless you pass ovrHmdCap_NoVSync to Hmd.SetEnabledCaps().
I don't know how to do this though.
I haveDebug.Log(OVRManager.capiHmd.GetEnabledCaps());
In the script I want
For some reason it return 640. I don't know why.
There is also a line in OvrCapi.cs/// Support rendering without VSync for debugging.
/// </summary>
NoVSync = 0x1000,
I think I have difficultly as a lot of the talk on this is programming in C# so I can't directly translate it. - AnonymousHere is the C# code I use to do this:
public static void SetVsyncOff() {
uint caps = OVRManager.capiHmd.GetEnabledCaps();
caps |= (uint)Ovr.HmdCaps.NoVSync;
OVRManager.capiHmd.SetEnabledCaps(caps);
}
I think the equivalent in Java would be (Java doesn't have unsigned int type or the |= operator):
public static void SetVsyncOff() {
int caps = OVRManager.capiHmd.GetEnabledCaps();
caps = caps | Ovr.HmdCaps.NoVSync;
OVRManager.capiHmd.SetEnabledCaps(caps);
}
This uses a binary(bitwise) "OR" function. You want to "OR" the existing caps (a lot of stuff is packed into the caps integer) with the NoVysnc value.
Keep in mind running with vsync off is going to give you a really bad VR experience. I would only use this for testing to see what your application's performance is with vsync not capping it at 75fps. - philedayMHCP MemberThank you
I have a go at implementing that tomorrow. I've also contacted the people who make the Video plugin AVpro Windows. Hopefully there is a way round it so that I can get smooth vr and also smooth video. I think a lot of people who are using the plugin AVpro are having similar problems. Its a very good video plugin but also pretty much the only one worth looking at in Unity so unless it gets worked out with this plugin it's going to be difficult to acheive smooth video playback in Unity at all.
I'll let you know how my progress goes and if I have to alter the java I'll post that here for others also.]
Cheers
Phil
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 months ago
- 9 years ago