This commit is contained in:
2025-04-03 02:30:16 +08:00
parent 142adb61c6
commit bee7af1732
14907 changed files with 1009130 additions and 13 deletions

View File

@ -0,0 +1,212 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using System;
using UnityEngine;
using UnityEditor;
namespace AmplifyShaderEditor
{
[Serializable]
[NodeAttributes( "SRP Baked GI", "Miscellaneous", "Gets Baked GI info." )]
public sealed class BakedGINode : ParentNode
{
private const string BakedGIHeaderHDRP = "ASEBakedGI( {0}, {1}, {2}, {3} )";
private readonly string[] BakedGIBodyHDRP =
{
"float3 ASEBakedGI( float3 positionWS, float3 normalWS, float2 uvStaticLightmap, float2 uvDynamicLightmap )\n",
"{\n",
"\tfloat3 positionRWS = GetCameraRelativePositionWS( positionWS );\n",
"\treturn SampleBakedGI( positionRWS, normalWS, uvStaticLightmap, uvDynamicLightmap );\n",
"}\n"
};
private const string BakedGIHeaderHDRP2 = "ASEBakedGI( {0}, {1}, {2}, {3}, {4} )";
private readonly string[] BakedGIBodyHDRP2 =
{
"float3 ASEBakedGI( float3 positionWS, float3 normalWS, uint2 positionSS, float2 uvStaticLightmap, float2 uvDynamicLightmap )\n",
"{\n",
"\tfloat3 positionRWS = GetCameraRelativePositionWS( positionWS );\n",
"\tbool needToIncludeAPV = true;\n",
"\treturn SampleBakedGI( positionRWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap, needToIncludeAPV );\n",
"}\n"
};
private readonly string BakedGIHeaderURP = "ASEBakedGI( {0}, {1}, {2})";
private readonly string[] BakedGIBodyURP =
{
"float3 ASEBakedGI( float3 normalWS, float2 uvStaticLightmap, bool applyScaling )\n",
"{\n",
"#ifdef LIGHTMAP_ON\n",
"\tif( applyScaling )\n",
"\t\tuvStaticLightmap = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;\n",
"\treturn SampleLightmap( uvStaticLightmap, normalWS );\n",
"#else\n",
"\treturn SampleSH(normalWS);\n",
"#endif\n",
"}\n"
};
private readonly string BakedGIHeaderURP2 = "ASEBakedGI( {0}, {1}, {2}, {3}, {4}, {5})";
private readonly string[] BakedGIBodyURP2 =
{
"float3 ASEBakedGI( float3 positionWS, float3 normalWS, uint2 positionSS, float2 uvStaticLightmap, float2 uvDynamicLightmap, bool applyScaling )\n",
"{\n",
"#ifdef LIGHTMAP_ON\n",
"\tif (applyScaling)\n",
"\t{\n",
"\t\tuvStaticLightmap = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;\n",
"\t\tuvDynamicLightmap = uvDynamicLightmap * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;\n",
"\t}\n",
"#if defined(DYNAMICLIGHTMAP_ON)\n",
"\treturn SampleLightmap(uvStaticLightmap, uvDynamicLightmap, normalWS);\n",
"#else\n",
"\treturn SampleLightmap(uvStaticLightmap, normalWS);\n",
"#endif\n",
"#else\n",
"#if (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2))\n",
"\tif (_EnableProbeVolumes)\n",
"\t{\n",
"\t\tfloat3 bakeDiffuseLighting;\n",
"\t\tEvaluateAdaptiveProbeVolume(positionWS, normalWS, GetWorldSpaceNormalizeViewDir(positionWS), positionSS, bakeDiffuseLighting);\n",
"\t\treturn bakeDiffuseLighting;\n",
"\t}\n",
"\telse\n",
"\treturn SampleSH(normalWS);\n",
"#else\n",
"\treturn SampleSH(normalWS);\n",
"#endif\n",
"#endif\n",
"}\n"
};
private const string ApplyScalingStr = "Apply Scaling";
[SerializeField]
private bool m_applyScaling = true;
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddInputPort( WirePortDataType.FLOAT3, false, "World Position" );
AddInputPort( WirePortDataType.FLOAT3, false, "World Normal" );
AddInputPort( WirePortDataType.FLOAT2, false, "Static UV" );
AddInputPort( WirePortDataType.FLOAT2, false, "Dynamic UV" );
AddInputPort( WirePortDataType.FLOAT4, false, "Screen Position" );
AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue );
m_textLabelWidth = 95;
m_autoWrapProperties = true;
}
public override void DrawProperties()
{
base.DrawProperties();
EditorGUILayout.HelpBox( "Screen Position input must be Normalized (xyz/w), which is the default setting for Screen Position node.", MessageType.Info );
m_applyScaling = EditorGUILayoutToggle( ApplyScalingStr, m_applyScaling );
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if( !dataCollector.IsSRP )
{
UIUtils.ShowMessage( "Node only intended to use on HDRP and URP rendering pipelines" );
return GenerateErrorValue();
}
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
string positionWS;
if ( m_inputPorts[ 0 ].IsConnected )
{
positionWS = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
}
else
{
positionWS = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId );
}
string normalWS;
if ( m_inputPorts[ 1 ].IsConnected )
{
normalWS = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector );
}
else
{
normalWS = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId );
}
string uvStaticLightmap = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector );
string uvDynamicLightmap = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector );
string screenPos;
string positionSS;
if ( m_inputPorts[ 4 ].IsConnected )
{
screenPos = m_inputPorts[ 4 ].GeneratePortInstructions( ref dataCollector );
positionSS = string.Format( "( uint2 )( {0}.xy * _ScreenSize.xy )", screenPos );
}
else
{
screenPos = GeneratorUtils.GenerateScreenPositionRaw( ref dataCollector, UniqueId, CurrentPrecisionType );
positionSS = string.Format( "( uint2 )( {0}.xy / {0}.w * _ScreenSize.xy )", screenPos );
}
string localVarName = "bakedGI" + OutputId;
if ( dataCollector.TemplateDataCollectorInstance.IsHDRP )
{
bool unityIsBeta = TemplateHelperFunctions.GetUnityBetaVersion( out int betaVersion );
int unityVersion = TemplateHelperFunctions.GetUnityVersion();
if ( ASEPackageManagerHelper.CurrentHDRPBaseline == ASESRPBaseline.ASE_SRP_14 && unityVersion >= 20220326 ||
ASEPackageManagerHelper.CurrentHDRPBaseline == ASESRPBaseline.ASE_SRP_16 && unityVersion >= 20230220 ||
ASEPackageManagerHelper.CurrentHDRPBaseline == ASESRPBaseline.ASE_SRP_17 && unityIsBeta && betaVersion >= 15 ||
ASEPackageManagerHelper.CurrentSRPVersion >= ( int )170003 )
{
dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2" );
dataCollector.AddFunction( BakedGIBodyHDRP2[ 0 ], BakedGIBodyHDRP2, false );
RegisterLocalVariable( 0, string.Format( BakedGIHeaderHDRP2, positionWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap ), ref dataCollector, localVarName );
}
else
{
dataCollector.AddFunction( BakedGIBodyHDRP[ 0 ], BakedGIBodyHDRP, false );
RegisterLocalVariable( 0, string.Format( BakedGIHeaderHDRP, positionWS, normalWS, uvStaticLightmap, uvDynamicLightmap ), ref dataCollector, localVarName );
}
}
else
{
if ( ASEPackageManagerHelper.CurrentURPBaseline >= ASESRPBaseline.ASE_SRP_15 )
{
dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2" );
dataCollector.AddFunction( BakedGIBodyURP2[ 0 ], BakedGIBodyURP2, false );
RegisterLocalVariable( 0, string.Format( BakedGIHeaderURP2, positionWS, normalWS, positionSS, uvStaticLightmap, uvDynamicLightmap, m_applyScaling ? "true" : "false" ), ref dataCollector, localVarName );
}
else
{
dataCollector.AddFunction( BakedGIBodyURP[ 0 ], BakedGIBodyURP, false );
RegisterLocalVariable( 0, string.Format( BakedGIHeaderURP, normalWS, uvStaticLightmap, m_applyScaling ? "true" : "false" ), ref dataCollector, localVarName );
}
}
return localVarName;
}
public override void ReadFromString( ref string[] nodeParams )
{
base.ReadFromString( ref nodeParams );
m_applyScaling = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
}
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
{
base.WriteToString( ref nodeInfo, ref connectionsInfo );
IOUtils.AddFieldValueToString( ref nodeInfo, m_applyScaling );
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6aacdecbe4e41f44988580058f7e0000
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using System;
using UnityEngine;
using UnityEditor;
namespace AmplifyShaderEditor
{
[Serializable]
[NodeAttributes( "Exposure", "Lighting", "Get camera exposure value." )]
public sealed class Exposure : ParentNode
{
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue );
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
bool isHDRP = ( dataCollector.CurrentSRPType == TemplateSRPType.HDRP );
bool isURP17xOrAbove = ( dataCollector.CurrentSRPType == TemplateSRPType.URP && ASEPackageManagerHelper.CurrentSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_17 );
string result;
if ( isHDRP || isURP17xOrAbove )
{
result = "GetCurrentExposureMultiplier()";
}
else
{
result = "( 1.0 )";
}
return CreateOutputLocalVariable( 0, result, ref dataCollector );
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ea093c9de958f3e4f85654376b4933eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8469536c6560ff64aaac451c6f38dbba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,87 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
#if UNITY_2019_3_OR_NEWER
using UnityEditor;
using UnityEngine;
using System;
using System.Reflection;
namespace AmplifyShaderEditor
{
public class ASEDiffusionProfile : MaterialPropertyDrawer
{
string m_hashField = string.Empty;
public ASEDiffusionProfile( object guidField )
{
m_hashField = guidField.ToString();
}
public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor )
{
var guid = HDUtilsEx.ConvertVector4ToGUID( prop.vectorValue );
var profile = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guid ), DiffusionProfileSettingsEx.Type );
EditorGUI.BeginChangeCheck();
profile = EditorGUI.ObjectField( position, new GUIContent( label ), profile, DiffusionProfileSettingsEx.Type, false );
if( EditorGUI.EndChangeCheck() )
{
Vector4 newGuid = Vector4.zero;
float hash = 0;
if( profile != null )
{
var guid2 = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( profile ) );
newGuid = HDUtilsEx.ConvertGUIDToVector4( guid2 );
hash = HDShadowUtilsEx.Asfloat( DiffusionProfileSettingsEx.Hash( profile ) );
}
prop.vectorValue = newGuid;
var hashField = MaterialEditor.GetMaterialProperty( new UnityEngine.Object[] { editor.target }, m_hashField );
if( hashField != null )
{
hashField.floatValue = hash;
}
}
if( profile == null )
prop.vectorValue = Vector4.zero;
DiffusionProfileMaterialUIEx.DrawDiffusionProfileWarning( profile );
}
private static class DiffusionProfileMaterialUIEx
{
private static System.Type type = null;
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.Rendering.HighDefinition.DiffusionProfileMaterialUI, Unity.RenderPipelines.HighDefinition.Editor" ) : type; } }
public static void DrawDiffusionProfileWarning( UnityEngine.Object obj )
{
object[] parameters = new object[] { obj };
MethodInfo method = Type.GetMethod( "DrawDiffusionProfileWarning", BindingFlags.Static | BindingFlags.NonPublic );
method.Invoke( null, parameters );
}
}
private static class HDShadowUtilsEx
{
private static System.Type type = null;
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.HDShadowUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } }
public static float Asfloat( uint val )
{
object[] parameters = new object[] { val };
MethodInfo method = Type.GetMethod( "Asfloat", new Type[] { typeof( uint ) } );
return (float)method.Invoke( null, parameters );
}
public static uint Asuint( float val )
{
object[] parameters = new object[] { val };
MethodInfo method = Type.GetMethod( "Asuint", new Type[] { typeof( float ) } );
return (uint)method.Invoke( null, parameters );
}
}
}
}
#endif //UNITY_2019_3_OR_NEWER

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9e6450dc84bf1ed4cad27fcf99cad3fb
timeCreated: 1520330108
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,466 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
#if UNITY_2019_1_OR_NEWER
using UnityEditor;
using UnityEngine;
using System;
using System.Text;
using System.Reflection;
namespace AmplifyShaderEditor
{
public static class HDUtilsEx
{
private static System.Type type = null;
#if UNITY_2019_3_OR_NEWER
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.HDUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } }
#else
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Experimental.Rendering.HDPipeline.HDUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } }
#endif
public static string ConvertVector4ToGUID( Vector4 vector )
{
object[] parameters = new object[] { vector };
MethodInfo method;
method = Type.GetMethod( "ConvertVector4ToGUID", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof( Vector4 ) }, null );
if( method == null )
method = Type.GetMethod( "ConvertVector4ToGUID", new Type[] { typeof( Vector4 ) } );
return (string)method.Invoke( null, parameters );
}
public static Vector4 ConvertGUIDToVector4( string guid )
{
object[] parameters = new object[] { guid };
MethodInfo method;
method = Type.GetMethod( "ConvertGUIDToVector4", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof( string ) }, null );
if( method == null )
method = Type.GetMethod( "ConvertGUIDToVector4", new Type[] { typeof( string ) } );
return (Vector4)method.Invoke( null, parameters );
}
}
public static class DiffusionProfileSettingsEx
{
private static System.Type type = null;
#if UNITY_2019_3_OR_NEWER
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.DiffusionProfileSettings, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } }
#else
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Experimental.Rendering.HDPipeline.DiffusionProfileSettings, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } }
#endif
public static uint Hash( UnityEngine.Object m_instance )
{
FieldInfo field;
field = Type.GetField( "profile", BindingFlags.Instance | BindingFlags.NonPublic );
if( field == null )
field = Type.GetField( "profile" );
var profile = field.GetValue( m_instance );
var hashField = profile.GetType().GetField( "hash" );
return (uint)hashField.GetValue( profile );
}
}
[Serializable]
[NodeAttributes( "Diffusion Profile", "Constants And Properties", "Returns Diffusion Profile Hash Id. To be used on Diffusion Profile port on HDRP templates.", KeyCode.None, true, 0, int.MaxValue )]
public sealed class DiffusionProfileNode : PropertyNode
{
[SerializeField]
private UnityEngine.Object m_defaultValue;
[SerializeField]
private UnityEngine.Object m_materialValue;
[SerializeField]
private bool m_defaultInspector = false;
private bool m_isEditingFields;
//[NonSerialized]
//private DiffusionProfileSettings m_previousValue;
public const string NodeErrorMsg = "Only valid on HDRP";
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue );
m_drawPrecisionUI = false;
m_currentPrecisionType = PrecisionType.Float;
m_srpBatcherCompatible = true;
m_freeType = false;
#if UNITY_2019_3_OR_NEWER
m_freeType = true;
#endif
m_errorMessageTypeIsError = NodeMessageType.Error;
m_errorMessageTooltip = NodeErrorMsg;
}
protected override void OnUniqueIDAssigned()
{
base.OnUniqueIDAssigned();
UIUtils.RegisterPropertyNode( this );
}
public override void CopyDefaultsToMaterial()
{
m_materialValue = m_defaultValue;
}
public override void DrawSubProperties()
{
m_defaultValue = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultValue, DiffusionProfileSettingsEx.Type, true ) /*as UnityEngine.Object*/;
}
public override void DrawMaterialProperties()
{
if( m_materialMode )
EditorGUI.BeginChangeCheck();
m_materialValue = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialValue, DiffusionProfileSettingsEx.Type, true ) /*as DiffusionProfileSettings*/;
if( m_materialMode && EditorGUI.EndChangeCheck() )
{
m_requireMaterialUpdate = true;
}
}
public override void DrawMainPropertyBlock()
{
EditorGUILayout.BeginVertical();
{
if( m_freeType )
{
PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType );
if( parameterType != m_currentParameterType )
{
ChangeParameterType( parameterType );
BeginPropertyFromInspectorCheck();
}
}
if( m_freeName )
{
switch( m_currentParameterType )
{
case PropertyType.Property:
case PropertyType.InstancedProperty:
{
m_defaultInspector = EditorGUILayoutToggle( "Default Inspector", m_defaultInspector );
if( m_defaultInspector )
EditorGUILayout.HelpBox("While \"Default Inspector\" is turned ON you can't reorder this property or change it's name, and you can only have one per shader, use it only if you intend to share this shader with non-ASE users",MessageType.Info);
EditorGUI.BeginDisabledGroup( m_defaultInspector );
ShowPropertyInspectorNameGUI();
ShowPropertyNameGUI( true );
EditorGUI.EndDisabledGroup();
ShowVariableMode();
ShowAutoRegister();
ShowPrecision();
ShowToolbar();
}
break;
case PropertyType.Global:
{
ShowPropertyInspectorNameGUI();
ShowPropertyNameGUI( false );
ShowVariableMode();
ShowAutoRegister();
ShowPrecision();
ShowDefaults();
}
break;
case PropertyType.Constant:
{
ShowPropertyInspectorNameGUI();
ShowPrecision();
ShowDefaults();
}
break;
}
}
}
EditorGUILayout.EndVertical();
}
public override void OnNodeLogicUpdate(DrawInfo drawInfo)
{
base.OnNodeLogicUpdate( drawInfo );
m_showErrorMessage = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.SurfaceShader ) ||
( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.HDRP );
}
public override void DrawProperties()
{
base.DrawProperties();
if ( m_showErrorMessage )
{
EditorGUILayout.HelpBox(NodeErrorMsg, MessageType.Error );
}
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
if( m_currentParameterType != PropertyType.Constant )
{
if( m_defaultInspector )
return "_DiffusionProfileHash";
return PropertyData( dataCollector.PortCategory );
}
#if UNITY_2019_3_OR_NEWER
return RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) );
#else
return "asfloat(" + DefaultHash.ToString() + ")";
#endif
}
public override string GetUniformValue()
{
if( m_defaultInspector )
return "float _DiffusionProfileHash";
return base.GetUniformValue();
}
public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue )
{
if( m_defaultInspector )
{
dataType = "float";
dataName = "_DiffusionProfileHash";
return true;
}
return base.GetUniformData( out dataType, out dataName, ref fullValue );
}
public override string GetPropertyValue()
{
Vector4 asset = Vector4.zero;
if( m_defaultValue != null )
asset = HDUtilsEx.ConvertGUIDToVector4( AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) );
string assetVec = RoundTrip.ToRoundTrip( asset.x ) + ", " + RoundTrip.ToRoundTrip( asset.y ) + ", " + RoundTrip.ToRoundTrip( asset.z ) + ", " + RoundTrip.ToRoundTrip( asset.w );
string lineOne = string.Empty;
string lineTwo = string.Empty;
if( m_defaultInspector )
{
lineOne = PropertyAttributes + "[HideInInspector]_DiffusionProfileAsset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )";
lineTwo = "\n[HideInInspector]_DiffusionProfileHash(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) );
}
else
{
#if UNITY_2020_2_OR_NEWER
lineOne = "\n[DiffusionProfile]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) );
lineTwo = PropertyAttributes + "[HideInInspector]" + m_propertyName + "_Asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )";
#else
lineOne = PropertyAttributes + "[ASEDiffusionProfile(" + m_propertyName + ")]" + m_propertyName + "_asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )";
lineTwo = "\n[HideInInspector]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip( HDShadowUtilsEx.Asfloat( DefaultHash ) );
#endif
}
return lineOne + lineTwo;
}
public override void UpdateMaterial( Material mat )
{
base.UpdateMaterial( mat );
if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction )
{
if( m_materialValue != null )
{
Vector4 asset = HDUtilsEx.ConvertGUIDToVector4( AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) );
if( m_defaultInspector )
{
mat.SetVector( "_DiffusionProfileAsset", asset );
mat.SetFloat( "_DiffusionProfileHash", HDShadowUtilsEx.Asfloat( MaterialHash ) );
}
else
{
mat.SetVector( m_propertyName + "_asset", asset );
mat.SetFloat( m_propertyName, HDShadowUtilsEx.Asfloat( MaterialHash ) );
}
}
}
}
public override void ForceUpdateFromMaterial( Material material )
{
string propertyAsset = m_propertyName + "_asset";
if( m_defaultInspector )
propertyAsset = "_DiffusionProfileAsset";
if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( propertyAsset ) )
{
var guid = HDUtilsEx.ConvertVector4ToGUID( material.GetVector( propertyAsset ) );
var profile = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( guid ), DiffusionProfileSettingsEx.Type );
if( profile != null )
m_materialValue = profile;
}
}
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
{
base.WriteToString( ref nodeInfo, ref connectionsInfo );
string defaultGuid = ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : "0";
IOUtils.AddFieldValueToString( ref nodeInfo, defaultGuid );
string materialGuid = ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : "0";
IOUtils.AddFieldValueToString( ref nodeInfo, materialGuid );
IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultInspector );
}
public override void ReadFromString( ref string[] nodeParams )
{
if( UIUtils.CurrentShaderVersion() > 17004 )
base.ReadFromString( ref nodeParams );
else
ParentReadFromString( ref nodeParams );
string defaultGuid = GetCurrentParam( ref nodeParams );
if( defaultGuid.Length > 1 )
{
m_defaultValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( defaultGuid ), DiffusionProfileSettingsEx.Type );
}
if( UIUtils.CurrentShaderVersion() > 17004 )
{
string materialGuid = GetCurrentParam( ref nodeParams );
if( materialGuid.Length > 1 )
{
m_materialValue = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( materialGuid ), DiffusionProfileSettingsEx.Type );
}
}
if( UIUtils.CurrentShaderVersion() > 17900 )
{
m_defaultInspector = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
}
}
public override void ReadOutputDataFromString( ref string[] nodeParams )
{
base.ReadOutputDataFromString( ref nodeParams );
if( UIUtils.CurrentShaderVersion() < 17005 )
m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.FLOAT, false );
}
public override string GetPropertyValStr()
{
if( m_defaultInspector )
return "_DiffusionProfileHash";
return PropertyName;
}
//Vector4 ProfileGUID { get { return ( m_diffusionProfile != null ) ? HDUtils.ConvertGUIDToVector4( AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_diffusionProfile ) ) ) : Vector4.zero; } }
uint DefaultHash { get { return ( m_defaultValue != null ) ? DiffusionProfileSettingsEx.Hash( m_defaultValue ) : 0; } }
uint MaterialHash { get { return ( m_materialValue != null ) ? DiffusionProfileSettingsEx.Hash( m_materialValue ) : 0; } }
private static class HDShadowUtilsEx
{
private static System.Type type = null;
public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Rendering.HighDefinition.HDShadowUtils, Unity.RenderPipelines.HighDefinition.Runtime" ) : type; } }
public static float Asfloat( uint val )
{
#if UNITY_2019_3_OR_NEWER
object[] parameters = new object[] { val };
MethodInfo method = Type.GetMethod( "Asfloat", new Type[] { typeof( uint ) } );
return (float)method.Invoke( null, parameters );
#else
return HDShadowUtils.Asfloat( val );
#endif
}
public static uint Asuint( float val )
{
#if UNITY_2019_3_OR_NEWER
object[] parameters = new object[] { val };
MethodInfo method = Type.GetMethod( "Asuint", new Type[] { typeof( float ) } );
return (uint)method.Invoke( null, parameters );
#else
return HDShadowUtils.Asuint( val );
#endif
}
}
private static class RoundTrip
{
private static String[] zeros = new String[ 1000 ];
static RoundTrip()
{
for( int i = 0; i < zeros.Length; i++ )
{
zeros[ i ] = new String( '0', i );
}
}
public static String ToRoundTrip( double value )
{
String str = value.ToString( "r" );
int x = str.IndexOf( 'E' );
if( x < 0 ) return str;
int x1 = x + 1;
String exp = str.Substring( x1, str.Length - x1 );
int e = int.Parse( exp );
String s = null;
int numDecimals = 0;
if( value < 0 )
{
int len = x - 3;
if( e >= 0 )
{
if( len > 0 )
{
s = str.Substring( 0, 2 ) + str.Substring( 3, len );
numDecimals = len;
}
else
s = str.Substring( 0, 2 );
}
else
{
// remove the leading minus sign
if( len > 0 )
{
s = str.Substring( 1, 1 ) + str.Substring( 3, len );
numDecimals = len;
}
else
s = str.Substring( 1, 1 );
}
}
else
{
int len = x - 2;
if( len > 0 )
{
s = str[ 0 ] + str.Substring( 2, len );
numDecimals = len;
}
else
s = str[ 0 ].ToString();
}
if( e >= 0 )
{
e = e - numDecimals;
String z = ( e < zeros.Length ? zeros[ e ] : new String( '0', e ) );
s = s + z;
}
else
{
e = ( -e - 1 );
String z = ( e < zeros.Length ? zeros[ e ] : new String( '0', e ) );
if( value < 0 )
s = "-0." + z + s;
else
s = "0." + z + s;
}
return s;
}
}
}
}
#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3998227d1294c2d4d98caf969b04f89a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,152 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using System;
using UnityEditor;
namespace AmplifyShaderEditor
{
using UnityEngine;
[Serializable]
[NodeAttributes( "HD Emission", "Miscellaneous", "Get emission HDR Color. Only available on HDRP." )]
public sealed class HDEmissionNode : ParentNode
{
public enum HDEmissionIntensityUnit
{
Luminance,
EV100
};
public readonly string[] EmissionFunctionWithNormalize =
{
"float3 ASEGetEmissionHDRColorNormalize(float3 ldrColor, float luminanceIntensity, float exposureWeight, float inverseCurrentExposureMultiplier)\n",
"{\n",
"\tldrColor = ldrColor * rcp(max(Luminance(ldrColor), 1e-6));\n",
"\tfloat3 hdrColor = ldrColor * luminanceIntensity;\n",
"\thdrColor = lerp( hdrColor* inverseCurrentExposureMultiplier, hdrColor, exposureWeight);\n",
"\treturn hdrColor;\n",
"}\n",
};
public readonly string[] EmissionFunction =
{
"float3 ASEGetEmissionHDRColor(float3 ldrColor, float luminanceIntensity, float exposureWeight, float inverseCurrentExposureMultiplier)\n",
"{\n",
"\tfloat3 hdrColor = ldrColor * luminanceIntensity;\n",
"\thdrColor = lerp( hdrColor* inverseCurrentExposureMultiplier, hdrColor, exposureWeight);\n",
"\treturn hdrColor;\n",
"}\n",
};
public const string CommonLightingLib = "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl";
public const string EmissionHeaderLuminance = "ASEGetEmissionHDRColor{0}({1},{2},{3},GetInverseCurrentExposureMultiplier())";
public const string EmissionHeaderEV100 = "ASEGetEmissionHDRColor{0}({1},ConvertEvToLuminance({2}),{3},GetInverseCurrentExposureMultiplier())";
public const string IntensityUnityLabel = "Intensity Unit";
public const string NormalizeColorLabel = "Normalize Color";
public const string ErrorOnCompilationMsg = "Attempting to use HDRP specific node on incorrect SRP or Builtin RP.";
public const string MinorVersionMsg = "This node require at least Unity 2019.1/HDRP v5 to properly work.";
public const string NodeErrorMsg = "Only valid on HDRP";
public const string MinorNodeErrorMsg = "Invalid Unity/HDRP version";
[SerializeField]
private HDEmissionIntensityUnit m_intensityUnit = HDEmissionIntensityUnit.Luminance;
[SerializeField]
private bool m_normalizeColor = false;
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddInputPort( WirePortDataType.FLOAT3, false, "Color" );
AddInputPort( WirePortDataType.FLOAT, false, "Intensity" );
AddInputPort( WirePortDataType.FLOAT, false, "Exposition Weight" );
AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue );
m_errorMessageTooltip = NodeErrorMsg;
m_errorMessageTypeIsError = NodeMessageType.Error;
m_autoWrapProperties = true;
}
public override void DrawProperties()
{
base.DrawProperties();
m_intensityUnit = (HDEmissionIntensityUnit)EditorGUILayoutEnumPopup( IntensityUnityLabel, m_intensityUnit );
m_normalizeColor = EditorGUILayoutToggle( NormalizeColorLabel, m_normalizeColor );
if( m_showErrorMessage )
{
EditorGUILayout.HelpBox( NodeErrorMsg , MessageType.Error );
}
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if( !dataCollector.IsSRP || !dataCollector.TemplateDataCollectorInstance.IsHDRP )
{
UIUtils.ShowMessage( ErrorOnCompilationMsg , MessageSeverity.Error );
return GenerateErrorValue();
}
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
#if UNITY_2020_3_OR_NEWER
dataCollector.AddToIncludes( UniqueId , CommonLightingLib );
#endif
string colorValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
string intensityValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector );
string expositionWeightValue = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector );
string functionPrefix = string.Empty;
if( m_normalizeColor )
{
functionPrefix = "Normalize";
dataCollector.AddFunction( EmissionFunctionWithNormalize[ 0 ], EmissionFunctionWithNormalize , false);
}
else
{
dataCollector.AddFunction( EmissionFunction[ 0 ], EmissionFunction, false );
}
string varName = "hdEmission" + OutputId;
string varValue = string.Empty;
switch( m_intensityUnit )
{
default:
case HDEmissionIntensityUnit.Luminance:
varValue = string.Format( EmissionHeaderLuminance, functionPrefix, colorValue, intensityValue, expositionWeightValue );
break;
case HDEmissionIntensityUnit.EV100:
varValue = string.Format( EmissionHeaderEV100, functionPrefix, colorValue, intensityValue, expositionWeightValue );
break;
}
dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, varName, varValue );
m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory );
return varName;
}
public override void OnNodeLogicUpdate( DrawInfo drawInfo )
{
base.OnNodeLogicUpdate( drawInfo );
m_showErrorMessage = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.SurfaceShader ) ||
( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.HDRP );
}
public override void ReadFromString( ref string[] nodeParams )
{
base.ReadFromString( ref nodeParams );
Enum.TryParse<HDEmissionIntensityUnit>( GetCurrentParam( ref nodeParams ), out m_intensityUnit );
m_normalizeColor = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) );
}
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
{
base.WriteToString( ref nodeInfo, ref connectionsInfo );
IOUtils.AddFieldValueToString( ref nodeInfo, m_intensityUnit );
IOUtils.AddFieldValueToString( ref nodeInfo, m_normalizeColor );
}
}
}
//#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d6b42642ffce2754fba2cf8305e1da68
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,128 @@
// Amplify Shader Editor - Visual Shader vEditing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
using UnityEditor;
using System;
namespace AmplifyShaderEditor
{
[NodeAttributes( "Material Quality", "Logical Operators", "Choose between separate branches according to currently selected Quality (SRP only) ", Available = true )]
public class MaterialQualityNode : ParentNode
{
private const string SRPError = "Node intended to be used only on SRP templates as it makes use of keywords defined over that environment.";
private const string MaxKeyword = "MATERIAL_QUALITY_HIGH";
private const string MedKeyword = "MATERIAL_QUALITY_MEDIUM";
private const string MinKeyword = "MATERIAL_QUALITY_LOW";
private const string MaterialPragmas = "#pragma shader_feature " + MaxKeyword + " " + MedKeyword + " " + MinKeyword;
private readonly string[] MaterialCode =
{
"#if defined("+MaxKeyword+")",
"#elif defined("+MedKeyword+")",
"#else",
"#endif"
};
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddInputPort( WirePortDataType.FLOAT, false, "High" );
AddInputPort( WirePortDataType.FLOAT, false, "Medium" );
AddInputPort( WirePortDataType.FLOAT, false, "Low" );
AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue );
m_errorMessageTypeIsError = NodeMessageType.Error;
m_errorMessageTooltip = SRPError;
}
public override void OnNodeLogicUpdate( DrawInfo drawInfo )
{
base.OnNodeLogicUpdate( drawInfo );
if( !ContainerGraph.IsSRP )
{
if( !m_showErrorMessage )
{
m_showErrorMessage = true;
}
}
else
{
if( m_showErrorMessage )
{
m_showErrorMessage = false;
}
}
}
public override void OnInputPortConnected( int portId , int otherNodeId , int otherPortId , bool activateNode = true )
{
base.OnInputPortConnected( portId , otherNodeId , otherPortId , activateNode );
UpdateConnections();
}
public override void OnConnectedOutputNodeChanges( int inputPortId , int otherNodeId , int otherPortId , string name , WirePortDataType type )
{
base.OnConnectedOutputNodeChanges( inputPortId , otherNodeId , otherPortId , name , type );
UpdateConnections();
}
public override void OnInputPortDisconnected( int portId )
{
base.OnInputPortDisconnected( portId );
UpdateConnections();
}
private void UpdateConnections()
{
WirePortDataType mainType = WirePortDataType.FLOAT;
int highest = UIUtils.GetPriority( mainType );
for( int i = 0 ; i < m_inputPorts.Count ; i++ )
{
if( m_inputPorts[ i ].IsConnected )
{
WirePortDataType portType = m_inputPorts[ i ].GetOutputConnection().DataType;
if( UIUtils.GetPriority( portType ) > highest )
{
mainType = portType;
highest = UIUtils.GetPriority( portType );
}
}
}
for( int i = 0 ; i < m_inputPorts.Count ; i++ )
{
m_inputPorts[ i ].ChangeType( mainType , false );
}
m_outputPorts[ 0 ].ChangeType( mainType , false );
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
dataCollector.AddToDirectives( MaterialPragmas );
string maxQualityValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
string medQualityValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector );
string minQualityValue = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector );
string localVarName = "currQuality" + OutputId;
dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, "0" );
//High
dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 0 ], true );
dataCollector.AddLocalVariable( UniqueId, localVarName, maxQualityValue, false, true );
//Medium
dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 1 ], true );
dataCollector.AddLocalVariable( UniqueId, localVarName, medQualityValue, false, true );
//Low
dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 2 ], true );
dataCollector.AddLocalVariable( UniqueId, localVarName, minQualityValue,false,true );
m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory );
dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 3 ], true );
return localVarName;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8245233e0833c884b8a176943d80514b
timeCreated: 1570027418
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2d54cc941c4e4d249be04d0d3760659a
folderAsset: yes
timeCreated: 1617727953
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,114 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using System;
using UnityEngine;
using UnityEditor;
namespace AmplifyShaderEditor
{
[Serializable]
[NodeAttributes( "Reflection Probe", "Miscellaneous", "Provides access to the nearest Reflection Probe to the object. Only available on URP.\n\nView Dir OS: View Direction in Object-space\nNormal OS: Normal in Object-space\nLOD: Index of level-of-detail" )]
public class ReflectionProbeNode : ParentNode
{
private const string ReflectionProbeStr = "SHADERGRAPH_REFLECTION_PROBE({0},{1},{2})";
private const string InfoTransformSpace = "Both View Dir and Normal vectors are set in Object Space";
public const string NodeErrorMsg = "Only valid on URP";
public const string ErrorOnCompilationMsg = "Attempting to use URP specific node on incorrect SRP or Builtin RP.";
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddInputPort( WirePortDataType.FLOAT3, false, "View Dir OS" );
AddInputPort( WirePortDataType.FLOAT3, false, "Normal OS" );
AddInputPort( WirePortDataType.FLOAT, false, "LOD" );
AddOutputPort( WirePortDataType.FLOAT3, "Out" );
m_autoWrapProperties = true;
m_errorMessageTooltip = NodeErrorMsg;
m_errorMessageTypeIsError = NodeMessageType.Error;
m_previewShaderGUID = "f7d3fa6f91f1f184f89060feb01051a1";
m_drawPreviewAsSphere = true;
}
public override void OnNodeLogicUpdate( DrawInfo drawInfo )
{
base.OnNodeLogicUpdate( drawInfo );
m_showErrorMessage = ( ContainerGraph.CurrentCanvasMode == NodeAvailability.SurfaceShader ) ||
( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.URP );
}
public override void DrawProperties()
{
base.DrawProperties();
EditorGUILayout.HelpBox( InfoTransformSpace, MessageType.Info );
if ( m_showErrorMessage )
{
EditorGUILayout.HelpBox( NodeErrorMsg, MessageType.Error );
}
}
public override void SetPreviewInputs()
{
base.SetPreviewInputs();
PreviewMaterial.SetInt( "viewDirInput", m_inputPorts[ 0 ].IsConnected ? 1 : 0 );
PreviewMaterial.SetInt( "normalInput", m_inputPorts[ 1 ].IsConnected ? 1 : 0 );
PreviewMaterial.SetInt( "lodInput", m_inputPorts[ 2 ].IsConnected ? 1 : 0 );
}
uint viewDirInput;
uint normalInput;
uint lodInput;
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if ( !dataCollector.IsSRP || !dataCollector.TemplateDataCollectorInstance.IsLWRP )
{
UIUtils.ShowMessage( ErrorOnCompilationMsg, MessageSeverity.Error );
return GenerateErrorValue();
}
if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
if ( dataCollector.IsSRP && dataCollector.CurrentSRPType == TemplateSRPType.URP )
{
if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_12 )
{
dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ _REFLECTION_PROBE_BLENDING" );
dataCollector.AddToPragmas( UniqueId, "multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION" );
}
if ( ASEPackageManagerHelper.PackageSRPVersion >= ( int )ASESRPBaseline.ASE_SRP_14 )
{
dataCollector.AddToPragmas( UniqueId, "multi_compile _ _FORWARD_PLUS" );
}
}
string viewDirOS;
if ( m_inputPorts[ 0 ].IsConnected )
{
viewDirOS = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector );
}
else
{
viewDirOS = dataCollector.TemplateDataCollectorInstance.GetViewDir( CurrentPrecisionType, space: ViewSpace.Object );
}
string normalOS;
if ( m_inputPorts[ 1 ].IsConnected )
{
normalOS = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector );
}
else
{
normalOS = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType );
}
string lod = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector );
RegisterLocalVariable( outputId, string.Format( ReflectionProbeStr, viewDirOS, normalOS, lod ), ref dataCollector );
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 391a18455087a034bb4c09be42caa46a
timeCreated: 1617727965
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: