//**************************************************************************/ // Copyright 2010 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. //**************************************************************************/ // World-view-projection transformation. float4x4 gWVPXf : WorldViewProjection < string UIWidget = "None"; >; // The single filter input, i.e. the image to be filtered. texture gInputTex : InputTexture < string UIName = "Input Texture"; >; // Filter input sampler. sampler2D gInputSampler = sampler_state { Texture = ; MinFilter = Point; MagFilter = Point; MipFilter = Point; }; // Gamma value. float gGamma = 2.2f; // Vertex shader input structure. struct VS_INPUT { float4 Pos : POSITION; float3 UV : TEXCOORD0; }; // Vertex shader output structure. struct VS_TO_PS { float4 HPos : POSITION; float3 UV : TEXCOORD0; }; // Vertex shader. VS_TO_PS VS_Copy(VS_INPUT In) { VS_TO_PS Out; // Transform the position from object space to clip space for output. Out.HPos = mul(gWVPXf, In.Pos); // Pass the texture coordinates unchanged. Out.UV = In.UV; return Out; } // Pixel shader. float4 PS_Copy(VS_TO_PS In) : COLOR0 { float4 output = tex2D(gInputSampler, In.UV.xy); return float4( pow( output.xyz, 1.0 / gGamma ), output.w ); } // The main technique. technique Main { pass p0 { VertexProgram = compile glslv VS_Copy(); FragmentProgram = compile glslf PS_Copy(); } }