Amplifying your potential.

[BUG] Compare (A > B) in/out ports change values types

Your feedback is very important to us. We are listening.
5 posts • Page 1 of 1

[BUG] Compare (A > B) in/out ports change values types

Postby lassade » Tue Apr 11, 2017 4:28 pm

Hi, I'm getting a strange bug when using the Compare (A > B) node. When the "True" and "False" ports are pluged with two colors, both "A" and "B" input ports change their types to Color (in my oppinion these shuld be unchanged), but if I want to compare two Floats, plug "A" or "B" with a Float node is enough to change its value back to Float (both A and B). The problem starts if I go back to edit my shader a second time the shader editor will swap the A and B ports back to Color type (since A is pluged with a const float the generated color will cast this value to float4).


Frist time I plug all the values:

Image

generated code:

Code: Select all
float3 temp_cast_0 = ( temp_output_48_0 +  ( ( temp_output_34_0 > 0.5 ) ? _TargetFaceColor :  _CurrentFaceColor )  );


Closing, reopening the shader editor and then selecting the compare node will change its B value to a color type (float4):

Image

thus changing the generated code to this:

Code: Select all
float4 temp_cast_0 = temp_output_48_0;
o.Albedo = ( temp_cast_0 +  ( ( temp_output_34_0 > float4( 0.5,0,0,0 ) ) ? _CurrentFaceColor :  _TargetFaceColor )  ).rgb;


The strange bit is this code generate artifacts in final result, the yellow bar in between the red and green colors should not be there.

I find also other inconsistencies, that made this same node output a single channel color (black and white) with both red and green colors pluged in the True and False ports.


Edit:

Why my wires aren't color coded?

This is my shader

Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "MyNamespace/Transition"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _CurrentFaceColor("CurrentFaceColor", Color) = (1,0,0,1)
      _TargetFaceColor("TargetFaceColor", Color) = (0,1,0,1)
      _Transition("Transition", Range( 0 , 1)) = 0.5
      _BlendingFactor("BlendingFactor", Range( 0.001 , 1)) = 0.05
   }

   SubShader
   {
      Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" }
      Cull Back
      CGPROGRAM
      #pragma target 3.0
      #pragma surface surf Standard keepalpha addshadow fullforwardshadows vertex:vertexDataFunc
      struct Input
      {
         float2 texcoord_0;
      };

      uniform float _Transition;
      uniform float _BlendingFactor;
      uniform float4 _TargetFaceColor;
      uniform float4 _CurrentFaceColor;

      void vertexDataFunc( inout appdata_full v, out Input o )
      {
         UNITY_INITIALIZE_OUTPUT( Input, o );
         o.texcoord_0.xy = v.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
      }

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float temp_output_39_0 = ( _Transition * ( _BlendingFactor + 1.0 ) );
         float temp_output_24_0 = ( temp_output_39_0 - _BlendingFactor );
         float temp_output_34_0 = ( ( clamp( abs( lerp( -1.0 , 1.0 , i.texcoord_0.y ) ) , temp_output_24_0 , temp_output_39_0 ) - temp_output_24_0 ) / _BlendingFactor );
         o.Albedo =  ( ( temp_output_34_0 > float4( 0.5,0,0,0 ) ) ? _TargetFaceColor :  _CurrentFaceColor ) .rgb;
         o.Alpha = 1;
      }

      ENDCG
   }
   Fallback "Diffuse"
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=6001
142;203;1276;772;1140.299;170.1858;1;True;False
Node;AmplifyShaderEditor.RangedFloatNode;25;-2248.888,407.6957;Float;False;Property;_BlendingFactor;BlendingFactor;2;0;0.05;0.001;1;FLOAT
Node;AmplifyShaderEditor.SimpleAddOpNode;40;-1968.29,305.6659;Float;False;0;FLOAT;0.0;False;1;FLOAT;1.0;False;FLOAT
Node;AmplifyShaderEditor.TextureCoordinatesNode;5;-2155.088,-93.7033;Float;False;0;-1;2;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.RangedFloatNode;3;-2259.71,133.5999;Float;False;Property;_Transition;Transition;2;0;0.5;0;1;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;39;-1851.886,143.6646;Float;False;0;FLOAT;0.0;False;1;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.LerpOp;9;-1902.485,-94.60487;Float;False;0;FLOAT;-1.0;False;1;FLOAT;1.0;False;2;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.AbsOpNode;10;-1734.485,-94.90546;Float;True;0;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.SimpleSubtractOpNode;24;-1706.579,240.5968;Float;False;0;FLOAT;0.0;False;1;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.ClampOpNode;21;-1529.379,95.29521;Float;False;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.SimpleSubtractOpNode;32;-1320.996,96.06426;Float;False;0;FLOAT;0.0;False;1;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.SimpleDivideOpNode;34;-1086.495,380.9645;Float;True;0;FLOAT;0.0;False;1;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.ColorNode;1;-798.2981,-67.89948;Float;False;Property;_CurrentFaceColor;CurrentFaceColor;0;0;1,0,0,1;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.ColorNode;2;-795.5972,98.29967;Float;False;Property;_TargetFaceColor;TargetFaceColor;1;0;0,1,0,1;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.AbsOpNode;42;-683.2822,503.7646;Float;False;0;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.SimpleAddOpNode;43;-559.0831,504.0647;Float;False;0;FLOAT;0.0;False;1;FLOAT;0.0;False;FLOAT
Node;AmplifyShaderEditor.SimpleSubtractOpNode;41;-839.9818,506.5649;Float;False;0;FLOAT;0.5;False;1;FLOAT;0.5;False;FLOAT
Node;AmplifyShaderEditor.LerpOp;51;-515.2081,140.9646;Float;False;0;COLOR;0.0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0.0;False;COLOR
Node;AmplifyShaderEditor.SimpleAddOpNode;49;-189.4057,501.165;Float;False;0;FLOAT;0.0;False;1;FLOAT;0.01;False;FLOAT
Node;AmplifyShaderEditor.SimpleSubtractOpNode;48;-441.0061,502.2653;Float;True;0;FLOAT;1.0;False;1;FLOAT;1.0;False;FLOAT
Node;AmplifyShaderEditor.SimpleAddOpNode;47;-252.306,162.5649;Float;False;0;FLOAT;0.0;False;1;FLOAT;0;False;FLOAT
Node;AmplifyShaderEditor.TFHCCompareGreater;58;-473.299,-110.1858;Float;False;0;FLOAT;0,0,0,0;False;1;COLOR;0.5,0,0,0;False;2;COLOR;0.0;False;3;COLOR;0.0;False;COLOR
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;22.40005,161.8;Float;False;True;2;Float;ASEMaterialInspector;Standard;MyNamespace/Transition;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;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;OBJECT;0.0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False
WireConnection;40;0;25;0
WireConnection;39;0;3;0
WireConnection;39;1;40;0
WireConnection;9;2;5;2
WireConnection;10;0;9;0
WireConnection;24;0;39;0
WireConnection;24;1;25;0
WireConnection;21;0;10;0
WireConnection;21;1;24;0
WireConnection;21;2;39;0
WireConnection;32;0;21;0
WireConnection;32;1;24;0
WireConnection;34;0;32;0
WireConnection;34;1;25;0
WireConnection;42;0;41;0
WireConnection;43;0;42;0
WireConnection;43;1;42;0
WireConnection;41;1;34;0
WireConnection;51;0;2;0
WireConnection;51;1;1;0
WireConnection;51;2;34;0
WireConnection;49;0;48;0
WireConnection;48;1;43;0
WireConnection;47;0;48;0
WireConnection;58;0;34;0
WireConnection;58;2;2;0
WireConnection;58;3;1;0
WireConnection;0;0;58;0
ASEEND*/
//CHKSM=D73986BA0D58769C53B1235CDDBC87C2DCCF06B9
lassade
 
