public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(m_ScatterDistance1, styles.sssProfileScatterDistance1); EditorGUILayout.PropertyField(m_ScatterDistance2, styles.sssProfileScatterDistance2); EditorGUILayout.PropertyField(m_LerpWeight, styles.sssProfileLerpWeight); m_TexturingMode.intValue = EditorGUILayout.Popup(styles.sssTexturingMode, m_TexturingMode.intValue, styles.sssTexturingModeOptions); EditorGUILayout.PropertyField(m_Transmission, styles.sssProfileTransmission); EditorGUILayout.PropertyField(m_TintColor, styles.sssProfileTintColor); EditorGUILayout.PropertyField(m_ThinObject, styles.sssProfileThinObject); EditorGUILayout.PropertyField(m_ThicknessRemap, styles.sssProfileMinMaxThickness); Vector2 thicknessRemap = m_ThicknessRemap.vector2Value; EditorGUILayout.MinMaxSlider(styles.sssProfileThicknessRemap, ref thicknessRemap.x, ref thicknessRemap.y, 0, 10); m_ThicknessRemap.vector2Value = thicknessRemap; EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.sssProfilePreview0, styles.centeredMiniBoldLabel); EditorGUILayout.LabelField(styles.sssProfilePreview1, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.LabelField(styles.sssProfilePreview2, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.Space(); } // Apply the three-sigma rule. Color stdDev1 = m_ScatterDistance1.colorValue * (1.0f / 3.0f); Color stdDev2 = m_ScatterDistance2.colorValue * (1.0f / 3.0f); // Draw the profile. m_ProfileMaterial.SetColor("_StdDev1", stdDev1); m_ProfileMaterial.SetColor("_StdDev2", stdDev2); m_ProfileMaterial.SetFloat("_LerpWeight", m_LerpWeight.floatValue); EditorGUI.DrawPreviewTexture(GUILayoutUtility.GetRect(256, 256), m_ProfileImage, m_ProfileMaterial, ScaleMode.ScaleToFit, 1.0f); EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.sssTransmittancePreview0, styles.centeredMiniBoldLabel); EditorGUILayout.LabelField(styles.sssTransmittancePreview1, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.LabelField(styles.sssTransmittancePreview2, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.Space(); // Draw the transmittance graph. m_TransmittanceMaterial.SetColor("_StdDev1", stdDev1); m_TransmittanceMaterial.SetColor("_StdDev2", stdDev2); m_TransmittanceMaterial.SetFloat("_LerpWeight", m_LerpWeight.floatValue); m_TransmittanceMaterial.SetVector("_ThicknessRemap", m_ThicknessRemap.vector2Value); m_TransmittanceMaterial.SetVector("_TintColor", m_TintColor.colorValue); EditorGUI.DrawPreviewTexture(GUILayoutUtility.GetRect(16, 16), m_TransmittanceImage, m_TransmittanceMaterial, ScaleMode.ScaleToFit, 16.0f); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { // Validate each individual asset and update caches. HDRenderPipelineInstance hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipelineInstance; hdPipeline.sssSettings.OnValidate(); } }
private void LightingDebugSettingsUI(HDRenderPipeline renderContext, HDRenderPipelineInstance renderpipelineInstance) { m_ShowLightingDebug.boolValue = EditorGUILayout.Foldout(m_ShowLightingDebug.boolValue, styles.lightingDebugSettings); if (!m_ShowLightingDebug.boolValue) { return; } EditorGUI.BeginChangeCheck(); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DebugShadowEnabled, styles.shadowDebugEnable); EditorGUILayout.PropertyField(m_ShadowDebugMode, styles.shadowDebugVisualizationMode); if (!m_ShadowDebugMode.hasMultipleDifferentValues) { if ((ShadowMapDebugMode)m_ShadowDebugMode.intValue == ShadowMapDebugMode.VisualizeShadowMap) { EditorGUILayout.IntSlider(m_ShadowDebugShadowMapIndex, 0, renderpipelineInstance.GetCurrentShadowCount() - 1, styles.shadowDebugVisualizeShadowIndex); } } if (!m_DebugDisplayMode.hasMultipleDifferentValues) { if ((DebugDisplayMode)m_DebugDisplayMode.intValue == DebugDisplayMode.DiffuseLighting) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_LightingDebugAlbedo, styles.lightingDebugAlbedo); EditorGUI.indentLevel--; } if ((DebugDisplayMode)m_DebugDisplayMode.intValue == DebugDisplayMode.SpecularLighting) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_LightingDebugOverrideSmoothness, styles.lightingDebugOverrideSmoothness); if (!m_LightingDebugOverrideSmoothness.hasMultipleDifferentValues && m_LightingDebugOverrideSmoothness.boolValue == true) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_LightingDebugOverrideSmoothnessValue, styles.lightingDebugOverrideSmoothnessValue); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } } EditorGUILayout.PropertyField(m_LightingDebugDisplaySkyReflection, styles.lightingDisplaySkyReflection); if (!m_LightingDebugDisplaySkyReflection.hasMultipleDifferentValues && m_LightingDebugDisplaySkyReflection.boolValue == true) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_LightingDebugDisplaySkyReflectionMipmap, styles.lightingDisplaySkyReflectionMipmap); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { HackSetDirty(renderContext); } }
// Use this for initialization void OnEnable() { SceneSettingsManager.instance.AddSceneSettings(this); HDRenderPipelineInstance hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipelineInstance; if (hdPipeline != null) { hdPipeline.OnSceneLoad(); } }
public override void OnInspectorGUI() { var renderContext = target as HDRenderPipeline; HDRenderPipelineInstance renderpipelineInstance = UnityEngine.Experimental.Rendering.RenderPipelineManager.currentPipeline as HDRenderPipelineInstance; if (!renderContext || renderpipelineInstance == null) { return; } serializedObject.Update(); DebuggingUI(renderContext, renderpipelineInstance); SettingsUI(renderContext); serializedObject.ApplyModifiedProperties(); }
private void DebuggingUI(HDRenderPipeline renderContext, HDRenderPipelineInstance renderpipelineInstance) { EditorGUILayout.LabelField(styles.debugging); // Debug Display settings EditorGUI.indentLevel++; m_DebugOverlayRatio.floatValue = EditorGUILayout.Slider(styles.debugOverlayRatio, m_DebugOverlayRatio.floatValue, 0.1f, 1.0f); EditorGUILayout.Space(); RenderingDebugSettingsUI(renderContext); MaterialDebugSettingsUI(renderContext); LightingDebugSettingsUI(renderContext, renderpipelineInstance); EditorGUILayout.Space(); EditorGUI.indentLevel--; }
public override void OnInspectorGUI() { var renderContext = target as HDRenderPipeline; HDRenderPipelineInstance renderpipelineInstance = UnityEngine.Experimental.Rendering.RenderPipelineManager.currentPipeline as HDRenderPipelineInstance; if (!renderContext || renderpipelineInstance == null) { return; } serializedObject.Update(); EditorGUILayout.LabelField(Styles.defaults, EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DefaultDiffuseMaterial, Styles.defaultDiffuseMaterial); EditorGUILayout.PropertyField(m_DefaultShader, Styles.defaultShader); EditorGUI.indentLevel--; DebuggingUI(renderContext, renderpipelineInstance); SettingsUI(renderContext); serializedObject.ApplyModifiedProperties(); }
private void DebuggingUI(HDRenderPipeline renderContext, HDRenderPipelineInstance renderpipelineInstance) { EditorGUILayout.LabelField(styles.debugging); // Debug Display settings EditorGUI.indentLevel++; EditorGUILayout.PropertyField(m_DebugDisplayMode, styles.debugDisplayMode); m_DebugOverlayRatio.floatValue = EditorGUILayout.Slider(styles.debugOverlayRatio, m_DebugOverlayRatio.floatValue, 0.1f, 1.0f); EditorGUILayout.Space(); RenderingDebugSettingsUI(renderContext); if ((DebugDisplayMode)m_DebugDisplayMode.intValue == DebugDisplayMode.ViewMaterial) { MaterialDebugSettingsUI(renderContext); } else { LightingDebugSettingsUI(renderContext, renderpipelineInstance); } EditorGUILayout.Space(); EditorGUI.indentLevel--; }