Values Stored In Nodes Zeroing Out

Node-based Shader Editor

Values Stored In Nodes Zeroing Out

Postby aislynnk » Fri Aug 11, 2017 9:55 pm

Hello!

I'm really enjoying ASE so far but I've run into a problem where values stored in the node will 0 out on saves. It's hard to tell exactly when/what causes it to happen. The most obvious case was when the scale gets turned from 1 to 0 on fresnel or normal map texture sampler nodes.

We've been storing all values in float 1s just to be safe but I assume that this isn't supposed to happen.

Was wondering if anyone else has run into this! :D
aislynnk
 
Posts: 4
Joined: Fri Aug 11, 2017 9:46 pm

Re: Values Stored In Nodes Zeroing Out

Postby Ricardo Teixeira » Sat Aug 12, 2017 11:52 am

aislynnk wrote:Hello!

I'm really enjoying ASE so far but I've run into a problem where values stored in the node will 0 out on saves. It's hard to tell exactly when/what causes it to happen. The most obvious case was when the scale gets turned from 1 to 0 on fresnel or normal map texture sampler nodes.

We've been storing all values in float 1s just to be safe but I assume that this isn't supposed to happen.

Was wondering if anyone else has run into this! :D


Hello,

Thank you for using ASE, we really appreciate it. Unfortunately, we have not come across that specific issue before. Can you share a sample and the necessary steps to replicate the problem?

Looking forward to your reply.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Values Stored In Nodes Zeroing Out

Postby aislynnk » Tue Aug 15, 2017 7:03 pm

So I got it to happen on a simple shader with an emmissive fresnel. It has happened without the fresnel error before, but this was just the most consistent way to replicate it. Also, after fixing the fresnel error, I'm still not able to turn the scale in the normal's texture sampler back to 1 without adding a float 1.

Repro Steps:
1. Normal shader ("ASE_Test_Normal") is created and looks as expected in scene mode.
2. Close shader editor.
3. Press play in Unity.
4. Exit play mode.
5. Open shader in shader editor again.
6. Save the shader and you get "ASE_Test_Zero".

Let me know if y'all need anymore information!

