Okay, here's the output of the motion blur .FX file from Render Monkey 1.5
//**************************************************************//
// Effect File exported by RenderMonkey
//
// - Although many improvements were made to RenderMonkey FX
// file export, there are still situations that may cause
// compilation problems once the file is exported, such as
// occasional naming conflicts for methods, since FX format
// does not support any notions of name spaces. You need to
// try to create workspaces in such a way as to minimize
// potential naming conflicts on export.
//
// - Note that to minimize resulting name collisions in the FX
// file, RenderMonkey will mangle names for passes, shaders
// and function names as necessary to reduce name conflicts.
//**************************************************************//
//--------------------------------------------------------------//
// Motion Blur Effects
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// AnimusicMotionBlurredBall
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// Single Pass
//--------------------------------------------------------------//
string Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Ball : ModelData = "../../../Program Files/ATI Research Inc/RenderMonkey 1.5/Examples/Media/Models/Sphere.3ds";
float4x4 mBallOrientation
<
string UIName = "mBallOrientation";
string UIWidget = "Matrix";
> = ( 1.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 1.00 );
float4 vAmbientColor3
<
string UIName = "vAmbientColor3";
string UIWidget = "Color";
> = ( 0.51, 0.34, 0.01, 1.00 );
float4 vAmbientColor2
<
string UIName = "vAmbientColor2";
string UIWidget = "Color";
> = ( 0.25, 0.00, 0.73, 1.00 );
float4x4 mW0Matrix
<
string UIName = "mW0Matrix";
string UIWidget = "Matrix";
> = ( 1.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00, 1.00 );
float4 vColor
<
string UIName = "vColor";
string UIWidget = "Color";
> = ( 0.36, 0.36, 0.36, 1.00 );
float4 vExtensionDirection
<
string UIName = "vExtensionDirection";
string UIWidget = "Direction";
float4 UIMin = ( -10.00, -10.00, -10.00, -10.00 );
float4 UIMax = ( 0.00, 0.00, 0.00, 0.00 );
bool Normalize = false;
> = ( 0.00, 0.00, -1.50, 0.00 );
float4 vObjectCenter
<
string UIName = "vObjectCenter";
string UIWidget = "Direction";
float4 UIMin = ( -10.00, -10.00, -10.00, -10.00 );
float4 UIMax = ( 10.00, 10.00, 10.00, 10.00 );
bool Normalize = false;
> = ( 0.00, 0.00, 0.00, 1.00 );
float4 vAmbientPos3
<
string UIName = "vAmbientPos3";
string UIWidget = "Direction";
float4 UIMin = ( -2000.00, -2000.00, -2000.00, -2000.00 );
float4 UIMax = ( 2000.00, 2000.00, 2000.00, 2000.00 );
bool Normalize = false;
> = ( 2000.00, 280.00, 0.00, 1.00 );
float4 vAmbientPos1
<
string UIName = "vAmbientPos1";
string UIWidget = "Direction";
float4 UIMin = ( -2000.00, -2000.00, -2000.00, -2000.00 );
float4 UIMax = ( 2000.00, 2000.00, 2000.00, 2000.00 );
bool Normalize = false;
> = ( -1000.00, 0.00, 840.00, 1.00 );
float4 vAmbientPos2
<
string UIName = "vAmbientPos2";
string UIWidget = "Direction";
float4 UIMin = ( -2000.00, -2000.00, -2000.00, -2000.00 );
float4 UIMax = ( 2000.00, 2000.00, 2000.00, 2000.00 );
bool Normalize = false;
> = ( 0.00, -2000.00, 0.00, 1.00 );
float4x4 view_proj_matrix : ViewProjection;
float4 vAmbientColor1
<
string UIName = "vAmbientColor1";
string UIWidget = "Color";
> = ( 0.70, 0.10, 0.95, 1.00 );
float4 mLight1Pos
<
string UIName = "mLight1Pos";
string UIWidget = "Direction";
float4 UIMin = ( -1000.00, -1000.00, -1000.00, -1000.00 );
float4 UIMax = ( 1000.00, 1000.00, 1000.00, 1000.00 );
bool Normalize = false;
> = ( 220.00, -620.00, -420.00, 1.00 );
float4 mLight2Pos
<
string UIName = "mLight2Pos";
string UIWidget = "Direction";
float4 UIMin = ( -10.00, -10.00, -10.00, -10.00 );
float4 UIMax = ( 10.00, 10.00, 10.00, 10.00 );
bool Normalize = false;
> = ( -10.00, 0.00, 0.00, 1.00 );
float fBallSize
<
string UIName = "fBallSize";
string UIWidget = "Numeric";
float UIMin = 1.00;
float UIMax = 100.00;
> = 1.00;
float fObjectScale
<
string UIName = "fObjectScale";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 1.00;
> = 0.03;
float4 vMotionDirection
<
string UIName = "vMotionDirection";
string UIWidget = "Direction";
float4 UIMin = ( -1.00, -1.00, -1.00, -1.00 );
float4 UIMax = ( 1.00, 1.00, 1.00, 1.00 );
bool Normalize = false;
> = ( 0.00, 0.00, 1.00, 1.00 );
float fSpeed
<
string UIName = "fSpeed";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 5.00;
> = 0.85;
float fZoom
<
string UIName = "fZoom";
string UIWidget = "Numeric";
float UIMin = 5.00;
float UIMax = 50.00;
> = 15.00;
float4 vLight1Color
<
string UIName = "vLight1Color";
string UIWidget = "Color";
> = ( 1.00, 0.74, 0.19, 1.00 );
float4 vLight2Color
<
string UIName = "vLight2Color";
string UIWidget = "Color";
> = ( 0.26, 0.47, 0.47, 1.00 );
float4x4 inv_view_matrix : ViewInverse;
float sin_time_0_X : SinTime0_X;
float fStretchSpeed
<
string UIName = "fStretchSpeed";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 5.00;
> = 2.00;
// This effect simulates motion blur resulting from movement
// of objects in object space. There, motion blur is caused
// by the object moving through finite amount of space during
// a short time step (equivalent to the exposure time due to
// an opened shutter).
//
// For a more detailed explanation of the technique see
// "Motion Blur Using Geometry and Shading Distortion" article
// in ShaderX^2
struct VS_OUTPUT
{
float4 ProjPos : POSITION;
float3 Diffuse : COLOR0;
float4 Normal : TEXCOORD0;
float3 View : TEXCOORD1;
float3 Light1 : TEXCOORD2;
float3 Light2 : TEXCOORD3;
float3 Pos : TEXCOORD4;
};
VS_OUTPUT Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Vertex_Shader_main( float4 Pos: POSITION, float3 Normal: NORMAL)
{
VS_OUTPUT o = (VS_OUTPUT).5;
Pos = float4( Pos.xyz * fObjectScale, 1 );
float4 vCameraPosition = mul( inv_view_matrix, float4( 0, 0, 0, 1 ));
// Calculate View Vector
float3 vView = normalize( vCameraPosition - mul( mW0Matrix, Pos ));
// For the sake of dynamic demonstration of the motion blur, in
// this particular example we scale the incoming speed parameter
// using the time value.
float fNewSpeed = fSpeed * abs( sin_time_0_X ) * fStretchSpeed;
// Calculate velocity relative to the eye
float3 vVelocity = vMotionDirection * fNewSpeed;
// motion vector as seen by the eye
float3 vEyeMotion = vVelocity - vView * dot( vVelocity, vView );
// Speed as relative to the observer:
float fEyeSpeed = length( vEyeMotion );
// Calculate the area that the stretched ball will take on
// the screen - it is dependent on the instantaneous velocity
// of the moving object and its size:
float fBallCoverage = 1 + fEyeSpeed / fBallSize;
// Calculate the blurriness factor for later alpha blending of
// the ball - the faster it moves, the more “smeared” it will
// appear:
float fBlurriness = 1 - 1 / fBallCoverage;
// Export blurriness factor the pixel shader:
o.Normal.w = fBlurriness;
// Translate object to object origin:
float4 vObjectPos = Pos - vObjectCenter;
// Extend the position to elongate the ball relative to the speed:
vObjectPos += fNewSpeed * vExtensionDirection * -sign( Normal.z );
// Re-orient the ball along its motion path:
float3 vOrientedPosition = mul(( float3x3 )mBallOrientation, vObjectPos );
// Rotate ball into correct orientation:
vOrientedPosition = mul( vOrientedPosition, (float3x3) mW0Matrix );
// Remove world matrix rotation
vOrientedPosition += vObjectCenter;
//
// Translate object back to where it started :
//
// Transform position into world space and output it:
float4 vWorldPos = mul( mW0Matrix, float4( vOrientedPosition, 1 ));
o.Pos = vWorldPos;
o.ProjPos = mul( view_proj_matrix, float4( vWorldPos.xyz * fZoom, vWorldPos.w ));
//
// Calculate Normal
//
// Rotate normal into correct orientation:
float3 vWorldNormal = mul( (float3x3) mBallOrientation, Normal );
// Remove world matrix rotation of normal:
vWorldNormal = mul( vWorldNormal, mW0Matrix );
// Translate to world space:
vWorldNormal = mul( mW0Matrix, vWorldNormal );
o.Normal.xyz = vWorldNormal;
//
// Light vectors for specular lighting:
//
// Light vector 1:
o.Light1 = normalize( (float3) mLight1Pos - (float3) vWorldPos );
// Light vector 2
o.Light2 = normalize( (float3) mLight2Pos - (float3) vWorldPos );
//
// Compute diffuse illumination contribution:
//
o.Diffuse = max(dot( vWorldNormal, normalize( vAmbientPos1 - vWorldPos )), 0) * vAmbientColor1;
o.Diffuse += max(dot( vWorldNormal, normalize( vAmbientPos2 - vWorldPos )), 0) * vAmbientColor2;
o.Diffuse += max(dot( vWorldNormal, normalize( vAmbientPos3 - vWorldPos )), 0) * vAmbientColor3;
o.Diffuse += max(dot( vWorldNormal, o.Light1 ), 0) * vLight1Color;
o.Diffuse += max(dot( vWorldNormal, o.Light2 ), 0) * vLight2Color;
o.Diffuse = o.Diffuse * vColor;
// More accurate view vector
o.View = normalize( vCameraPosition - vWorldPos );
return o;
}
float fTextureBlur
<
string UIName = "fTextureBlur";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 10.00;
> = 3.60;
float4 vReflectionColor
<
string UIName = "vReflectionColor";
string UIWidget = "Color";
> = ( 1.00, 1.00, 1.00, 1.00 );
float4 Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_vLight1Color
<
string UIName = "Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_vLight1Color";
string UIWidget = "Color";
> = ( 1.00, 0.74, 0.19, 1.00 );
float fSpecularExpBlurScale
<
string UIName = "fSpecularExpBlurScale";
string UIWidget = "Numeric";
float UIMin = -128.00;
float UIMax = 0.00;
> = -18.00;
float fSpecularExp
<
string UIName = "fSpecularExp";
string UIWidget = "Numeric";
float UIMin = 1.00;
float UIMax = 65.00;
> = 16.00;
float fSpecularDimScale
<
string UIName = "fSpecularDimScale";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 1.00;
> = 0.60;
float4 Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_vLight2Color
<
string UIName = "Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_vLight2Color";
string UIWidget = "Color";
> = ( 0.26, 0.47, 0.47, 1.00 );
float fEnvMapRadius
<
string UIName = "fEnvMapRadius";
string UIWidget = "Numeric";
float UIMin = 6.00;
float UIMax = 200.00;
> = 8.00;
float fBaseSpecularIntensity
<
string UIName = "fBaseSpecularIntensity";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 10.00;
> = 2.00;
texture tCubeEnv_Tex
<
string ResourceName = "..\..\..\Program Files\ATI Research Inc\RenderMonkey 1.5\Examples\Media\Textures\Motion-Blur Ball\Triple1.dds";
>;
sampler tCubeEnv = sampler_state
{
Texture = (tCubeEnv_Tex);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
ADDRESSW = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
MIPMAPLODBIAS = 0.000000;
};
// This effect simulates motion blur resulting from movement
// of objects in object space. There, motion blur is caused
// by the object moving through finite amount of space during
// a short time step (equivalent to the exposure time due to
// an opened shutter).
//
// For a more detailed explanation of the technique see
// "Motion Blur Using Geometry and Shading Distortion" article
// in ShaderX^2
struct PS_INPUT
{
float3 Diffuse : COLOR0;
float4 Normal : TEXCOORD0;
float3 View : TEXCOORD1;
float3 Light1 : TEXCOORD2;
float3 Light2 : TEXCOORD3;
float3 Pos : TEXCOORD4;
};
float4 Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_main(PS_INPUT i) : COLOR
{
// Extract blurring factor from the normal vector interpolator:
float fBlur = i.Normal.w;
// Compute reflection vector:
float3 vNormal = normalize( i.Normal );
float3 vReflection = normalize( 2 * dot( i.View, vNormal ) * vNormal - i.View );
// Compute fade out rate for the moving ball taking into account Fresnel effect:
float fFirstBallWidthFade = saturate( 2 * fBlur );
float fRestBallWidthFade = saturate( 2 - 2 * fBlur );
float fFresnel = 1 - saturate( dot( vNormal, i.View ) );
float fAlpha = fRestBallWidthFade * ( 1 - fFirstBallWidthFade * fFresnel );
// Apply environment map to the object, speed-dependent blurring:
float3 vCubeLookup = vReflection + i.Pos / fEnvMapRadius;
float4 cReflection = texCUBEbias( tCubeEnv, float4( vCubeLookup, fBlur * fTextureBlur)) * vReflectionColor;
// Compute smearing of specular highlights depending on the amount
// of motion blur:
float fBlurredSpecularExp = max( 1, fSpecularExpBlurScale * fBlur + fSpecularExp );
float fSpecularIntensity = fBaseSpecularIntensity * (1 - ( fBlur * fSpecularDimScale ));
// Compute specular contribution for the first light:
float3 cSpecular1 = pow( saturate( dot( vReflection, i.Light1 )), fBlurredSpecularExp) * fSpecularIntensity * Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_vLight1Color;
// Compute specular contribution for the second light:
float3 cSpecular2 = pow(saturate(dot( vReflection, i.Light2 )), fBlurredSpecularExp) * fSpecularIntensity * Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_vLight2Color;
// Compute input diffuse contribution with both specular
// highlight areas and environment map term:
float3 cColor = cReflection + cSpecular1 + cSpecular2 + i.Diffuse;
// Determine the actual blending amount:
float alpha = fRestBallWidthFade * (1 - fFirstBallWidthFade * (1-saturate(dot( -vNormal, -i.View ))));
// Pre-multiply by alpha and output color:
return float4( cColor * alpha, alpha );
}
//--------------------------------------------------------------//
// MotionBlur
//--------------------------------------------------------------//
//--------------------------------------------------------------//
// Render
//--------------------------------------------------------------//
string Motion_Blur_Effects_MotionBlur_Render_Torus : ModelData = "../../../Program Files/ATI Research Inc/RenderMonkey 1.5/Examples/Media/Models/Torus.3ds";
texture RT_Tex : RenderColorTarget
<
float2 ViewportRatio={1.0,1.0};
string Format="D3DFMT_A16B16G16R16";
float ClearDepth=1.000000;
int ClearColor=0;
>;
float4x4 Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_view_proj_matrix : ViewProjection;
float4x4 view_matrix : View;
struct Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_VS_OUTPUT {
float4 Pos: POSITION;
float3 normal: TEXCOORD0;
float2 texCoord: TEXCOORD1;
};
Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_VS_OUTPUT Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_main(float4 Pos: POSITION, float3 normal: NORMAL, float2 texCoord: TEXCOORD0){
Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_VS_OUTPUT Out;
Out.Pos = mul(Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_view_proj_matrix, Pos);
// Eye-space lighting
Out.normal = mul(view_matrix, normal);
Out.texCoord = texCoord;
return Out;
}
float4 lightDir
<
string UIName = "lightDir";
string UIWidget = "Direction";
float4 UIMin = ( -10.00, -10.00, -10.00, -10.00 );
float4 UIMax = ( 10.00, 10.00, 10.00, 10.00 );
bool Normalize = false;
> = ( 0.41, 0.41, -0.82, 0.00 );
texture BaseMap_Tex
<
string ResourceName = "..\..\..\Program Files\ATI Research Inc\RenderMonkey 1.5\Examples\Media\Textures\Wood.dds";
>;
sampler BaseMap = sampler_state
{
Texture = (BaseMap_Tex);
ADDRESSU = WRAP;
ADDRESSV = WRAP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = POINT;
};
float4 Motion_Blur_Effects_MotionBlur_Render_Pixel_Shader_main(float3 normal: TEXCOORD0, float2 texCoord: TEXCOORD1) : COLOR
{
// Basic diffuse lighing
float4 base = tex2D(BaseMap, texCoord);
float diffuse = saturate(dot(lightDir, normal));
return diffuse * base;
}
//--------------------------------------------------------------//
// Combine
//--------------------------------------------------------------//
string Motion_Blur_Effects_MotionBlur_Combine_ScreenAlignedQuad : ModelData = "../../../Program Files/ATI Research Inc/RenderMonkey 1.5/Examples/Media/Models/ScreenAlignedQuad.3ds";
texture Temp_Tex : RenderColorTarget
<
float2 ViewportRatio={1.0,1.0};
string Format="D3DFMT_A16B16G16R16";
float ClearDepth=1.000000;
int ClearColor=0;
>;
float viewport_inv_width : ViewportWidthInverse;
float viewport_inv_height : ViewportHeightInverse;
struct Motion_Blur_Effects_MotionBlur_Combine_Vertex_Shader_VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
};
Motion_Blur_Effects_MotionBlur_Combine_Vertex_Shader_VS_OUTPUT Motion_Blur_Effects_MotionBlur_Combine_Vertex_Shader_main(float4 Pos: POSITION){
Motion_Blur_Effects_MotionBlur_Combine_Vertex_Shader_VS_OUTPUT Out;
// Clean up inaccuracies
Pos.xy = sign(Pos.xy);
Out.Pos = float4(Pos.xy, 0, 1);
// Image-space
Out.texCoord.x = 0.5 * (1 + Pos.x + viewport_inv_width);
Out.texCoord.y = 0.5 * (1 - Pos.y + viewport_inv_height);
return Out;
}
float blur
<
string UIName = "blur";
string UIWidget = "Numeric";
float UIMin = 0.00;
float UIMax = 1.00;
> = 0.95;
sampler RT = sampler_state
{
Texture = (RT_Tex);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = NONE;
};
texture Sum_Tex
<
string ResourceName = "..\..\..\Program Files\ATI Research Inc\RenderMonkey 1.5\Examples\Dx9\";
>;
sampler Sum = sampler_state
{
Texture = (Sum_Tex);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = NONE;
};
float4 Motion_Blur_Effects_MotionBlur_Combine_Pixel_Shader_main(float2 texCoord: TEXCOORD0) : COLOR
{
float4 render = tex2D(RT, texCoord);
float4 sum = tex2D(Sum, texCoord);
return lerp(render, sum, blur);
}
//--------------------------------------------------------------//
// Copy back
//--------------------------------------------------------------//
string Motion_Blur_Effects_MotionBlur_Copy_back_ScreenAlignedQuad : ModelData = "../../../Program Files/ATI Research Inc/RenderMonkey 1.5/Examples/Media/Models/ScreenAlignedQuad.3ds";
texture Motion_Blur_Effects_MotionBlur_Copy_back_Sum : RenderColorTarget
<
float2 ViewportRatio={1.0,1.0};
string Format="D3DFMT_A16B16G16R16";
float ClearDepth=1.000000;
int ClearColor=0;
>;
float4x4 Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_view_proj_matrix;
float Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_viewport_inv_width : ViewportWidthInverse;
float Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_viewport_inv_height : ViewportHeightInverse;
struct Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
};
Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_VS_OUTPUT Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_main(float4 Pos: POSITION){
Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_VS_OUTPUT Out;
// Clean up inaccuracies
Pos.xy = sign(Pos.xy);
Out.Pos = float4(Pos.xy, 0, 1);
// Image-space
Out.texCoord.x = 0.5 * (1 + Pos.x + Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_viewport_inv_width);
Out.texCoord.y = 0.5 * (1 - Pos.y + Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_viewport_inv_height);
return Out;
}
sampler Temp = sampler_state
{
Texture = (Temp_Tex);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = NONE;
};
float4 Motion_Blur_Effects_MotionBlur_Copy_back_Pixel_Shader_main(float2 texCoord: TEXCOORD0) : COLOR
{
return tex2D(Temp, texCoord);
}
//--------------------------------------------------------------//
// Output
//--------------------------------------------------------------//
string Motion_Blur_Effects_MotionBlur_Output_ScreenAlignedQuad : ModelData = "../../../Program Files/ATI Research Inc/RenderMonkey 1.5/Examples/Media/Models/ScreenAlignedQuad.3ds";
float Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_viewport_inv_width : ViewportWidthInverse;
float Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_viewport_inv_height : ViewportHeightInverse;
struct Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
};
Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_VS_OUTPUT Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_main(float4 Pos: POSITION){
Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_VS_OUTPUT Out;
// Clean up inaccuracies
Pos.xy = sign(Pos.xy);
Out.Pos = float4(Pos.xy, 0, 1);
// Image-space
Out.texCoord.x = 0.5 * (1 + Pos.x + Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_viewport_inv_width);
Out.texCoord.y = 0.5 * (1 - Pos.y + Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_viewport_inv_height);
return Out;
}
sampler Motion_Blur_Effects_MotionBlur_Output_Pixel_Shader_Sum = sampler_state
{
Texture = (Sum_Tex);
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = NONE;
};
float4 Motion_Blur_Effects_MotionBlur_Output_Pixel_Shader_main(float2 texCoord: TEXCOORD0) : COLOR {
return tex2D(Motion_Blur_Effects_MotionBlur_Output_Pixel_Shader_Sum, texCoord);
}
//--------------------------------------------------------------//
// Technique Section for Motion Blur Effects
//--------------------------------------------------------------//
technique AnimusicMotionBlurredBall
{
pass Single_Pass
{
SRCBLEND = ONE;
DESTBLEND = INVSRCALPHA;
ALPHABLENDENABLE = TRUE;
VertexShader = compile vs_1_1 Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Vertex_Shader_main();
PixelShader = compile ps_2_0 Motion_Blur_Effects_AnimusicMotionBlurredBall_Single_Pass_Pixel_Shader_main();
}
}
technique MotionBlur
{
pass Render
<
string Script = "RenderColorTarget0 = RT_Tex;";
>
{
CULLMODE = CCW;
VertexShader = compile vs_1_1 Motion_Blur_Effects_MotionBlur_Render_Vertex_Shader_main();
PixelShader = compile ps_1_4 Motion_Blur_Effects_MotionBlur_Render_Pixel_Shader_main();
}
pass Combine
<
string Script = "RenderColorTarget0 = Temp_Tex;";
>
{
CULLMODE = NONE;
VertexShader = compile vs_1_1 Motion_Blur_Effects_MotionBlur_Combine_Vertex_Shader_main();
PixelShader = compile ps_1_4 Motion_Blur_Effects_MotionBlur_Combine_Pixel_Shader_main();
}
pass Copy_back
<
string Script = "RenderColorTarget0 = Motion_Blur_Effects_MotionBlur_Copy_back_Sum;";
>
{
VertexShader = compile vs_1_1 Motion_Blur_Effects_MotionBlur_Copy_back_Vertex_Shader_main();
PixelShader = compile ps_1_1 Motion_Blur_Effects_MotionBlur_Copy_back_Pixel_Shader_main();
}
pass Output
{
ALPHABLENDENABLE = FALSE;
VertexShader = compile vs_1_1 Motion_Blur_Effects_MotionBlur_Output_Vertex_Shader_main();
PixelShader = compile ps_1_1 Motion_Blur_Effects_MotionBlur_Output_Pixel_Shader_main();
}
}