Posts: 2
Joined: Tue Apr 11, 2017 4:13 pm

Re: [BUG] Compare (A > B) in/out ports change values types

Postby Ricardo Teixeira » Tue Apr 11, 2017 4:39 pm

Hello,

Thank you for reporting the problem, we really appreciate it. The Compare (A > B) node was created by the community, we will have to run a few tests on our side. What's your current Unity and ASE version?

Why my wires aren't color coded?


Does pressing [ W ] not toggle the debug mode?

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: 599
Joined: Fri Aug 09, 2013 2:26 pm

Re: [BUG] Compare (A > B) in/out ports change values types

Postby lassade » Tue Apr 11, 2017 9:41 pm

I'm using
Unity 5.5.1f1 (personal)
ASE v0.6.0 dev 01

Does pressing [ W ] not toggle the debug mode?


Yes but I have to hold [ W ] down to keep the debug active. Clicking in other window, while holding [ W ] make the toggle permanent.



The problem is some what related to DynamicTypeNode class, more precisely with its method UpdateConnection and probably UpdateDisconnectedConnection, both only works properly if the node have exact only two inputs. Having more than two input lets say 4 (in this case) makes the call UpdateConnection(3) match ports 3 and 0 types.

Every time the shader is reloaded by the editor the UpdateConnection method is called for each input port so:

0 and 1 will have the same type,
then 1, 0
then 2, 1
then 3 and 0

This was what was changing the "A" and "B" ports types to match the "False" and "True" ports respectively.

My solution will be not excute UpdateConnection and UpdateDisconnectedConnection if portId > 1.

This makes any sense for you?
lassade
 
Posts: 2
Joined: Tue Apr 11, 2017 4:13 pm

Re: [BUG] Compare (A > B) in/out ports change values types

Postby Ricardo Teixeira » Wed Apr 12, 2017 11:39 am

lassade wrote:I'm using
Unity 5.5.1f1 (personal)
ASE v0.6.0 dev 01

Does pressing [ W ] not toggle the debug mode?


Yes but I have to hold [ W ] down to keep the debug active. Clicking in other window, while holding [ W ] make the toggle permanent.


The problem is some what related to DynamicTypeNode class, more precisely with its method UpdateConnection and probably UpdateDisconnectedConnection, both only works properly if the node have exact only two inputs. Having more than two input lets say 4 (in this case) makes the call UpdateConnection(3) match ports 3 and 0 types.

Every time the shader is reloaded by the editor the UpdateConnection method is called for each input port so:

0 and 1 will have the same type,
then 1, 0
then 2, 1
then 3 and 0

This was what was changing the "A" and "B" ports types to match the "False" and "True" ports respectively.

My solution will be not excute UpdateConnection and UpdateDisconnectedConnection if portId > 1.

This makes any sense for you?


Hello,

Apologies for the delay, we are currently a bit overloaded. The ASE developer will get back to you as soon as possible.

Regarding the Debug mode, you can hold W to view or double press W to enable it. It's a bit counterintuitive at the moment, we are going to change it soon to simply toggle ON/OFF when you press W.

You can find additional hotkey information in the helper window.

Image

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: 599
Joined: Fri Aug 09, 2013 2:26 pm

Re: [BUG] Compare (A > B) in/out ports change values types

Postby Ricardo Teixeira » Mon Apr 17, 2017 6:40 pm

Hello,

We corrected the reported problem, be sure to pick up the latest version directly from our website using your Unity Asset Store invoice number.

Amplify Products - Download

Looking forward to your feedback.
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: 599
Joined: Fri Aug 09, 2013 2:26 pm


5 posts • Page 1 of 1

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron