Blend materials/substances?
I have some big areas so when I apply a substance it has a obvious repeating pattern.
I would like to merge two substances using a mask that I can tile and rotate independently to add some variation in a similar way the Terrain Toolkit does. Is there a simple way to do this? A special shader maybe? Any push to the right direction?
you have to write or find a custom shader script. I wrote one for my game cause i couldn't find one.
Answer by toddisarockstar · Apr 09, 2017 at 11:42 PM
Actually here is what i wrote for my game. it blends three textures on a surface. you have to make a map texture in paint. Use black red and blue color on the map to assign where the textures go. hopefully it helps
Shader "todds/3Textures" {
Properties {
// _Color ("Overall Color", Color) = (1,0.5,0.5,1)
_t1 ("texture in white", 2D) = "white" {}
_tint1 ("Tint1", Color) = (1.0, 0.6, 0.6, 1.0)
_t2 ("texture in red", 2D) = "white" {}
_tint2 ("Tint2", Color) = (1.0, 0.6, 0.6, 1.0)
_rc ("low cutoff", Range(1,80)) = 0.0
_t3 ("texture in blue", 2D) = "white" {}
_tint3 ("Tint3", Color) = (1.0, 0.6, 0.6, 1.0)
_rb ("low cutoff", Range(1,80)) = 0.0
_t4 ("texture map", 2D) = "white" {}
}
SubShader {
//Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
float _rc;
float _rb;
sampler2D _t1;
sampler2D _t2;
sampler2D _t3;
sampler2D _t4;
fixed4 _tint1;
fixed4 _tint2;
fixed4 _tint3;
struct Input {
float2 uv_t1;
float2 uv_t2;
float2 uv_t3;
float2 uv_t4;
};
void surf (Input IN, inout SurfaceOutput o) {
float f;
half4 pix = tex2D (_t1, IN.uv_t1)*_tint1;
half4 map = tex2D (_t4, IN.uv_t4);
f=map.r;
f=f*_rc;
if(f>1){f=1;}
f=1-f;
pix=pix*f;
f=1-f;
pix=pix+tex2D (_t2, IN.uv_t2)*f*_tint2;
f=map.b;
f=f*_rb;
if(f>1){f=1;}
f=1-f;
pix=pix*f;
f=1-f;
pix=pix+tex2D (_t3, IN.uv_t3)*f*_tint3;
o.Albedo = pix.rgb;
}
ENDCG
}
FallBack "Diffuse"
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612115020im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Imported material with texture transparency 0 Answers
Applying PNG as material goes partly wrong 0 Answers
What right way to SetTextureOffset of material which has dynamic count owners? 0 Answers
Looking for help with creating a gold texture/reflection for mobile games 0 Answers
Textures, Materials, Meshs and Maps? 1 Answer