Unity-Technologies / EditorXR

Author XR in XR
Other
930 stars 167 forks source link

EditorVR camera better represents what is seen in the game view #431

Closed dunity closed 6 years ago

dunity commented 6 years ago

Purpose of this PR

This improvement allows for the EditorVR VRView camera to better represent what is seen in the game view.

Add support for copying the scene's MainCamera settings (clear flags, background, etc), if one exists, and the (EditorVR)context's m_CopySceneCameraSettings inspector bool/toggle is enabled.

Testing status

Tested in various scenes and camera settings scenarios. Tested with and without a MainCamera in the scene.

Technical risk

Medium - The majority of the changes are relegated to EditorVRContext, EditingContextManager, and VRView. These are core EVR elements; some of their fields/properties have been made static, in order to allow for this functionality to occur as/when needed. Care has been taken to avoid conflicting with the previous AddComponent approach. Disabling the m_CopySceneCameraSettings bool on the EditorVR context will disable this functionality, and create the camera in the manner that was previously occurring.

Notes

I've also added initial support for the Unity PostProcessing(v2) stack in the following branch: "improvements/dylanu/scene-camera-fx-settings". There is more work to be done in that branch before PR. This branch/PR acts as the foundation for that work.

dunity commented 6 years ago

@AndrewTHEManeri These changes intentionally allow for copying of any camera settings that aren't replaced by those that are defined in VRView OnEnable(), including forward/deferred/etc. VRView still sets/replaces values for CameraType/OcclusionCulling/ClipPlanes. Ideally, we could also support an EVR "CameraCopy" component, that users could set on their desired camera. Such a component would have toggles allowing for individual copying of specific params, etc. On personal projects, I'm needing such camera settings copying.

dunity commented 6 years ago

ContextSettings struct removed from IEditingContext & EditorVRContext. copySceneCameraSettings property added to IEditingContext. This is used in VRView OnEnable() when setting up the VRView camera.

dunity commented 6 years ago

@AndrewTHEManeri your suggested changes have been applied (as I understood them).

dunity commented 6 years ago

Suggested changes pushed. Please give it another look when you have the time @mtschoen-unity , thanks :-)

mtschoen-unity commented 6 years ago

Forgot to mention in my commit message that the last one also fixes an issue with the Editing Context popup in VRView if there is >1 context available. It was broken since the GUILaout->GUI refactor.

@AndrewTHEManeri I'm done making changes and this should be good to go. Still waiting on your approval.

jono-unity commented 6 years ago

@dunity here's some funky behavior: it looks like if 'Allow HDR' is false on a camera, the presentation camera gets squished. I'm seeing this in an empty (just camera and light) scene and in the Poly Pirates main scene, and not on dev. In this vid, I'm toggling 'presentation camera': https://youtu.be/Zpk_kMgKGCU

mtschoen-unity commented 6 years ago

@jono-unity --can confirm. Away it goes, then. I'll force HDR on like I did with the other settings that break things.

mtschoen-unity commented 6 years ago

@stella3d this feature is a perfect example for your AI monkey script. It could run EXR with all permutations of camera settings and record failures. :+1:

mtschoen-unity commented 6 years ago

Manual merge successful. Performing Github merge