Thank you!

Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "ASE_Test_Normal"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _TestAlbedo("TestAlbedo", 2D) = "white" {}
      _TestNormal("TestNormal", 2D) = "white" {}
      [HideInInspector] _texcoord( "", 2D ) = "white" {}
   }

   SubShader
   {
      Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" "IsEmissive" = "true"  }
      Cull Back
      CGINCLUDE
      #include "UnityPBSLighting.cginc"
      #include "Lighting.cginc"
      #pragma target 4.0
      #ifdef UNITY_PASS_SHADOWCASTER
         #undef INTERNAL_DATA
         #undef WorldReflectionVector
         #undef WorldNormalVector
         #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
         #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
         #define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
      #endif
      struct Input
      {
         float2 uv_texcoord;
         float3 worldPos;
         float3 worldNormal;
         INTERNAL_DATA
      };

      uniform sampler2D _TestNormal;
      uniform float4 _TestNormal_ST;
      uniform sampler2D _TestAlbedo;
      uniform float4 _TestAlbedo_ST;

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float2 uv_TestNormal = i.uv_texcoord * _TestNormal_ST.xy + _TestNormal_ST.zw;
         o.Normal = UnpackNormal( tex2D( _TestNormal, uv_TestNormal ) );
         float2 uv_TestAlbedo = i.uv_texcoord * _TestAlbedo_ST.xy + _TestAlbedo_ST.zw;
         o.Albedo = tex2D( _TestAlbedo, uv_TestAlbedo ).rgb;
         float3 worldViewDir = normalize( UnityWorldSpaceViewDir( i.worldPos ) );
         float3 ase_worldNormal = WorldNormalVector( i, float3( 0, 0, 1 ) );
         float fresnelFinalVal6 = (0.0 + 1.0*pow( 1.0 - dot( ase_worldNormal, worldViewDir ) , 5.0));
         o.Emission = ( fresnelFinalVal6 * float4(0.3676471,0.7383366,1,1) ).rgb;
         o.Alpha = 1;
      }

      ENDCG
      CGPROGRAM
      #pragma surface surf Standard keepalpha fullforwardshadows

      ENDCG
      Pass
      {
         Name "ShadowCaster"
         Tags{ "LightMode" = "ShadowCaster" }
         ZWrite On
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #pragma target 3.0
         #pragma multi_compile_shadowcaster
         #pragma multi_compile UNITY_PASS_SHADOWCASTER
         #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
         # include "HLSLSupport.cginc"
         #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
            #define CAN_SKIP_VPOS
         #endif
         #include "UnityCG.cginc"
         #include "Lighting.cginc"
         #include "UnityPBSLighting.cginc"
         sampler3D _DitherMaskLOD;
         struct v2f
         {
            V2F_SHADOW_CASTER;
            float3 worldPos : TEXCOORD6;
            float4 tSpace0 : TEXCOORD1;
            float4 tSpace1 : TEXCOORD2;
            float4 tSpace2 : TEXCOORD3;
            float4 texcoords01 : TEXCOORD4;
            UNITY_VERTEX_INPUT_INSTANCE_ID
         };
         v2f vert( appdata_full v )
         {
            v2f o;
            UNITY_SETUP_INSTANCE_ID( v );
            UNITY_INITIALIZE_OUTPUT( v2f, o );
            UNITY_TRANSFER_INSTANCE_ID( v, o );
            float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
            half3 worldNormal = UnityObjectToWorldNormal( v.normal );
            fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
            fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
            fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
            o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
            o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
            o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
            o.texcoords01 = float4( v.texcoord.xy, v.texcoord1.xy );
            o.worldPos = worldPos;
            TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
            return o;
         }
         fixed4 frag( v2f IN
         #if !defined( CAN_SKIP_VPOS )
         , UNITY_VPOS_TYPE vpos : VPOS
         #endif
         ) : SV_Target
         {
            UNITY_SETUP_INSTANCE_ID( IN );
            Input surfIN;
            UNITY_INITIALIZE_OUTPUT( Input, surfIN );
            surfIN.uv_texcoord = IN.texcoords01.xy;
            float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
            fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
            surfIN.worldPos = worldPos;
            surfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );
            surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
            surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
            surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
            SurfaceOutputStandard o;
            UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
            surf( surfIN, o );
            #if defined( CAN_SKIP_VPOS )
            float2 vpos = IN.pos;
            #endif
            SHADOW_CASTER_FRAGMENT( IN )
         }
         ENDCG
      }
   }
   Fallback "Diffuse"
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=10001
2276;502;1398;705;1655.803;407.2994;2;True;True
Node;AmplifyShaderEditor.FresnelNode;6;-641.8027,302.7006;Float;False;4;0;FLOAT3;0,0,0;False;1;FLOAT;0.0;False;2;FLOAT;1.0;False;3;FLOAT;5.0;False;1;FLOAT
Node;AmplifyShaderEditor.ColorNode;7;-659.8027,488.7006;Float;False;Constant;_Color0;Color 0;2;0;0.3676471,0.7383366,1,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;2;-655.3997,20.20074;Float;True;Property;_TestNormal;TestNormal;1;0;None;True;0;False;white;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;1;-643.7001,-226.7993;Float;True;Property;_TestAlbedo;TestAlbedo;0;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;0.0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-373.8027,376.7006;Float;False;2;0;FLOAT;0.0;False;1;COLOR;0.0;False;1;COLOR
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;0,0;Float;False;True;4;Float;ASEMaterialInspector;0;Standard;ASE_Test_Normal;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;0;False;0;0;Opaque;0.5;True;True;0;False;Opaque;Geometry;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;True;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;Relative;0;;-1;-1;-1;-1;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;13;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;8;0;6;0
WireConnection;8;1;7;0
WireConnection;0;0;1;0
WireConnection;0;1;2;0
WireConnection;0;2;8;0
ASEEND*/
//CHKSM=D805466B24C7DAC049C51070D49BB6F58B2117C8


Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "ASE_Test_Zero"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _TestAlbedo("TestAlbedo", 2D) = "white" {}
      _TestNormal("TestNormal", 2D) = "white" {}
      [HideInInspector] _texcoord( "", 2D ) = "white" {}
   }

   SubShader
   {
      Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" "IsEmissive" = "true"  }
      Cull Back
      CGINCLUDE
      #include "UnityStandardUtils.cginc"
      #include "UnityPBSLighting.cginc"
      #include "Lighting.cginc"
      #pragma target 4.0
      #ifdef UNITY_PASS_SHADOWCASTER
         #undef INTERNAL_DATA
         #undef WorldReflectionVector
         #undef WorldNormalVector
         #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
         #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
         #define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
      #endif
      struct Input
      {
         float2 uv_texcoord;
         float3 worldPos;
         float3 worldNormal;
         INTERNAL_DATA
      };

      uniform sampler2D _TestNormal;
      uniform float4 _TestNormal_ST;
      uniform sampler2D _TestAlbedo;
      uniform float4 _TestAlbedo_ST;

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float2 uv_TestNormal = i.uv_texcoord * _TestNormal_ST.xy + _TestNormal_ST.zw;
         o.Normal = UnpackScaleNormal( tex2D( _TestNormal, uv_TestNormal ) ,0.0 );
         float2 uv_TestAlbedo = i.uv_texcoord * _TestAlbedo_ST.xy + _TestAlbedo_ST.zw;
         o.Albedo = tex2D( _TestAlbedo, uv_TestAlbedo ).rgb;
         float3 worldViewDir = normalize( UnityWorldSpaceViewDir( i.worldPos ) );
         float3 ase_worldNormal = WorldNormalVector( i, float3( 0, 0, 1 ) );
         float fresnelFinalVal6 = (0.0 + 0.0*pow( 1.0 - dot( ase_worldNormal, worldViewDir ) , 0.0));
         o.Emission = ( fresnelFinalVal6 * float4(0.3676471,0.7383366,1,1) ).rgb;
         o.Alpha = 1;
      }

      ENDCG
      CGPROGRAM
      #pragma surface surf Standard keepalpha fullforwardshadows

      ENDCG
      Pass
      {
         Name "ShadowCaster"
         Tags{ "LightMode" = "ShadowCaster" }
         ZWrite On
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #pragma target 3.0
         #pragma multi_compile_shadowcaster
         #pragma multi_compile UNITY_PASS_SHADOWCASTER
         #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
         # include "HLSLSupport.cginc"
         #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
            #define CAN_SKIP_VPOS
         #endif
         #include "UnityCG.cginc"
         #include "Lighting.cginc"
         #include "UnityPBSLighting.cginc"
         sampler3D _DitherMaskLOD;
         struct v2f
         {
            V2F_SHADOW_CASTER;
            float3 worldPos : TEXCOORD6;
            float4 tSpace0 : TEXCOORD1;
            float4 tSpace1 : TEXCOORD2;
            float4 tSpace2 : TEXCOORD3;
            float4 texcoords01 : TEXCOORD4;
            UNITY_VERTEX_INPUT_INSTANCE_ID
         };
         v2f vert( appdata_full v )
         {
            v2f o;
            UNITY_SETUP_INSTANCE_ID( v );
            UNITY_INITIALIZE_OUTPUT( v2f, o );
            UNITY_TRANSFER_INSTANCE_ID( v, o );
            float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
            half3 worldNormal = UnityObjectToWorldNormal( v.normal );
            fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
            fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
            fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
            o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
            o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
            o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
            o.texcoords01 = float4( v.texcoord.xy, v.texcoord1.xy );
            o.worldPos = worldPos;
            TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
            return o;
         }
         fixed4 frag( v2f IN
         #if !defined( CAN_SKIP_VPOS )
         , UNITY_VPOS_TYPE vpos : VPOS
         #endif
         ) : SV_Target
         {
            UNITY_SETUP_INSTANCE_ID( IN );
            Input surfIN;
            UNITY_INITIALIZE_OUTPUT( Input, surfIN );
            surfIN.uv_texcoord = IN.texcoords01.xy;
            float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
            fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
            surfIN.worldPos = worldPos;
            surfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );
            surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
            surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
            surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
            SurfaceOutputStandard o;
            UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
            surf( surfIN, o );
            #if defined( CAN_SKIP_VPOS )
            float2 vpos = IN.pos;
            #endif
            SHADOW_CASTER_FRAGMENT( IN )
         }
         ENDCG
      }
   }
   Fallback "Diffuse"
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=10001
2276;502;1398;705;1693.803;407.2994;2;True;True
Node;AmplifyShaderEditor.FresnelNode;6;-641.8027,302.7006;Float;False;4;0;FLOAT3;0,0,0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT
Node;AmplifyShaderEditor.ColorNode;7;-659.8027,488.7006;Float;False;Constant;_Color0;Color 0;2;0;0.3676471,0.7383366,1,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-373.8027,376.7006;Float;False;2;0;FLOAT;0.0;False;1;COLOR;0.0;False;1;COLOR
Node;AmplifyShaderEditor.SamplerNode;2;-655.3997,20.20074;Float;True;Property;_TestNormal;TestNormal;1;0;None;True;0;False;white;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;0.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;1;-643.7001,-226.7993;Float;True;Property;_TestAlbedo;TestAlbedo;0;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;0.0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;0,0;Float;False;True;4;Float;ASEMaterialInspector;0;Standard;ASE_Test_Zero;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;0;False;0;0;Opaque;0.5;True;True;0;False;Opaque;Geometry;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;True;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;Relative;0;;-1;-1;-1;-1;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;13;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;8;0;6;0
WireConnection;8;1;7;0
WireConnection;0;0;1;0
WireConnection;0;1;2;0
WireConnection;0;2;8;0
ASEEND*/
//CHKSM=A0760C49CD3F936F05F2543C688EC5209D34F8C7
aislynnk
 
