uniform float4x4 ViewProj; uniform texture2d image; uniform texture2d background; sampler_state textureSampler{ Filter = Linear; AddressU = Clamp; AddressV = Clamp; MinLOD = 0; MaxLOD = 0; }; struct VertData { float4 pos : POSITION; float2 uv : TEXCOORD0; }; VertData mainTransform(VertData v_in) { v_in.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj); return v_in; } float4 mainImage(VertData v_in) : TARGET { float4 img_col = image.Sample(textureSampler, v_in.uv); float4 background_col = background.Sample(textureSampler, v_in.uv); float a = img_col.a; float3 color = img_col.rgb * a + background_col.rgb * (1.0 - a); return float4(color.rgb, a); } technique Draw { pass { vertex_shader = mainTransform(v_in); pixel_shader = mainImage(v_in); } }