特定の方法で 2 つのテクスチャを組み合わせるシェーダーがあります。
対応するプロポーションを維持しながら、最初のテクスチャを 2 番目のテクスチャの中央に配置するにはどうすればよいですか?
つまり、100x100 の画像と 1024x 768 の別の画像があります。最初の画像が 2 番目の画像の前に中央に配置されるように 2 つのテクスチャを組み合わせる方法はありますか?素材) ?
ここに私のシェーダーがあります:
sampler2D _MainTex;
sampler2D _MainTex2;
float4 _Color;
float _bwBlend;
struct Input {
float2 uv_MainTex;
float2 uv_MainTex2;
};
void surf (Input IN, inout SurfaceOutput o)
{
half4 c = tex2D(_MainTex, IN.uv_MainTex);
half4 c2 = tex2D(_MainTex2, IN.uv_MainTex2);
o.Normal =c.a > .2f ? (.1,.1,.1) : (0,0,0);
o.Albedo = c.a > .2f ? c : c2;
}
言語はCGですが、シェーダーの基礎知識があれば誰でも答えられると思います。