The idea is I have a skin of the character and I have another texture, which is a wound,
freckle, or another detail that will personalize the character that will change by a script.
I found some answer using lerp in the shader but it seems like doesn’t work.
The main idea is to resolve by using shader but if you have any idea is welcome.
I found a solution in the shader graph
this graph take the first texture, which has the parts transparent, and another texture and overlap!
From: Unity - Manual: Surface Shader examples
There are multiple shader examples. Here is one very basic:
Shader "Example/Diffuse Texture" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
}
ENDCG
}
Fallback "Diffuse"
}
It’s just a diffuse texture. Now, you want 2 textures. So just add the lines for textures twice. Then lerp them together for the final albedo.
Shader "Example/Diffuse Texture" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_SecondTex ("Second Texture", 2D) = "white" {} // Add new texture property
_Blend ("Blend Amount", Range(0,1)) = 0.5 // Value for how much to blend
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
float2 uv_SecondTex; // Add second texture UVs
};
sampler2D _MainTex, _SecondTex; // Also sample second texture
half _Blend; // Initiate blend value
void surf (Input IN, inout SurfaceOutput o) {
// Lerp function between main and secondary textures, with 50% (0.5) blend
o.Albedo = lerp(tex2D (_MainTex, IN.uv_MainTex).rgb,
tex2D (_SecondTex, IN.uv_SecondTex).rgb,
_Blend);
}
ENDCG
}
Fallback "Diffuse"
}
However I don’t think this will look very good. I would look into how to overlay them rather than just have them on top of eachother.