//**************************************************************************/ // Copyright 2014 Autodesk, Inc. // All rights reserved. // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. //**************************************************************************/ #include "Common.ogsfh" // The source texture uniform texture2D gSourceTex : SourceTexture < string UIName = "Source Texture"; >; // Sampler of source texture uniform sampler2D gSourceSamp = sampler_state { Texture = ; }; // The 2nd source texture uniform texture2D gSourceTex2 : SourceTexture2 < string UIName = "Source Texture 2"; >; // Sampler of 2nd source texture uniform sampler2D gSourceSamp2 = sampler_state { Texture = ; }; uniform vec4 gUVTransform : RelativeViewportDimensions; // Red / cyan anaglpyh between 2 images // GLSLShader PS_Anaglyph { void main() { vec4 source = texture2D(gSourceSamp, VSUV * gUVTransform.zw + gUVTransform.xy); vec4 source2 = texture2D(gSourceSamp2, VSUV * gUVTransform.zw + gUVTransform.xy); vec4 result; result.x = source.x; result.yz = source2.yz; result.w = saturate(source.w + source2.w); colorOut = result; } } // Luminance anaglyph between 2 images // GLSLShader PS_Anaglyph_Luminance { void main() { vec4 source = texture2D(gSourceSamp, VSUV * gUVTransform.zw + gUVTransform.xy); vec4 source2 = texture2D(gSourceSamp2, VSUV * gUVTransform.zw + gUVTransform.xy); vec3 RGBtoLum = vec3( 0.1140, 0.5870, 0.2989 ); float sourceLuminance = dot( RGBtoLum, source.xyz ); float source2Luminance = dot( RGBtoLum, source2.xyz ); vec4 result; result.x = sourceLuminance; result.y = source2Luminance; result.z = source2Luminance; result.w = source2.w; colorOut = result; } } // The default technique. technique Main { pass p0 { VertexShader (in VS_INPUT_ScreenQuad, out VS_TO_PS_ScreenQuad) = VS_ScreenQuad; PixelShader (in VS_TO_PS_ScreenQuad, out pixelOut) = PS_Anaglyph; } } technique AnaglyphLuminance { pass p0 { VertexShader (in VS_INPUT_ScreenQuad, out VS_TO_PS_ScreenQuad) = VS_ScreenQuad; PixelShader (in VS_TO_PS_ScreenQuad, out pixelOut) = PS_Anaglyph_Luminance; } }