I’m currently moving my game from Unity to Unreal Engine 4.and I’m not familiar with this engine. I have shader written in C listed below. Anyone know how to move this to material brlueprint?
It script is called “Blending”. Maybe is similar function in material blueprints?
I would be very grateful if you’ll help me.
Thank you,
Shader "Enviro/BumpedDiffuseOverlaySM3" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_Opacity ("Color over opacity", Range (0, 1)) = 1
_MainTex ("Color over (RGBA)", 2D) = "white" {}
_BumpMap ("Normalmap over", 2D) = "bump" {}
_MainTex2 ("Color under (RGBA)", 2D) = "white" {}
_BumpMap2 ("Normalmap under", 2D) = "bump" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 400
CGPROGRAM
#pragma surface surf Lambert
#pragma target 3.0
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _MainTex2;
sampler2D _BumpMap2;
fixed4 _Color;
float _Opacity;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
float2 uv_MainTex2;
float2 uv_BumpMap2;
};
void surf (Input IN, inout SurfaceOutput o) {
float4 tex = tex2D(_MainTex, IN.uv_MainTex);
float4 tex2 = tex2D(_MainTex2, IN.uv_MainTex2);
float4 dest;
_Opacity*=tex.a;
dest.rgb = tex2.rgb<=0.5 ? 2*tex.rgb*tex2.rgb : 1-2*(1-tex.rgb)*(1-tex2.rgb);
dest.rgb = lerp(tex2.rgb, dest.rgb, _Opacity);
dest.rgb *= _Color.rgb;
o.Albedo = dest.rgb;
o.Alpha = tex2.a * _Color.a;
float4 norm = tex2D(_BumpMap, IN.uv_BumpMap);
float4 norm2 = tex2D(_BumpMap2, IN.uv_BumpMap2);
dest = norm2<=0.5 ? 2*norm*norm2 : 1-2*(1-norm)*(1-norm2);
dest = lerp(norm2, dest, _Opacity);
o.Normal = UnpackNormal(dest);
}
ENDCG
}
FallBack "Bumped Diffuse"
}