Posts: 4
Joined: Fri Aug 11, 2017 9:46 pm

Re: Values Stored In Nodes Zeroing Out

Postby Ricardo Teixeira » Tue Aug 15, 2017 7:58 pm

aislynnk wrote:So I got it to happen on a simple shader with an emmissive fresnel. It has happened without the fresnel error before, but this was just the most consistent way to replicate it. Also, after fixing the fresnel error, I'm still not able to turn the scale in the normal's texture sampler back to 1 without adding a float 1.

Repro Steps:
1. Normal shader ("ASE_Test_Normal") is created and looks as expected in scene mode.
2. Close shader editor.
3. Press play in Unity.
4. Exit play mode.
5. Open shader in shader editor again.
6. Save the shader and you get "ASE_Test_Zero".

Let me know if y'all need anymore information!

Thank you!

Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "ASE_Test_Normal"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _TestAlbedo("TestAlbedo", 2D) = "white" {}
      _TestNormal("TestNormal", 2D) = "white" {}
      [HideInInspector] _texcoord( "", 2D ) = "white" {}
   }

   SubShader
   {
      Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" "IsEmissive" = "true"  }
      Cull Back
      CGINCLUDE
      #include "UnityPBSLighting.cginc"
      #include "Lighting.cginc"
      #pragma target 4.0
      #ifdef UNITY_PASS_SHADOWCASTER
         #undef INTERNAL_DATA
         #undef WorldReflectionVector
         #undef WorldNormalVector
         #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
         #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
         #define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
      #endif
      struct Input
      {
         float2 uv_texcoord;
         float3 worldPos;
         float3 worldNormal;
         INTERNAL_DATA
      };

      uniform sampler2D _TestNormal;
      uniform float4 _TestNormal_ST;
      uniform sampler2D _TestAlbedo;
      uniform float4 _TestAlbedo_ST;

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float2 uv_TestNormal = i.uv_texcoord * _TestNormal_ST.xy + _TestNormal_ST.zw;
         o.Normal = UnpackNormal( tex2D( _TestNormal, uv_TestNormal ) );
         float2 uv_TestAlbedo = i.uv_texcoord * _TestAlbedo_ST.xy + _TestAlbedo_ST.zw;
         o.Albedo = tex2D( _TestAlbedo, uv_TestAlbedo ).rgb;
         float3 worldViewDir = normalize( UnityWorldSpaceViewDir( i.worldPos ) );
         float3 ase_worldNormal = WorldNormalVector( i, float3( 0, 0, 1 ) );
         float fresnelFinalVal6 = (0.0 + 1.0*pow( 1.0 - dot( ase_worldNormal, worldViewDir ) , 5.0));
         o.Emission = ( fresnelFinalVal6 * float4(0.3676471,0.7383366,1,1) ).rgb;
         o.Alpha = 1;
      }

      ENDCG
      CGPROGRAM
      #pragma surface surf Standard keepalpha fullforwardshadows

      ENDCG
      Pass
      {
         Name "ShadowCaster"
         Tags{ "LightMode" = "ShadowCaster" }
         ZWrite On
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #pragma target 3.0
         #pragma multi_compile_shadowcaster
         #pragma multi_compile UNITY_PASS_SHADOWCASTER
         #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
         # include "HLSLSupport.cginc"
         #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
            #define CAN_SKIP_VPOS
         #endif
         #include "UnityCG.cginc"
         #include "Lighting.cginc"
         #include "UnityPBSLighting.cginc"
         sampler3D _DitherMaskLOD;
         struct v2f
         {
            V2F_SHADOW_CASTER;
            float3 worldPos : TEXCOORD6;
            float4 tSpace0 : TEXCOORD1;
            float4 tSpace1 : TEXCOORD2;
            float4 tSpace2 : TEXCOORD3;
            float4 texcoords01 : TEXCOORD4;
            UNITY_VERTEX_INPUT_INSTANCE_ID
         };
         v2f vert( appdata_full v )
         {
            v2f o;
            UNITY_SETUP_INSTANCE_ID( v );
            UNITY_INITIALIZE_OUTPUT( v2f, o );
            UNITY_TRANSFER_INSTANCE_ID( v, o );
            float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
            half3 worldNormal = UnityObjectToWorldNormal( v.normal );
            fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
            fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
            fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
            o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
            o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
            o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
            o.texcoords01 = float4( v.texcoord.xy, v.texcoord1.xy );
            o.worldPos = worldPos;
            TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
            return o;
         }
         fixed4 frag( v2f IN
         #if !defined( CAN_SKIP_VPOS )
         , UNITY_VPOS_TYPE vpos : VPOS
         #endif
         ) : SV_Target
         {
            UNITY_SETUP_INSTANCE_ID( IN );
            Input surfIN;
            UNITY_INITIALIZE_OUTPUT( Input, surfIN );
            surfIN.uv_texcoord = IN.texcoords01.xy;
            float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
            fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
            surfIN.worldPos = worldPos;
            surfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );
            surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
            surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
            surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
            SurfaceOutputStandard o;
            UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
            surf( surfIN, o );
            #if defined( CAN_SKIP_VPOS )
            float2 vpos = IN.pos;
            #endif
            SHADOW_CASTER_FRAGMENT( IN )
         }
         ENDCG
      }
   }
   Fallback "Diffuse"
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=10001
2276;502;1398;705;1655.803;407.2994;2;True;True
Node;AmplifyShaderEditor.FresnelNode;6;-641.8027,302.7006;Float;False;4;0;FLOAT3;0,0,0;False;1;FLOAT;0.0;False;2;FLOAT;1.0;False;3;FLOAT;5.0;False;1;FLOAT
Node;AmplifyShaderEditor.ColorNode;7;-659.8027,488.7006;Float;False;Constant;_Color0;Color 0;2;0;0.3676471,0.7383366,1,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;2;-655.3997,20.20074;Float;True;Property;_TestNormal;TestNormal;1;0;None;True;0;False;white;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;1;-643.7001,-226.7993;Float;True;Property;_TestAlbedo;TestAlbedo;0;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;0.0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-373.8027,376.7006;Float;False;2;0;FLOAT;0.0;False;1;COLOR;0.0;False;1;COLOR
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;0,0;Float;False;True;4;Float;ASEMaterialInspector;0;Standard;ASE_Test_Normal;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;0;False;0;0;Opaque;0.5;True;True;0;False;Opaque;Geometry;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;True;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;Relative;0;;-1;-1;-1;-1;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;13;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;8;0;6;0
WireConnection;8;1;7;0
WireConnection;0;0;1;0
WireConnection;0;1;2;0
WireConnection;0;2;8;0
ASEEND*/
//CHKSM=D805466B24C7DAC049C51070D49BB6F58B2117C8


Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "ASE_Test_Zero"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _TestAlbedo("TestAlbedo", 2D) = "white" {}
      _TestNormal("TestNormal", 2D) = "white" {}
      [HideInInspector] _texcoord( "", 2D ) = "white" {}
   }

   SubShader
   {
      Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" "IsEmissive" = "true"  }
      Cull Back
      CGINCLUDE
      #include "UnityStandardUtils.cginc"
      #include "UnityPBSLighting.cginc"
      #include "Lighting.cginc"
      #pragma target 4.0
      #ifdef UNITY_PASS_SHADOWCASTER
         #undef INTERNAL_DATA
         #undef WorldReflectionVector
         #undef WorldNormalVector
         #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
         #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
         #define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
      #endif
      struct Input
      {
         float2 uv_texcoord;
         float3 worldPos;
         float3 worldNormal;
         INTERNAL_DATA
      };

      uniform sampler2D _TestNormal;
      uniform float4 _TestNormal_ST;
      uniform sampler2D _TestAlbedo;
      uniform float4 _TestAlbedo_ST;

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float2 uv_TestNormal = i.uv_texcoord * _TestNormal_ST.xy + _TestNormal_ST.zw;
         o.Normal = UnpackScaleNormal( tex2D( _TestNormal, uv_TestNormal ) ,0.0 );
         float2 uv_TestAlbedo = i.uv_texcoord * _TestAlbedo_ST.xy + _TestAlbedo_ST.zw;
         o.Albedo = tex2D( _TestAlbedo, uv_TestAlbedo ).rgb;
         float3 worldViewDir = normalize( UnityWorldSpaceViewDir( i.worldPos ) );
         float3 ase_worldNormal = WorldNormalVector( i, float3( 0, 0, 1 ) );
         float fresnelFinalVal6 = (0.0 + 0.0*pow( 1.0 - dot( ase_worldNormal, worldViewDir ) , 0.0));
         o.Emission = ( fresnelFinalVal6 * float4(0.3676471,0.7383366,1,1) ).rgb;
         o.Alpha = 1;
      }

      ENDCG
      CGPROGRAM
      #pragma surface surf Standard keepalpha fullforwardshadows

      ENDCG
      Pass
      {
         Name "ShadowCaster"
         Tags{ "LightMode" = "ShadowCaster" }
         ZWrite On
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #pragma target 3.0
         #pragma multi_compile_shadowcaster
         #pragma multi_compile UNITY_PASS_SHADOWCASTER
         #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
         # include "HLSLSupport.cginc"
         #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
            #define CAN_SKIP_VPOS
         #endif
         #include "UnityCG.cginc"
         #include "Lighting.cginc"
         #include "UnityPBSLighting.cginc"
         sampler3D _DitherMaskLOD;
         struct v2f
         {
            V2F_SHADOW_CASTER;
            float3 worldPos : TEXCOORD6;
            float4 tSpace0 : TEXCOORD1;
            float4 tSpace1 : TEXCOORD2;
            float4 tSpace2 : TEXCOORD3;
            float4 texcoords01 : TEXCOORD4;
            UNITY_VERTEX_INPUT_INSTANCE_ID
         };
         v2f vert( appdata_full v )
         {
            v2f o;
            UNITY_SETUP_INSTANCE_ID( v );
            UNITY_INITIALIZE_OUTPUT( v2f, o );
            UNITY_TRANSFER_INSTANCE_ID( v, o );
            float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
            half3 worldNormal = UnityObjectToWorldNormal( v.normal );
            fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
            fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
            fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
            o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
            o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
            o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
            o.texcoords01 = float4( v.texcoord.xy, v.texcoord1.xy );
            o.worldPos = worldPos;
            TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
            return o;
         }
         fixed4 frag( v2f IN
         #if !defined( CAN_SKIP_VPOS )
         , UNITY_VPOS_TYPE vpos : VPOS
         #endif
         ) : SV_Target
         {
            UNITY_SETUP_INSTANCE_ID( IN );
            Input surfIN;
            UNITY_INITIALIZE_OUTPUT( Input, surfIN );
            surfIN.uv_texcoord = IN.texcoords01.xy;
            float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
            fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
            surfIN.worldPos = worldPos;
            surfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );
            surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
            surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
            surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
            SurfaceOutputStandard o;
            UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
            surf( surfIN, o );
            #if defined( CAN_SKIP_VPOS )
            float2 vpos = IN.pos;
            #endif
            SHADOW_CASTER_FRAGMENT( IN )
         }
         ENDCG
      }
   }
   Fallback "Diffuse"
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=10001
2276;502;1398;705;1693.803;407.2994;2;True;True
Node;AmplifyShaderEditor.FresnelNode;6;-641.8027,302.7006;Float;False;4;0;FLOAT3;0,0,0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT
Node;AmplifyShaderEditor.ColorNode;7;-659.8027,488.7006;Float;False;Constant;_Color0;Color 0;2;0;0.3676471,0.7383366,1,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-373.8027,376.7006;Float;False;2;0;FLOAT;0.0;False;1;COLOR;0.0;False;1;COLOR
Node;AmplifyShaderEditor.SamplerNode;2;-655.3997,20.20074;Float;True;Property;_TestNormal;TestNormal;1;0;None;True;0;False;white;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;0.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;1;-643.7001,-226.7993;Float;True;Property;_TestAlbedo;TestAlbedo;0;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;0.0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;0,0;Float;False;True;4;Float;ASEMaterialInspector;0;Standard;ASE_Test_Zero;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;0;False;0;0;Opaque;0.5;True;True;0;False;Opaque;Geometry;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;True;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;Relative;0;;-1;-1;-1;-1;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;13;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;8;0;6;0
WireConnection;8;1;7;0
WireConnection;0;0;1;0
WireConnection;0;1;2;0
WireConnection;0;2;8;0
ASEEND*/
//CHKSM=A0760C49CD3F936F05F2543C688EC5209D34F8C7


