//**************************************************************************/ // Copyright (c) 2010 Autodesk, Inc. // All rights reserved. // // These coded instructions, statements, and computer programs contain // unpublished proprietary information written by Autodesk, Inc., and are // protected by Federal copyright law. They may not be disclosed to third // parties or copied or duplicated in any form, in whole or in part, without // the prior written consent of Autodesk, Inc. #include "Common.cgh" // The source texture texture gSourceTex : SourceTexture < string UIName = "Source Texture"; >; // Sampler of source texture sampler2D gSourceSamp = sampler_state { Texture = ; }; // The 2nd source texture texture gSourceTex2 : SourceTexture2 < string UIName = "Source Texture 2"; >; // Sampler of 2nd source texture sampler2D gSourceSamp2 = sampler_state { Texture = ; }; // Amount to blend source float gBlendSrc = 0.3f; float4 gUVTransform : RelativeViewportDimensions; // Simple blending between 2 images float4 PS_Blend(VS_TO_PS_ScreenQuad In) : COLOR0 { float4 source = tex2D(gSourceSamp, In.UV * gUVTransform.zw + gUVTransform.xy); float4 source2 = tex2D(gSourceSamp2, In.UV * gUVTransform.zw + gUVTransform.xy); float4 result = float4( lerp(source2, source, gBlendSrc).xyz, source.a); return result; } float4 PS_AlphaBlend(VS_TO_PS_ScreenQuad In) : COLOR0 { float4 source = tex2D(gSourceSamp, In.UV * gUVTransform.zw + gUVTransform.xy); float4 source2 = tex2D(gSourceSamp2, In.UV * gUVTransform.zw + gUVTransform.xy); float4 result = lerp(source2, source, source.a); return result; } float4 PS_Add(VS_TO_PS_ScreenQuad In) : COLOR0 { float4 source = tex2D(gSourceSamp, In.UV * gUVTransform.zw + gUVTransform.xy); float4 source2 = tex2D(gSourceSamp2, In.UV * gUVTransform.zw + gUVTransform.xy); return source2 + source; } // The main technique. technique Main { pass p0 { VertexShader = compile glslv VS_ScreenQuad(); PixelShader = compile glslf PS_AlphaBlend(); } } technique AlphaBlend { pass p0 { VertexShader = compile glslv VS_ScreenQuad(); PixelShader = compile glslf PS_Blend(); } } technique Add { pass p0 { VertexShader = compile glslv VS_ScreenQuad(); PixelShader = compile glslf PS_Add(); } }