Billboard rendering too shiny

Node-based Shader Editor

Billboard rendering too shiny

Postby Duckocide » Sun Jul 30, 2017 8:20 am

I've been working on a simple shader that uses transparency (blend mode) and the spherical billboard rendering options. I've noticed that as soon as you select billboard metallic and smoothness textures or colours are ignored (basically things appear to go metallic / shiny).

Is this a bug? Real shame as I need my billboards to a be non reflective and have found this editor excellent for pulling together surface shaders.
Duckocide
 
Posts: 5
Joined: Sun Jul 30, 2017 8:04 am

Re: Billboard rendering too shiny

Postby Ricardo Teixeira » Sun Jul 30, 2017 1:27 pm

Duckocide wrote:I've been working on a simple shader that uses transparency (blend mode) and the spherical billboard rendering options. I've noticed that as soon as you select billboard metallic and smoothness textures or colours are ignored (basically things appear to go metallic / shiny).

Is this a bug? Real shame as I need my billboards to a be non reflective and have found this editor excellent for pulling together surface shaders.


Hello,

Thank you for using ASE, we would be happy to help. What's your current Unity and ASE version? Can you please share a sample shader with the problem present? It would be extremely helpful if we could test it on our side.

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: Billboard rendering too shiny

Postby Duckocide » Sun Jul 30, 2017 3:14 pm

Unity 5.6.2f1
ASE 1.1.0

Shader Code Generated:

(I notice the smoothness colour is set to something other than zero (in the editor it's black). Could this be the issue?

Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Vindex/Cell-Billboard"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _Rotation("Rotation", Range( 0 , 1)) = 0
      _CellDiffuse("Cell Diffuse", 2D) = "white" {}
      _CellNormal("Cell Normal", 2D) = "bump" {}
      _BumpScale("Bump Scale", Range( 0 , 4)) = 0.1
      _Smoothness("Smoothness", Color) = (0.5147059,0.5222751,0.5222751,1)
      _Metallic("Metallic", Color) = (0,0,0,1)
   }

   SubShader
   {
      Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" }
      Cull Off
      CGPROGRAM
      #include "UnityStandardUtils.cginc"
      #pragma target 5.0
      #pragma surface surf Standard alpha:fade keepalpha vertex:vertexDataFunc
      struct Input
      {
         float2 texcoord_0;
      };

      uniform float _BumpScale;
      uniform sampler2D _CellNormal;
      uniform float _Rotation;
      uniform sampler2D _CellDiffuse;
      uniform float4 _Metallic;
      uniform float4 _Smoothness;

      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 );
         //Calculate new billboard vertex position and normal;
         float3 upCamVec = normalize ( UNITY_MATRIX_V._m10_m11_m12 );
         float3 forwardCamVec = -normalize ( UNITY_MATRIX_V._m20_m21_m22 );
         float3 rightCamVec = normalize( UNITY_MATRIX_V._m00_m01_m02 );
         float4x4 rotationCamMatrix = float4x4( rightCamVec, 0, upCamVec, 0, forwardCamVec, 0, 0, 0, 0, 1 );
         //This unfortunately must be made to take non-uniform scaling into account;
         //Transform to world coors, apply rotation and transform back to local;
         v.vertex = mul( v.vertex , unity_ObjectToWorld );
         v.vertex = mul( v.vertex , rotationCamMatrix );
         v.vertex = mul( v.vertex , unity_WorldToObject );
         v.normal = normalize( mul( v.normal, rotationCamMatrix ));
      }

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float cos4 = cos( ( _Rotation * UNITY_PI ) );
         float sin4 = sin( ( _Rotation * UNITY_PI ) );
         float2 rotator4 = mul(i.texcoord_0 - float2( 0.5,0.5 ), float2x2(cos4,-sin4,sin4,cos4)) + float2( 0.5,0.5 );
         o.Normal = UnpackScaleNormal( tex2D( _CellNormal, rotator4 ) ,_BumpScale );
         float4 tex2DNode2 = tex2D( _CellDiffuse, rotator4 );
         o.Albedo = tex2DNode2.xyz;
         o.Metallic = _Metallic.r;
         o.Smoothness = _Smoothness.r;
         o.Alpha = tex2DNode2.a;
      }

      ENDCG
   }
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=11001
0;776;1320;602;1399.298;615.5966;1.9;True;True
Node;AmplifyShaderEditor.RangedFloatNode;7;-913.8959,37.00258;Float;False;Property;_Rotation;Rotation;0;0;0;0;1;0;1;FLOAT
Node;AmplifyShaderEditor.PiNode;9;-830.0975,130.6025;Float;False;1;0;FLOAT;1.0;False;1;FLOAT
Node;AmplifyShaderEditor.TextureCoordinatesNode;5;-666.2977,-234.5978;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-544.2974,71.0025;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT
Node;AmplifyShaderEditor.Vector2Node;6;-659.8966,-92.19747;Float;False;Constant;_Vector0;Vector 0;3;0;0.5,0.5;0;3;FLOAT2;FLOAT;FLOAT
Node;AmplifyShaderEditor.RotatorNode;4;-303.4971,-263.1976;Float;False;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;1;FLOAT2
Node;AmplifyShaderEditor.RangedFloatNode;10;-559.8005,185.2023;Float;False;Property;_BumpScale;Bump Scale;3;0;0.1;0;4;0;1;FLOAT
Node;AmplifyShaderEditor.ColorNode;12;58.29966,22.40234;Float;False;Property;_Metallic;Metallic;5;0;0,0,0,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.ColorNode;11;71.79966,209.3024;Float;False;Property;_Smoothness;Smoothness;4;0;0.5147059,0.5222751,0.5222751,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;1;-27.19991,-173.7997;Float;True;Property;_CellNormal;Cell Normal;2;0;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1.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;2;-21.89576,-374.8994;Float;True;Property;_CellDiffuse;Cell Diffuse;1;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;524.3002,-172.4001;Float;False;True;7;Float;ASEMaterialInspector;0;Standard;Vindex/Cell-Billboard;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;Off;0;0;False;0;0;Transparent;0.5;True;False;0;False;Transparent;Transparent;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;True;Spherical;Relative;0;;-1;-1;-1;-1;0;15;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;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;8;0;7;0
WireConnection;8;1;9;0
WireConnection;4;0;5;0
WireConnection;4;1;6;0
WireConnection;4;2;8;0
WireConnection;1;1;4;0
WireConnection;1;5;10;0
WireConnection;2;1;4;0
WireConnection;0;0;2;0
WireConnection;0;1;1;0
WireConnection;0;3;12;0
WireConnection;0;4;11;0
WireConnection;0;9;2;4
ASEEND*/
//CHKSM=4E01C8F3F79E57C132AB657CC53F53497BBBB985
Duckocide
 
