I am trying to create a new material from scratch with 6 different textures for a terrain. In the shader code I know it to be:
fixed4 c1 = tex2D (_Tex1, IN.uv_Tex1 * _TexScale1) * _Color1;
fixed4 c2 = tex2D (_Tex2, IN.uv_Tex1 * _TexScale2) * _Color2;
fixed4 c3 = tex2D (_Tex3, IN.uv_Tex1 * _TexScale3) * _Color3;
fixed4 c4 = tex2D (_Tex4, IN.uv_Tex1 * _TexScale4) * _Color4;
fixed4 c5 = tex2D (_Tex5, IN.uv_Tex1 * _TexScale5) * _Color5;
fixed4 c6 = tex2D (_Tex6, IN.uv_Tex1 * _TexScale6) * _Color6;
What node would I use in Amplify Shader editor to create the equivalent of this?
Thanks
the equivalent of this shader in Amplify Shader editor?
-
markashburner
- Posts: 8
- Joined: Thu Mar 08, 2018 3:51 pm
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: the equivalent of this shader in Amplify Shader editor?
Hello, I recommend that you check out the Texture Sample, Multiply and Color nodes.
Regarding terrain shaders, although support for multi-pass is still on its way, I recommend that you examine our terrain samples that we include in the ASE package, such as the SimpleTerrain and the TerrainSnowCoverage, as they provide insight on how to build different terrain shaders with our Editor.
Please let me know if this helps, thanks!
Regarding terrain shaders, although support for multi-pass is still on its way, I recommend that you examine our terrain samples that we include in the ASE package, such as the SimpleTerrain and the TerrainSnowCoverage, as they provide insight on how to build different terrain shaders with our Editor.
Please let me know if this helps, thanks!
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
markashburner
- Posts: 8
- Joined: Thu Mar 08, 2018 3:51 pm
Re: the equivalent of this shader in Amplify Shader editor?
So multi-pass is not supported with Amplify Shader editor?Amplify_Borba wrote:Hello, I recommend that you check out the Texture Sample, Multiply and Color nodes.
Regarding terrain shaders, although support for multi-pass is still on its way, I recommend that you examine our terrain samples that we include in the ASE package, such as the SimpleTerrain and the TerrainSnowCoverage, as they provide insight on how to build different terrain shaders with our Editor.
Please let me know if this helps, thanks!
Does that mean I can't use 6 different textures?
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: the equivalent of this shader in Amplify Shader editor?
Multi-pass support has been recently added and is present in the current ASE release, however, a proper template must be used in order to create specific terrain types. We currently include a simple single-pass example, we might be able to include a more advanced example at a later stage.
We're also in the process of updating our Multi-pass documentation, so stay tuned for more information regarding this new feature!
We're also in the process of updating our Multi-pass documentation, so stay tuned for more information regarding this new feature!
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
markashburner
- Posts: 8
- Joined: Thu Mar 08, 2018 3:51 pm
Re: the equivalent of this shader in Amplify Shader editor?
Thanks for the information.Amplify_Borba wrote:Multi-pass support has been recently added and is present in the current ASE release, however, a proper template must be used in order to create specific terrain types. We currently include a simple single-pass example, we might be able to include a more advanced example at a later stage.
We're also in the process of updating our Multi-pass documentation, so stay tuned for more information regarding this new feature!
Would you be able to help me
Achieve the same effect as this shader?
Code: Select all
Shader "PlanetaryTerrain/PlanetSurfaceShader" {
Properties {
_Tex1 ("Texture 0 (Beach)", 2D) = "white" {}
_Color1 ("Color", Color) = (1,1,1,1)
_Glossiness1 ("Smoothness", Range(0,1)) = 0.5
_Metallic1 ("Metallic", Range(0,1)) = 0.0
_TexScale1 ("Texture Scale", Float) = 1
_Tex2 ("Texture 1", 2D) = "white" {}
_Color2 ("Color", Color) = (1,1,1,1)
_Glossiness2 ("Smoothness", Range(0,1)) = 0.5
_Metallic2 ("Metallic", Range(0,1)) = 0.0
_TexScale2 ("Texture Scale", Float) = 1
_Tex3 ("Texture 2", 2D) = "white" {}
_Color3 ("Color", Color) = (1,1,1,1)
_Glossiness3 ("Smoothness", Range(0,1)) = 0.5
_Metallic3 ("Metallic", Range(0,1)) = 0.0
_TexScale3 ("Texture Scale", Float) = 1
_Tex4 ("Texture 3", 2D) = "white" {}
_Color4 ("Color 4", Color) = (1,1,1,1)
_Glossiness4 ("Smoothness", Range(0,1)) = 0.5
_Metallic4 ("Metallic", Range(0,1)) = 0.0
_TexScale4 ("Texture Scale", Float) = 1
_Tex5 ("Texture 4", 2D) = "white" {}
_Color5 ("Color", Color) = (1,1,1,1)
_Glossiness5 ("Smoothness", Range(0,1)) = 0.5
_Metallic5 ("Metallic", Range(0,1)) = 0.0
_TexScale5 ("Texture Scale", Float) = 1
_Tex6 ("Texture 5 (Mountains)", 2D) = "white" {}
_Color6 ("Color", Color) = (1,1,1,1)
_Glossiness6 ("Smoothness", Range(0,1)) = 0.5
_Metallic6 ("Metallic", Range(0,1)) = 0.0
_TexScale6 ("Texture Scale", Float) = 1
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows //vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _Tex1;
sampler2D _Tex2;
sampler2D _Tex3;
sampler2D _Tex4;
sampler2D _Tex5;
sampler2D _Tex6;
float _TexScale1;
float _TexScale2;
float _TexScale3;
float _TexScale4;
float _TexScale5;
float _TexScale6;
struct Input {
float2 uv_Tex1;
float2 uv4_Tex2;
float4 color: Color;
};
half _Glossiness1;
half _Metallic1;
fixed4 _Color1;
half _Glossiness2;
half _Metallic2;
fixed4 _Color2;
half _Glossiness3;
half _Metallic3;
fixed4 _Color3;
half _Glossiness4;
half _Metallic4;
fixed4 _Color4;
half _Glossiness5;
half _Metallic5;
fixed4 _Color5;
half _Glossiness6;
half _Metallic6;
fixed4 _Color6;
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c1 = tex2D (_Tex1, IN.uv_Tex1 * _TexScale1) * _Color1;
fixed4 c2 = tex2D (_Tex2, IN.uv_Tex1 * _TexScale2) * _Color2;
fixed4 c3 = tex2D (_Tex3, IN.uv_Tex1 * _TexScale3) * _Color3;
fixed4 c4 = tex2D (_Tex4, IN.uv_Tex1 * _TexScale4) * _Color4;
fixed4 c5 = tex2D (_Tex5, IN.uv_Tex1 * _TexScale5) * _Color5;
fixed4 c6 = tex2D (_Tex6, IN.uv_Tex1 * _TexScale6) * _Color6;
//half slopeIntensity = 1 - (IN.color.r + IN.color.g + IN.color.b + IN.color.a + IN.uv4_Tex2.x + IN.uv4_Tex2.y);
o.Albedo = IN.color.r * c1 + IN.color.g * c2 + IN.color.b * c3 + IN.color.a * c4 + IN.uv4_Tex2.x * c5 + IN.uv4_Tex2.y * c6;
o.Metallic = IN.color.r * _Metallic1 + IN.color.g * _Metallic2 + IN.color.b * _Metallic3 + IN.color.a * _Metallic4 + IN.uv4_Tex2.x * _Metallic5 + IN.uv4_Tex2.y * _Metallic6;
o.Smoothness = IN.color.r * _Glossiness1 + IN.color.g * _Glossiness2 + IN.color.b * _Glossiness3 + IN.color.a * _Glossiness4 + IN.uv4_Tex2.x * _Glossiness5 + IN.uv4_Tex2.y * _Glossiness6;
}
ENDCG
}
FallBack "Diffuse"
}What I get is pretty close with Amplify shader, this is what I get in the code using the multiplier node.
Code: Select all
void surf( Input i , inout SurfaceOutputStandard o )
{
float2 uv_Tex1 = i.uv_texcoord * _Tex1_ST.xy + _Tex1_ST.zw;
float2 uv_Tex2 = i.uv_texcoord * _Tex2_ST.xy + _Tex2_ST.zw;
float2 uv_Tex3 = i.uv_texcoord * _Tex3_ST.xy + _Tex3_ST.zw;
float2 uv_Tex4 = i.uv_texcoord * _Tex4_ST.xy + _Tex4_ST.zw;
float2 uv_Tex5 = i.uv_texcoord * _Tex5_ST.xy + _Tex5_ST.zw;
float2 uv_Tex6 = i.uv_texcoord * _Tex6_ST.xy + _Tex6_ST.zw;
o.Albedo = ( tex2D( _Tex1, uv_Tex1 ) * tex2D( _Tex2, uv_Tex2 ) * tex2D( _Tex3, uv_Tex3 ) * tex2D( _Tex4, uv_Tex4 ) * tex2D( _Tex5, uv_Tex5 ) * tex2D( _Tex6, uv_Tex6 ) ).rgb;
o.Alpha = 1;I am trying to get it to match the code above as close as possible.
Thanks
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: the equivalent of this shader in Amplify Shader editor?
No problem, I'll be happy to point you the right way.
To change a texture's tiling ( and offset ) you need to use the [urlhttp://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Texture_Coordinates]Texture Coordinates[/url] node, and connect it to a Texture Sample's UV Input.
You may then control the Texture Coordinates' tiling by setting a value in its Node parameters, or use either a Float or a Vector2 node set as a Property to control it via the material inspector.
To change a texture's tiling ( and offset ) you need to use the [urlhttp://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Texture_Coordinates]Texture Coordinates[/url] node, and connect it to a Texture Sample's UV Input.
You may then control the Texture Coordinates' tiling by setting a value in its Node parameters, or use either a Float or a Vector2 node set as a Property to control it via the material inspector.
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!