void ShaderSSSAndTransmissionInputGUI() { var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline; if (hdPipeline == null) return; DiffusionProfileMaterialUI.OnGUI(materialEditor, diffusionProfileAsset[m_LayerIndex], diffusionProfileHash[m_LayerIndex], m_LayerIndex); if ((int)materialID.floatValue == (int)MaterialId.LitSSS && materials.All(m => m.GetSurfaceType() != SurfaceType.Transparent)) { materialEditor.ShaderProperty(subsurfaceMask[m_LayerIndex], Styles.subsurfaceMaskText); materialEditor.TexturePropertySingleLine(Styles.subsurfaceMaskMapText, subsurfaceMaskMap[m_LayerIndex]); } if ((int)materialID.floatValue == (int)MaterialId.LitTranslucent || ((int)materialID.floatValue == (int)MaterialId.LitSSS && transmissionEnable.floatValue > 0.0f)) { if (thicknessMap[m_LayerIndex].textureValue != null) { materialEditor.TexturePropertySingleLine(Styles.thicknessMapText, thicknessMap[m_LayerIndex]); // Display the remap of texture values. materialEditor.MinMaxShaderProperty(thicknessRemap[m_LayerIndex], 0.0f, 1.0f, Styles.thicknessRemapText); } else { // Allow the user to set the constant value of thickness if no thickness map is provided. materialEditor.TexturePropertySingleLine(Styles.thicknessText, thicknessMap[m_LayerIndex], thickness[m_LayerIndex]); } } }
void DrawDiffusionProfileUI() { if (DiffusionProfileMaterialUI.IsSupported(materialEditor)) { DiffusionProfileMaterialUI.OnGUI(FindProperty("_DiffusionProfileAsset"), FindProperty("_DiffusionProfileHash")); } }
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor) { // Find properties var assetProperty = MaterialEditor.GetMaterialProperty(editor.targets, prop.name + "_Asset"); DiffusionProfileMaterialUI.OnGUI(editor, assetProperty, prop, 0, prop.displayName); }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { materialEditor.PropertiesDefaultGUI(props); if (materialEditor.EmissionEnabledProperty()) { materialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true, true); } // Make sure all selected materials are initialized. string materialTag = "MotionVector"; foreach (var obj in materialEditor.targets) { var material = (Material)obj; string tag = material.GetTag(materialTag, false, "Nothing"); if (tag == "Nothing") { material.SetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr, false); material.SetOverrideTag(materialTag, "User"); } } { // If using multi-select, apply toggled material to all materials. bool enabled = ((Material)materialEditor.target).GetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr); EditorGUI.BeginChangeCheck(); enabled = EditorGUILayout.Toggle("Motion Vector For Vertex Animation", enabled); if (EditorGUI.EndChangeCheck()) { foreach (var obj in materialEditor.targets) { var material = (Material)obj; material.SetShaderPassEnabled(HDShaderPassNames.s_MotionVectorsStr, enabled); } } } if (DiffusionProfileMaterialUI.IsSupported(materialEditor)) { DiffusionProfileMaterialUI.OnGUI(materialEditor, FindProperty("_DiffusionProfileAsset", props), FindProperty("_DiffusionProfileHash", props), 0); } }
void ShaderSSSAndTransmissionInputGUI() { var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline; if (hdPipeline == null) { return; } DiffusionProfileMaterialUI.OnGUI(diffusionProfileAsset[m_LayerIndex], diffusionProfileHash[m_LayerIndex]); // TODO: does not work with multi-selection if ((int)materialID.floatValue == (int)MaterialId.LitSSS && materials[0].GetSurfaceType() != SurfaceType.Transparent) { materialEditor.ShaderProperty(subsurfaceMask[m_LayerIndex], Styles.subsurfaceMaskText); materialEditor.TexturePropertySingleLine(Styles.subsurfaceMaskMapText, subsurfaceMaskMap[m_LayerIndex]); } if ((int)materialID.floatValue == (int)MaterialId.LitTranslucent || ((int)materialID.floatValue == (int)MaterialId.LitSSS && transmissionEnable.floatValue > 0.0f)) { materialEditor.TexturePropertySingleLine(Styles.thicknessMapText, thicknessMap[m_LayerIndex]); if (thicknessMap[m_LayerIndex].textureValue != null) { // Display the remap of texture values. Vector2 remap = thicknessRemap[m_LayerIndex].vectorValue; EditorGUI.BeginChangeCheck(); EditorGUILayout.MinMaxSlider(Styles.thicknessRemapText, ref remap.x, ref remap.y, 0.0f, 1.0f); if (EditorGUI.EndChangeCheck()) { thicknessRemap[m_LayerIndex].vectorValue = remap; } } else { // Allow the user to set the constant value of thickness if no thickness map is provided. materialEditor.ShaderProperty(thickness[m_LayerIndex], Styles.thicknessText); } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.PropertyField(position, property, label); DiffusionProfileMaterialUI.DrawDiffusionProfileWarning(property.objectReferenceValue as DiffusionProfileSettings); }