public override void OnInspectorGUI() { serializedObject.Update(); // Old SSS Model >>> bool useDisneySSS; { HDRenderPipeline hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline; useDisneySSS = hdPipeline.sssSettings.useDisneySSS; } // <<< Old SSS Model EditorGUI.BeginChangeCheck(); { if (useDisneySSS) { EditorGUILayout.PropertyField(m_ScatteringDistance, styles.sssProfileScatteringDistance); GUI.enabled = false; EditorGUILayout.PropertyField(m_MaxRadius, styles.sssProfileMaxRadius); GUI.enabled = true; } else { 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); m_TransmissionMode.intValue = EditorGUILayout.Popup(styles.sssProfileTransmissionMode, m_TransmissionMode.intValue, styles.sssTransmissionModeOptions); EditorGUILayout.PropertyField(m_TransmissionTint, styles.sssProfileTransmissionTint); EditorGUILayout.PropertyField(m_ThicknessRemap, styles.sssProfileMinMaxThickness); Vector2 thicknessRemap = m_ThicknessRemap.vector2Value; EditorGUILayout.MinMaxSlider(styles.sssProfileThicknessRemap, ref thicknessRemap.x, ref thicknessRemap.y, 0.0f, 50.0f); m_ThicknessRemap.vector2Value = thicknessRemap; EditorGUILayout.PropertyField(m_WorldScale, styles.sssProfileWorldScale); EditorGUILayout.Space(); EditorGUILayout.LabelField(styles.sssProfilePreview0, styles.centeredMiniBoldLabel); EditorGUILayout.LabelField(styles.sssProfilePreview1, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.LabelField(styles.sssProfilePreview2, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.LabelField(styles.sssProfilePreview3, EditorStyles.centeredGreyMiniLabel); EditorGUILayout.Space(); } float r = m_MaxRadius.floatValue; Vector3 S = m_ShapeParam.vector3Value; Vector4 T = m_TransmissionTint.colorValue; Vector2 R = m_ThicknessRemap.vector2Value; bool transmissionEnabled = m_TransmissionMode.intValue != (int)SubsurfaceScatteringProfile.TransmissionMode.None; // Draw the profile. m_ProfileMaterial.SetFloat("_MaxRadius", r); m_ProfileMaterial.SetVector("_ShapeParam", S); // Old SSS Model >>> Utilities.SelectKeyword(m_ProfileMaterial, "SSS_MODEL_DISNEY", "SSS_MODEL_BASIC", useDisneySSS); // Apply the three-sigma rule, and rescale. float s = (1.0f / 3.0f) * SssConstants.SSS_BASIC_DISTANCE_SCALE; float rMax = Mathf.Max(m_ScatterDistance1.colorValue.r, m_ScatterDistance1.colorValue.g, m_ScatterDistance1.colorValue.b, m_ScatterDistance2.colorValue.r, m_ScatterDistance2.colorValue.g, m_ScatterDistance2.colorValue.b); Vector4 stdDev1 = new Vector4(s * m_ScatterDistance1.colorValue.r, s * m_ScatterDistance1.colorValue.g, s * m_ScatterDistance1.colorValue.b); Vector4 stdDev2 = new Vector4(s * m_ScatterDistance2.colorValue.r, s * m_ScatterDistance2.colorValue.g, s * m_ScatterDistance2.colorValue.b); m_ProfileMaterial.SetVector("_StdDev1", stdDev1); m_ProfileMaterial.SetVector("_StdDev2", stdDev2); m_ProfileMaterial.SetFloat("_LerpWeight", m_LerpWeight.floatValue); m_ProfileMaterial.SetFloat("_MaxRadius", rMax); // <<< Old SSS Model 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.SetVector("_ShapeParam", S); m_TransmittanceMaterial.SetVector("_TransmissionTint", transmissionEnabled ? T : Vector4.zero); m_TransmittanceMaterial.SetVector("_ThicknessRemap", R); EditorGUI.DrawPreviewTexture(GUILayoutUtility.GetRect(16, 16), m_TransmittanceImage, m_TransmittanceMaterial, ScaleMode.ScaleToFit, 16.0f); serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { HDRenderPipeline hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline; // Validate each individual asset and update caches. hdPipeline.sssSettings.OnValidate(); } }