Forum Discussion
AdamsImmersive
12 years agoHonored Guest
Can't change OVRCameraController backgr. color or clipping?
OVRCameraController (and the 2 child cameras) defaults to a blue background color, which I need to change to black.
Following the PDF docs, I change the color in the OVRCameraController. (This is Unity 4.2 and OVR SDK 0.2.4.)
But when I hit Play, it reverts to blue. (If I also change the colors for the 2 individual cameras, one of them reverts to blue but not the other.)
When I hit Stop, the blue remains, even though Unity playback shouldn't normally permanently affect Inspector values.
EDIT: Same for near clip and far clip; the editor shows my values, even after a quit and reload--until I hit Play. Then they revert to defaults, and stay there even after I Stop.
I'm going to modify the OVR code to try to override this, but it's a hacky approach. What's the right way to do change settings for OVRCameraController and its child cameras?
EDIT 2: I have added [SerializeField] in a few places to help (I'm a JavaScript guy, not C#, but I found that tip here for clipping planes). And it works--the settings stick. But...
- Is there a way to just use those settings as explained in the PDF, without modding the OVR scripts? I worry that my changes will be lost with new SDKs if that's the way to do it. (I'm at least leaving my name in comments to find those lines again.)
- My chosen clipping planes work when I Play in the editor--but are ignored in an actual build. Probably a bug--looks pretty bad (you can see your own body sliced off at the chest, hollow legs and all, when you look down). Then, after the build (even if I quit and reload) the clip values stop working in editor play too; but when I click on the OVRCameraController to check the values, my own values are still shown (not reverted). And then when I Play again, the editor clipping is fine once again. It's as though Build temporarily reverts to default clipping values, and a simple click t select OVRCameraController is enough to resolve the problem--but only in the editor, not in the executable.
Any workarounds to make a Build use my clipping values? (I haven't tried hard-coding them into the C#... hacky and not future-proof, but I'll try it if I can find where to do it.)
Thanks for any ideas!
Following the PDF docs, I change the color in the OVRCameraController. (This is Unity 4.2 and OVR SDK 0.2.4.)
But when I hit Play, it reverts to blue. (If I also change the colors for the 2 individual cameras, one of them reverts to blue but not the other.)
When I hit Stop, the blue remains, even though Unity playback shouldn't normally permanently affect Inspector values.
EDIT: Same for near clip and far clip; the editor shows my values, even after a quit and reload--until I hit Play. Then they revert to defaults, and stay there even after I Stop.
I'm going to modify the OVR code to try to override this, but it's a hacky approach. What's the right way to do change settings for OVRCameraController and its child cameras?
EDIT 2: I have added [SerializeField] in a few places to help (I'm a JavaScript guy, not C#, but I found that tip here for clipping planes). And it works--the settings stick. But...
- Is there a way to just use those settings as explained in the PDF, without modding the OVR scripts? I worry that my changes will be lost with new SDKs if that's the way to do it. (I'm at least leaving my name in comments to find those lines again.)
- My chosen clipping planes work when I Play in the editor--but are ignored in an actual build. Probably a bug--looks pretty bad (you can see your own body sliced off at the chest, hollow legs and all, when you look down). Then, after the build (even if I quit and reload) the clip values stop working in editor play too; but when I click on the OVRCameraController to check the values, my own values are still shown (not reverted). And then when I Play again, the editor clipping is fine once again. It's as though Build temporarily reverts to default clipping values, and a simple click t select OVRCameraController is enough to resolve the problem--but only in the editor, not in the executable.
Any workarounds to make a Build use my clipping values? (I haven't tried hard-coding them into the C#... hacky and not future-proof, but I'll try it if I can find where to do it.)
Thanks for any ideas!
21 Replies
Replies have been turned off for this discussion
- drashHeroic Explorer
"AdamsImmersive" wrote:
- My chosen clipping planes work when I Play in the editor--but are ignored in an actual build.
Whoa, great catch. Just tried an actual executable with this and you're right. I was hard-coding my desired values in OVRCameraController until I saw the post about adding the [SerializeField] tag and I started doing that, but thanks to this post I know that's not quite enough. The [SerializeField] value that you enter in the editor does not appear to be loaded for the OVRCameraController to pass them down to the CameraLeft/CameraRight when you're starting with a fresh executable, so whatever you have on your CameraLeft/CameraRight for clipping planes are the ones that are actually going to be used.
Probably safest to just hardcode for now until the next SDK release, so your approach of putting your name in a comment next to SDK changes is probably a good one. :) - AdamsImmersiveHonored GuestHey, if hard-coding actually works, I'm at least good for now :) EDIT: Didn't work... Even my hard-coded clipping values seem to be ignored in the Build. In fact, it acts exactly the same as before I hard-coded: the editor shows the wrong clipping after a Build, and one click to select OVRCameraController fixes it. Still can't find a way to affect clipping in the Build. *Could something in the plugin be overriding everything else?)
The background color is sometimes hard to see, but I think that's OK with [SerializeField].
Anyway, it's great seeing my game/experience in VR! It was designed for the Rift but I worked on it for a month before my DK came, and I'm glad to see everything working out as I'd hoped. I'll share something when it's polished up a bit (like not seeing your body clipped at the chest...). - MichaelSchenckHonored GuestI am having similar odd problem with setting the far clip plane at run-time. My VR Jam game is in the water and I set the far clip plane closer under the water. So each time you go in and out of the water I am setting them. With the latest sdk this stopped working properly. It would work fine in the editor if I had the OVRCameraController selected and shown in the inspector. But, if i reopened a scene without doing this or made a build it would somehow oddly revert to some value i didn't want. I finally had to just hack the OVRCameraController file to set the far clip plane in the CameraUpdate method constantly, ignoring the UpdateCamerasDirtyFlag. This was the only way i could get it to work properly. There is definitely something very odd going on with these properties and between the OVRCameraController, OVRCamera, and Unity. I have not had time to investigate, but wanted to bring it up as others are having similar issues.
- EvilLeftyHonored GuestI had the same issue when I was making my loadup screen.. i ended up just using a black texture in a skybox, though i'm not sure if that's the correct usage for ya.
- AdamsImmersiveHonored Guest
"MichaelSchenck" wrote:
... I finally had to just hack the OVRCameraController file to set the far clip plane in the CameraUpdate method constantly, ignoring the UpdateCamerasDirtyFlag. ...
Thanks--I'll explore that lead as a possible workaround.
Since this seems to be a bug, new with SDK 0.2.4, I've reported it in the following thread:
viewtopic.php?f=34&t=3836 - AdamsImmersiveHonored GuestOK--it seems like it may be best to override OVRCameraController from the outside rather than trying to get it to behave. Here's my simple temporary clipping fix—this is an entirely separate JavaScript, which should require no modification of OVRCameraController. Run it anywhere and set the 4 variables in the Inspector.
Works for me, even in Builds:#pragma strict
public var near : float;
public var far : float;
public var cameraLeft : Camera;
public var cameraRight : Camera;
function Start () {
cameraLeft.nearClipPlane = near;
cameraRight.nearClipPlane = near;
cameraLeft.farClipPlane = far;
cameraRight.farClipPlane = far;
} - cyberealityGrand ChampionWe've already fixed this internally, and it will go out on the next release.
- diablosv21Honored Guest
"AdamsImmersive" wrote:
OK--it seems like it may be best to override OVRCameraController from the outside rather than trying to get it to behave. Here's my simple temporary clipping fix—this is an entirely separate JavaScript, which should require no modification of OVRCameraController. Run it anywhere and set the 4 variables in the Inspector.
Works for me, even in Builds:#pragma strict
public var near : float;
public var far : float;
public var cameraLeft : Camera;
public var cameraRight : Camera;
function Start () {
cameraLeft.nearClipPlane = near;
cameraRight.nearClipPlane = near;
cameraLeft.farClipPlane = far;
cameraRight.farClipPlane = far;
}"cybereality" wrote:
We've already fixed this internally, and it will go out on the next release.
Double awesome!
This one was driving me a little nuts. My game relies heavily on having objects near the camera. Cheers! - AdamsImmersiveHonored GuestVery good! And for now, I'm back in business.
Looking ahead: what's the process for upgrading an existing Oculus/Unity project to a new SDK version? Just re-import the package, and it will automatically overwrite the older files? (I'll make a backup first of any I've modified.) - cyberealityGrand ChampionUsually I delete the Oculus stuff first, before importing the new integration.
It may allow you to overwrite the files, I haven't tried that yet.
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
- 5 months ago
- 12 years ago
- 12 years ago
- 8 years ago