// A separate pass over the existing tinted/reflected glass, using a PM atlas. texture gStickers; float4x4 gWorldViewProjection : WORLDVIEWPROJECTION; sampler StickerSampler = sampler_state { Texture = ; MinFilter = Linear; MagFilter = Linear; MipFilter = None; AddressU = Clamp; AddressV = Clamp; }; struct VSInput {float3 Position : POSITION0; float2 UV : TEXCOORD0;}; struct VSOutput {float4 Position : POSITION0; float2 UV : TEXCOORD0;}; VSOutput GlassVS(VSInput input) { VSOutput output; output.Position = mul(float4(input.Position,1),gWorldViewProjection); output.UV = input.UV; return output; } float4 GlassPS(VSOutput input) : COLOR0 { // Avoid clamping a colored atlas edge over tiled/out-of-range model UVs. clip(input.UV); clip(1-input.UV); float4 decal = tex2D(StickerSampler,input.UV); clip(decal.a - 0.001); // Vertex/material alpha belongs to the glass, not to an opaque sticker. return decal; } technique glass_stickers { pass P0 { AlphaBlendEnable = true; SrcBlend = One; DestBlend = InvSrcAlpha; ZEnable = true; ZWriteEnable = false; DepthBias = -0.00005; AlphaTestEnable = false; VertexShader = compile vs_2_0 GlassVS(); PixelShader = compile ps_2_0 GlassPS(); } }