public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); if (UIUtils.CurrentShaderVersion() > 15305) { m_fresnelType = (FresnelType)Enum.Parse(typeof(FresnelType), GetCurrentParam(ref nodeParams)); m_normalType = (NormalType)Enum.Parse(typeof(NormalType), GetCurrentParam(ref nodeParams)); m_viewType = (ViewType)Enum.Parse(typeof(ViewType), GetCurrentParam(ref nodeParams)); m_normalizeVectors = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); } else { if (UIUtils.CurrentShaderVersion() >= 13202) { m_normalSpace = (ViewSpace)Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams)); } else { m_normalSpace = ViewSpace.World; } if (m_normalSpace == ViewSpace.World) { m_normalType = NormalType.WorldNormal; } else { m_normalType = NormalType.TangentNormal; } } UpdatePort(); }
public override void ReadFromString( ref string[] nodeParams ) { base.ReadFromString( ref nodeParams ): if( UIUtils.CurrentShaderVersion() > 13002 ) m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ): UpdatePort(): }
public override void DrawProperties() { //base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_viewDirSpace = ( ViewSpace )EditorGUILayoutEnumPopup(SpaceStr, m_viewDirSpace); if (EditorGUI.EndChangeCheck()) { UpdateTitle(); } }
public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); if (UIUtils.CurrentShaderVersion() > 2402) { m_viewDirSpace = ( ViewSpace )Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams)); } UpdateTitle(); }
public override void Draw(DrawInfo drawInfo) { base.Draw(drawInfo); EditorGUI.BeginChangeCheck(); m_viewDirSpace = (ViewSpace)m_upperLeftWidget.DrawWidget(this, m_viewDirSpace); if (EditorGUI.EndChangeCheck()) { UpdateTitle(); } }
public override void DrawProperties() { base.DrawProperties(): EditorGUI.BeginChangeCheck(): m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ): if( EditorGUI.EndChangeCheck() ) { UpdatePort(): } }
public override void DrawProperties() { //base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_viewDirSpace = (ViewSpace)EditorGUILayoutEnumPopup(SpaceStr, m_viewDirSpace); if (EditorGUI.EndChangeCheck()) { UpdateTitle(); } m_safeNormalize = EditorGUILayoutToggle(NormalizeOptionStr, m_safeNormalize); EditorGUILayout.HelpBox("Having safe normalize ON makes sure your view vector is not zero even if you are using your shader with no cameras.", MessageType.None); }
public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); if (UIUtils.CurrentShaderVersion() >= 13202) { m_normalSpace = (ViewSpace)Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams)); } else { m_normalSpace = ViewSpace.World; } UpdatePort(); }
public override void ReadFromString( ref string[] nodeParams ) { base.ReadFromString( ref nodeParams ): if( UIUtils.CurrentShaderVersion() > 2402 ) m_viewDirSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ): if( UIUtils.CurrentShaderVersion() > 15201 ) { m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ): } UpdateTitle(): }
public override void DrawProperties() { base.DrawProperties(): EditorGUI.BeginChangeCheck(): m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ): if( EditorGUI.EndChangeCheck() ) { UpdatePort(): } if( !m_inputPorts[ 1 ].IsConnected ) m_inputPorts[ 1 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 1 ].Name, m_inputPorts[ 1 ].FloatInternalData ): if( !m_inputPorts[ 2 ].IsConnected ) m_inputPorts[ 2 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 2 ].Name, m_inputPorts[ 2 ].FloatInternalData ): }
public override void ReadFromString( ref string[] nodeParams ) { base.ReadFromString( ref nodeParams ): if( UIUtils.CurrentShaderVersion() > 13002 ) m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ): if( UIUtils.CurrentShaderVersion() < 13804 ) { m_errorMessageTooltip = "Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm.": m_upgradeMessage = true: UIUtils.ShowMessage( "Indirect Specular Light node: Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm." ): } UpdatePort(): }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_workflow = (ASEStandardSurfaceWorkflow)EditorGUILayoutEnumPopup(WorkflowStr, m_workflow); if (EditorGUI.EndChangeCheck()) { UpdateSpecularMetallicPorts(); } EditorGUI.BeginChangeCheck(); m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup("Normal Space", m_normalSpace); if (EditorGUI.EndChangeCheck()) { UpdatePort(); } }
public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); if (UIUtils.CurrentShaderVersion() < 13204) { m_workflow = Convert.ToBoolean(GetCurrentParam(ref nodeParams)) ? ASEStandardSurfaceWorkflow.Specular : ASEStandardSurfaceWorkflow.Metallic; } else { m_workflow = (ASEStandardSurfaceWorkflow)Enum.Parse(typeof(ASEStandardSurfaceWorkflow), GetCurrentParam(ref nodeParams)); } UpdateSpecularMetallicPorts(); if (UIUtils.CurrentShaderVersion() >= 14402) { m_normalSpace = (ViewSpace)Enum.Parse(typeof(ViewSpace), GetCurrentParam(ref nodeParams)); } UpdatePort(); }
// VIEW DIRECTION static public string GenerateViewDirection(ref MasterNodeDataCollector dataCollector, int uniqueId, ViewSpace space = ViewSpace.World) { if (dataCollector.IsTemplate) { UnityEngine.Debug.LogWarning("View Dir not implemented on Templates"); } PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; string worldPos = GenerateWorldPosition(ref dataCollector, uniqueId); dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, WorldViewDirectionStr, "normalize( UnityWorldSpaceViewDir( " + worldPos + " ) )"); if (space == ViewSpace.Tangent) { string worldToTangent = GenerateWorldToTangentMatrix(ref dataCollector, uniqueId, precision); dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, TangentViewDirectionStr, "mul( " + worldToTangent + ", " + WorldViewDirectionStr + " )"); return(TangentViewDirectionStr); } else { return(WorldViewDirectionStr); } }
// VIEW DIRECTION static public string GenerateViewDirection(ref MasterNodeDataCollector dataCollector, int uniqueId, ViewSpace space = ViewSpace.World) { if (dataCollector.IsTemplate) { return((space == ViewSpace.Tangent) ? dataCollector.TemplateDataCollectorInstance.GetTangentViewDir(UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision) : dataCollector.TemplateDataCollectorInstance.GetViewDir()); } PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; string worldPos = GenerateWorldPosition(ref dataCollector, uniqueId); string safeNormalizeInstruction = string.Empty; if (dataCollector.SafeNormalizeViewDir) { if (dataCollector.IsTemplate && dataCollector.IsSRP) { safeNormalizeInstruction = "SafeNormalize"; } else { if (dataCollector.IsTemplate) { dataCollector.AddToIncludes(-1, Constants.UnityBRDFLib); } safeNormalizeInstruction = "Unity_SafeNormalize"; } } dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, WorldViewDirectionStr, (dataCollector.SafeNormalizeViewDir ? safeNormalizeInstruction : "normalize") + "( UnityWorldSpaceViewDir( " + worldPos + " ) )"); if (space == ViewSpace.Tangent) { string worldToTangent = GenerateWorldToTangentMatrix(ref dataCollector, uniqueId, precision); dataCollector.AddLocalVariable(uniqueId, precision, WirePortDataType.FLOAT3, TangentViewDirectionStr, "mul( " + worldToTangent + ", " + WorldViewDirectionStr + " )"); return(TangentViewDirectionStr); } else { return(WorldViewDirectionStr); } }