private static void EnsureInputManagerReference() { if (inputManagerAsset == null) { // Grabs the actual asset file into a SerializedObject, so we can iterate through it and edit it. inputManagerAsset = MixedRealityOptimizeUtils.GetSettingsObject("InputManager"); } }
private void OptimizeScene() { var lightmapSettings = MixedRealityOptimizeUtils.GetLighmapSettings(); if (disableRealtimeGlobalIllumination) { MixedRealityOptimizeUtils.ChangeProperty(lightmapSettings, "m_GISettings.m_EnableRealtimeLightmaps", property => property.boolValue = false); } if (disableBakedGlobalIllumination) { MixedRealityOptimizeUtils.ChangeProperty(lightmapSettings, "m_GISettings.m_EnableBakedLightmaps", property => property.boolValue = false); } }
private void OptimizeProject() { if (singlePassInstanced) { PlayerSettings.stereoRenderingPath = StereoRenderingPath.Instancing; } if (enableDepthBufferSharing) { MixedRealityOptimizeUtils.SetDepthBufferSharing(enableDepthBufferSharing); // TODO: This value needs to be per-perf target //MixedRealityOptimizeUtils.SetDepthBufferFormat(enable16BitDepthBuffer); } }
/// <summary> /// Displays a depth write warning and fix button if depth buffer sharing is enabled. /// </summary> /// <param name="materialEditor">The material editor to display the warning in.</param> /// <param name="dialogTitle">The title of the dialog window to display when the user selects the fix button.</param> /// <param name="dialogMessage">The message in the dialog window when the user selects the fix button.</param> /// <returns>True if the user opted to fix the warning, false otherwise.</returns> public static bool DisplayDepthWriteWarning(MaterialEditor materialEditor, string dialogTitle = "Depth Write", string dialogMessage = "Change this material to write to the depth buffer?") { bool dialogConfirmed = false; if (MixedRealityOptimizeUtils.IsDepthBufferSharingEnabled()) { var defaultValue = EditorStyles.helpBox.richText; EditorStyles.helpBox.richText = true; if (materialEditor.HelpBoxWithButton(Styles.DepthWriteWarning, Styles.DepthWriteFixNowButton)) { if (EditorUtility.DisplayDialog(dialogTitle, dialogMessage, "Yes", "No")) { dialogConfirmed = true; } } EditorStyles.helpBox.richText = defaultValue; } return dialogConfirmed; }
private void RenderSettingOptimizations() { GUILayout.BeginVertical("Box"); EditorGUILayout.LabelField(this.ToolbarTitles[(int)ToolbarSection.Settings], MixedRealityStylesUtility.BoldLargeTitleStyle); using (new EditorGUI.IndentLevelScope()) { bool isSinglePassInstancedEnabled = PlayerSettings.stereoRenderingPath == StereoRenderingPath.Instancing; BuildSection("Single Pass Instanced Rendering", SinglePassInstanced_URL, GetTitleIcon(isSinglePassInstancedEnabled), () => { EditorGUILayout.LabelField("Single Pass Instanced Rendering is an option in the Unity graphics pipeline to more efficiently render your scene and optimize CPU & GPU work."); EditorGUILayout.HelpBox("This rendering configuration requires shaders to be written to support GPU instancing which is automatic in all Unity & MRTK shaders.Click the \"Documentation\" button for instruction to update your custom shaders to support instancing.", MessageType.Info); using (new GUIEnabledWrapper(!isSinglePassInstancedEnabled)) { if (InspectorUIUtility.RenderIndentedButton("Enable Single Pass Instanced rendering")) { PlayerSettings.stereoRenderingPath = StereoRenderingPath.Instancing; } } }); // TODO: Put in Quality settings section bool isDepthBufferSharingEnabled = MixedRealityOptimizeUtils.IsDepthBufferSharingEnabled(); BuildSection("Depth Buffer Sharing", DepthBufferSharing_URL, GetTitleIcon(isDepthBufferSharingEnabled), () => { EditorGUILayout.LabelField("This option shares the application's depth buffer with the running platform which allows the platform to more accurately stabilize holograms and content.", EditorStyles.wordWrappedLabel); EditorGUILayout.HelpBox("Depth buffer sharing requires that a valid depth buffer is submitted to the platform. Click the \"Documentation\" button for instructions to ensure that transparent & text gameobjects write to depth.", MessageType.Info); using (new GUIEnabledWrapper(!isDepthBufferSharingEnabled)) { if (InspectorUIUtility.RenderIndentedButton("Enable Depth Buffer Sharing")) { MixedRealityOptimizeUtils.SetDepthBufferSharing(true); } } }); bool is16BitDepthFormat = MixedRealityOptimizeUtils.IsWMRDepthBufferFormat16bit(); BuildSection("Depth Buffer Format", DepthBufferFormat_URL, GetTitleIcon(is16BitDepthFormat), () => { EditorGUILayout.LabelField("If sharing the depth buffer with the underlying mixed reality platform, it is generally recommended to utilize a 16-bit depth format buffer to save on performance.", EditorStyles.wordWrappedLabel); EditorGUILayout.HelpBox("Although 16-bit depth format is better performing, it can result in z-fighting if the far clip plane is too far. Click the \"Documentation\" button to learn more", MessageType.Info); using (new GUIEnabledWrapper(!is16BitDepthFormat)) { if (InspectorUIUtility.RenderIndentedButton("Enable 16-bit depth format")) { MixedRealityOptimizeUtils.SetDepthBufferFormat(true); } } }); bool isGIEnabled = MixedRealityOptimizeUtils.IsRealtimeGlobalIlluminationEnabled(); BuildSection("Real-time Global Illumination", GlobalIllumination_URL, GetTitleIcon(!isGIEnabled), () => { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Real-time Global Illumination can produce great visual results but at great expense. It is recommended to disable this feature in lighting settings.", EditorStyles.wordWrappedLabel); if (GUILayout.Button(new GUIContent("View Lighting Settings", "Open Lighting Settings"), EditorStyles.miniButton, GUILayout.Width(160f))) { EditorApplication.ExecuteMenuItem("Window/Rendering/Lighting Settings"); } EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("Note: Real-time Global Illumination is a per-scene setting.", MessageType.Info); using (new GUIEnabledWrapper(isGIEnabled)) { if (InspectorUIUtility.RenderIndentedButton("Disable Real-time Global Illumination")) { MixedRealityOptimizeUtils.SetRealtimeGlobalIlluminationEnabled(false); } } }); } GUILayout.EndVertical(); }
public override void OnInspectorGUI() { if (!RenderProfileHeader(ProfileTitle, ProfileDescription, target, true, BackProfileType.Input)) { return; } using (new EditorGUI.DisabledGroupScope(IsProfileLock((BaseMixedRealityProfile)target))) { serializedObject.Update(); EditorGUILayout.Space(); EditorGUILayout.PropertyField(pointingExtent); EditorGUILayout.PropertyField(defaultRaycastLayerMasks, RaycastLayerMaskContent, true); EditorGUILayout.PropertyField(pointerMediator); EditorGUILayout.PropertyField(primaryPointerSelector); GUIStyle boldFoldout = new GUIStyle(EditorStyles.foldout) { fontStyle = FontStyle.Bold }; EditorGUILayout.Space(); EditorGUILayout.LabelField("Gaze Settings", EditorStyles.boldLabel); { EditorGUILayout.Space(); EditorGUILayout.PropertyField(gazeCursorPrefab, GazeCursorPrefabContent); EditorGUILayout.PropertyField(gazeProviderType); EditorGUILayout.PropertyField(useHeadGazeOverride); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(useEyeTrackingDataWhenAvailable, UseEyeTrackingDataContent); // Render a help link for getting started with eyetracking documentation string helpURL = "https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/input/eye-tracking/eye-tracking-basic-setup"; InspectorUIUtility.RenderDocumentationButton(helpURL); EditorGUILayout.EndHorizontal(); #if UNITY_2019_3_OR_NEWER if (useEyeTrackingDataWhenAvailable.boolValue && MixedRealityOptimizeUtils.IsBuildTargetUWP() && !PlayerSettings.WSA.GetCapability(PlayerSettings.WSACapability.GazeInput)) { EditorGUILayout.HelpBox(EnableGazeCapabilityContent, MessageType.Warning); if (InspectorUIUtility.RenderIndentedButton("Set GazeInput capability")) { PlayerSettings.WSA.SetCapability(PlayerSettings.WSACapability.GazeInput, true); } } #endif // UNITY_2019_3_OR_NEWER EditorGUILayout.Space(); showGazeProviderProperties = EditorGUILayout.Foldout(showGazeProviderProperties, "Gaze Provider Settings", true, boldFoldout); if (showGazeProviderProperties && CameraCache.Main != null) { var gazeProvider = CameraCache.Main.GetComponent <IMixedRealityGazeProvider>(); CreateCachedEditor((Object)gazeProvider, null, ref gazeProviderEditor); // Provide a convenient way to toggle the gaze provider as enabled/disabled via editor gazeProvider.Enabled = EditorGUILayout.Toggle("Enable Gaze Provider", gazeProvider.Enabled); if (gazeProviderEditor != null) { using (new EditorGUI.IndentLevelScope()) { // Draw out the rest of the Gaze Provider's settings gazeProviderEditor.OnInspectorGUI(); } } } } EditorGUILayout.Space(); showPointerOptionProperties = EditorGUILayout.Foldout(showPointerOptionProperties, "Pointer Options", true, boldFoldout); if (showPointerOptionProperties) { using (new EditorGUI.IndentLevelScope()) { RenderPointerList(pointerOptions); } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Debug Settings", EditorStyles.boldLabel); { EditorGUILayout.PropertyField(debugDrawPointingRays); EditorGUILayout.PropertyField(debugDrawPointingRayColors, true); } serializedObject.ApplyModifiedProperties(); } }
private bool IsHololensTargeted() { return(PerfTarget == PerformanceTarget.AR_Headsets && MixedRealityOptimizeUtils.IsBuildTargetUWP()); }