Posts: 5
Joined: Sun Jul 30, 2017 8:04 am

Re: Billboard rendering too shiny

Postby Ricardo Teixeira » Sun Jul 30, 2017 3:38 pm

Duckocide wrote:Unity 5.6.2f1
ASE 1.1.0

Shader Code Generated:

(I notice the smoothness colour is set to something other than zero (in the editor it's black). Could this be the issue?

Code: Select all
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Vindex/Cell-Billboard"
{
   Properties
   {
      [HideInInspector] __dirty( "", Int ) = 1
      _Rotation("Rotation", Range( 0 , 1)) = 0
      _CellDiffuse("Cell Diffuse", 2D) = "white" {}
      _CellNormal("Cell Normal", 2D) = "bump" {}
      _BumpScale("Bump Scale", Range( 0 , 4)) = 0.1
      _Smoothness("Smoothness", Color) = (0.5147059,0.5222751,0.5222751,1)
      _Metallic("Metallic", Color) = (0,0,0,1)
   }

   SubShader
   {
      Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" }
      Cull Off
      CGPROGRAM
      #include "UnityStandardUtils.cginc"
      #pragma target 5.0
      #pragma surface surf Standard alpha:fade keepalpha vertex:vertexDataFunc
      struct Input
      {
         float2 texcoord_0;
      };

      uniform float _BumpScale;
      uniform sampler2D _CellNormal;
      uniform float _Rotation;
      uniform sampler2D _CellDiffuse;
      uniform float4 _Metallic;
      uniform float4 _Smoothness;

      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 );
         //Calculate new billboard vertex position and normal;
         float3 upCamVec = normalize ( UNITY_MATRIX_V._m10_m11_m12 );
         float3 forwardCamVec = -normalize ( UNITY_MATRIX_V._m20_m21_m22 );
         float3 rightCamVec = normalize( UNITY_MATRIX_V._m00_m01_m02 );
         float4x4 rotationCamMatrix = float4x4( rightCamVec, 0, upCamVec, 0, forwardCamVec, 0, 0, 0, 0, 1 );
         //This unfortunately must be made to take non-uniform scaling into account;
         //Transform to world coors, apply rotation and transform back to local;
         v.vertex = mul( v.vertex , unity_ObjectToWorld );
         v.vertex = mul( v.vertex , rotationCamMatrix );
         v.vertex = mul( v.vertex , unity_WorldToObject );
         v.normal = normalize( mul( v.normal, rotationCamMatrix ));
      }

      void surf( Input i , inout SurfaceOutputStandard o )
      {
         float cos4 = cos( ( _Rotation * UNITY_PI ) );
         float sin4 = sin( ( _Rotation * UNITY_PI ) );
         float2 rotator4 = mul(i.texcoord_0 - float2( 0.5,0.5 ), float2x2(cos4,-sin4,sin4,cos4)) + float2( 0.5,0.5 );
         o.Normal = UnpackScaleNormal( tex2D( _CellNormal, rotator4 ) ,_BumpScale );
         float4 tex2DNode2 = tex2D( _CellDiffuse, rotator4 );
         o.Albedo = tex2DNode2.xyz;
         o.Metallic = _Metallic.r;
         o.Smoothness = _Smoothness.r;
         o.Alpha = tex2DNode2.a;
      }

      ENDCG
   }
   CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=11001
0;776;1320;602;1399.298;615.5966;1.9;True;True
Node;AmplifyShaderEditor.RangedFloatNode;7;-913.8959,37.00258;Float;False;Property;_Rotation;Rotation;0;0;0;0;1;0;1;FLOAT
Node;AmplifyShaderEditor.PiNode;9;-830.0975,130.6025;Float;False;1;0;FLOAT;1.0;False;1;FLOAT
Node;AmplifyShaderEditor.TextureCoordinatesNode;5;-666.2977,-234.5978;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-544.2974,71.0025;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT
Node;AmplifyShaderEditor.Vector2Node;6;-659.8966,-92.19747;Float;False;Constant;_Vector0;Vector 0;3;0;0.5,0.5;0;3;FLOAT2;FLOAT;FLOAT
Node;AmplifyShaderEditor.RotatorNode;4;-303.4971,-263.1976;Float;False;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;1;FLOAT2
Node;AmplifyShaderEditor.RangedFloatNode;10;-559.8005,185.2023;Float;False;Property;_BumpScale;Bump Scale;3;0;0.1;0;4;0;1;FLOAT
Node;AmplifyShaderEditor.ColorNode;12;58.29966,22.40234;Float;False;Property;_Metallic;Metallic;5;0;0,0,0,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.ColorNode;11;71.79966,209.3024;Float;False;Property;_Smoothness;Smoothness;4;0;0.5147059,0.5222751,0.5222751,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.SamplerNode;1;-27.19991,-173.7997;Float;True;Property;_CellNormal;Cell Normal;2;0;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1.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;2;-21.89576,-374.8994;Float;True;Property;_CellDiffuse;Cell Diffuse;1;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;524.3002,-172.4001;Float;False;True;7;Float;ASEMaterialInspector;0;Standard;Vindex/Cell-Billboard;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;Off;0;0;False;0;0;Transparent;0.5;True;False;0;False;Transparent;Transparent;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;True;Spherical;Relative;0;;-1;-1;-1;-1;0;15;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;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;8;0;7;0
WireConnection;8;1;9;0
WireConnection;4;0;5;0
WireConnection;4;1;6;0
WireConnection;4;2;8;0
WireConnection;1;1;4;0
WireConnection;1;5;10;0
WireConnection;2;1;4;0
WireConnection;0;0;2;0
WireConnection;0;1;1;0
WireConnection;0;3;12;0
WireConnection;0;4;11;0
WireConnection;0;9;2;4
ASEEND*/
//CHKSM=4E01C8F3F79E57C132AB657CC53F53497BBBB985


Thank you for sharing the shader. Can you also share the textures used and a screenshot of the problem? I will pass it on to the ASE developers and we will get back to you on Monday as soon as we test it on our side.

We are available for direct contact at [email protected]

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: Billboard rendering too shiny

Postby Duckocide » Sun Jul 30, 2017 4:11 pm

OK. I'll email the materials with a link to this thread. Thanks!
Duckocide
 
Posts: 5
Joined: Sun Jul 30, 2017 8:04 am

Re: Billboard rendering too shiny

Postby Ricardo Teixeira » Mon Jul 31, 2017 10:27 am

Duckocide wrote:OK. I'll email the materials with a link to this thread. Thanks!


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 0 guests

cron