Closed HawkenKing closed 3 years ago
What about having the following serialized fields :
Camera LeftCameraTemplate;
Camera RightCameraTemplate;
CameraModes LeftCameraMode = CameraModes.UseMainCamera;
CameraModes RightCameraMode = CameraModes.CloneMainCamera;
CameraProperties CameraProperties;
public enum CameraModes {
UseTemplateCamera,
CloneTemplateCamera,
CreateNewCamera,
UseMainCamera,
CloneMainCamera
}
public enum CameraProperties
AutoSetRecommendedSettings, // transparent background in AR for instance. The previous settings would be reset at the end of the session.
DoNotModifyCamera
}
Rather than SimpleWebXR acts on camera.transform.position
of each camera, it could act on camera.transform.localPosition
.
Btw, at any time, (for example on the SimpleWebXR.SessionStarts event), the user code can access the SimpleWebXR.LeftCamera and SimpleWebXR.RightCamera properties, if really what I propose here is not sufficiently complete
Let's imagine the following scenarios:
The user leaves the default properties : LeftCamera is Camera.Main, RightCamera is a clone of Camera.Main created under the same parent.
If the user wants to have full control of the cameras (As you mention it : layers, tags, set parent position for teleport ...), he can create them disabled in his scene and associate them to LeftCameraTemplate and RightCameraTemplate, then set modes to CameraModes.UseTemplateCamera. If the camera template is not in the scene but comes from a prefab, it can use the mode CameraModes.CloneTemplateCamera.
What do you think of this way of doing things?
Also, if no camera is using the CameraModes.UseMainCamera mode, we call Camera.Main.SetActive(false) at the start of the immersive session.
Might be a bit opaque to anyone using the system. The camera generation system is unique, usually the user can edit all of these settings on multiple cameras in the scene using the inspector.
It is true. What if you also had a simulator that allows you to start a fake immersive session in unity, with the 2 cameras?
I think at the very least you need 3 cameras, 1 for the initial pancake view in the browser and one for each eye at tracked hmd level
Honestly surprised about the need to have more than one Camera anyway since Unity recently changed how the stereoscopic camera works. Although I suppose you might actually need a XR Display Subsystem.
Good point, I'm going to dig into this: https://docs.unity3d.com/ScriptReference/XR.XRDisplaySubsystem.html
In fact, XR plugin is not yet compatible with WebGL : https://forum.unity.com/threads/low-level-plug-in-interface-unityregisterrenderingplugin-and-xr-interfaces.983298/#post-6397985
This is true. WebGL in Unity doesn't support threading yet, but it is def on the roadmap.
In either case, I still believe it is possible to enable the Stereoscopic rendering without the subsystems.
afaik single pass isn't available yet in webxr
Camera properties like stereoEnabled, stereoSeparation are used by the XR Plugin which is still not available for WebGL.
What are the analogues in WebGL?
What do you mean by analogues ?
Is there something that functions in a similar capacity?
Using 2 cameras, I can't find anything else...
The compatibility of XR Plugin with WebGL is not a priority for the Unity dev team, but it may be something that will come one day. I spoke with De-Panther who asked the question because he has the same problem as us: https://forum.unity.com/threads/low-level-plug-in-interface-unityregisterrenderingplugin-and-xr-interfaces.983298
Yup sounds about right. That's part of why I wasn't keen on the XR Subsystems. I hate that they are playing gate keeper. Unity used to be easy enough to hack and get something working when needed.
I'm sure there's still a way, but it's likely not publicly disclosed, or available via a public API.
This was an interesting read: https://blog.mozvr.com/multiview-on-webxr/
In some cases, it is desirable to have camera settings like layers, tags and so on exposed for customisation, to enable stereoscopic effects or hiding layers.
Having the camera rig generated at run time is a barrier to this kind of customisation.
Tested on Oculus Quest Browser