Hello,

Thank you for the additional information, we will run a few tests on our side tomorrow morning.

What's your current ASE version?

Apologies for the inconvenience, hopefully it's something that we can quickly correct.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Values Stored In Nodes Zeroing Out

Postby aislynnk » Tue Aug 15, 2017 9:17 pm

Hello,

Thank you for the additional information, we will run a few tests on our side tomorrow morning.

What's your current ASE version?

Apologies for the inconvenience, hopefully it's something that we can quickly correct.

Thanks!


My ASE version is 1.0.0_dev01
aislynnk
 
Posts: 4
Joined: Fri Aug 11, 2017 9:46 pm

Re: Values Stored In Nodes Zeroing Out

Postby Ricardo Teixeira » Tue Aug 15, 2017 9:49 pm

aislynnk wrote:
Hello,

Thank you for the additional information, we will run a few tests on our side tomorrow morning.

What's your current ASE version?

Apologies for the inconvenience, hopefully it's something that we can quickly correct.

Thanks!


My ASE version is 1.0.0_dev01


Hello,

Thank you for the additional information. You are likely experiencing a problem that has been correct in the latest version, please update your installation and save/compile your shaders.

Product Downloads - http://amplify.pt/download/

Be sure to let us know if it corrects the issue.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Values Stored In Nodes Zeroing Out

Postby Amplify_Borba » Wed Aug 16, 2017 1:13 pm

Hello!

I've just tested your shader on the latest ASE version and wasn't able to replicate your issue.

Please do let us know if updating ASE solved your issue, otherwise we'd appreciate if you could send us a sample in order for us to debug the problem.

Looking forward to your reply!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Values Stored In Nodes Zeroing Out

Postby aislynnk » Wed Aug 16, 2017 6:30 pm

Sorry for the late reply!

The update seems to have fixed it! Thank you!
aislynnk
 
Posts: 4
Joined: Fri Aug 11, 2017 9:46 pm

Re: Values Stored In Nodes Zeroing Out

Postby Ricardo Teixeira » Wed Aug 16, 2017 9:06 pm

aislynnk wrote:Sorry for the late reply!

The update seems to have fixed it! Thank you!


Awesome, happy to hear it. Be sure to let us know if you run into any additional issues.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 84 guests