IPB

Welcome Guest ( Log In | Register )

Sniper Zoom Through Commrose, Released!
dodek96_pl
post Jan 15 2012, 10:02 AM
Post #1


Captain
***

Group: Soldiers
Posts: 56
Joined: 13-March 10
From: Poland
Member No.: 7,342



Hi. I've got a request on youtube to release this:
http://www.youtube.com/watch?v=5gVP7fhFVLY

So here it is!
Link:
Download
Link to Badsantas scope shader:
Scope shader

You need BadSanta's scope shader and basic modding skills to do this. I will not reply to "hi im a noob modder and need help pls pls pls pls" posts. How-to included.

This does not work through multiplayer.

That's pretty much it. Have fun! Big thanks to BadSanta for his scope shader without which this would never be possible!


Use this in your PRIVATE MOD ONLY. Do NOT release this in your mod!

This post has been edited by dodek96_pl: Feb 18 2012, 02:24 PM


--------------------
Realism Mod-v1.0 BETA ready,download ready! Moddb
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 12)
Bubbles
post Jan 15 2012, 12:47 PM
Post #2


General
*****

Group: Soldiers
Posts: 1,226
Joined: 13-February 06
From: Europe
Member No.: 1,539



Nice. Any chance of a link to Badsanta's shader?
Go to the top of the page
 
+Quote Post
EnemySniper
post Jan 15 2012, 11:11 PM
Post #3


General Misaka
****

Group: Soldiers
Posts: 277
Joined: 9-January 11
From: Behind You!
Member No.: 7,802



Nice! Thanks for this! smile.gif

Any chance you'll release the A10 or F18 airstrike codes?


--------------------
My Website:



Go to the top of the page
 
+Quote Post
bobthedinosaur
post Jan 16 2012, 09:44 AM
Post #4


General
*****

Group: Soldiers
Posts: 1,211
Joined: 4-March 11
From: Tx
Member No.: 7,896



wow that is pretty nifty. Ill see if I can set it up on all of my scoped weapons.

Also what is this airstrike you speak of enemysniper?
Go to the top of the page
 
+Quote Post
dodek96_pl
post Jan 16 2012, 10:06 AM
Post #5


Captain
***

Group: Soldiers
Posts: 56
Joined: 13-March 10
From: Poland
Member No.: 7,342



QUOTE (bobthedinosaur @ Jan 16 2012, 10:44 AM) *
what is this airstrike you speak of enemysniper?

You can see parts of it here: http://www.youtube.com/watch?v=XTBeLKey8X8
This is a simple empty vehicle with forceObjects. They fly over the map and drop bombs. I'll release that thing soon too.


--------------------
Realism Mod-v1.0 BETA ready,download ready! Moddb
Go to the top of the page
 
+Quote Post
InSovietRussia
post Jan 16 2012, 01:54 PM
Post #6


IDF:FFI Dev
****

Group: Soldiers
Posts: 464
Joined: 21-July 10
From: On the internet
Member No.: 7,542



Very cool, you've been making some pretty cool stuff for your personal mod there. Those continuous airplane flyovers and airstrikes look pretty sweet, I'm tempted to go and code some of my own. biggrin.gif


--------------------

Go to the top of the page
 
+Quote Post
Phan2om
post Jan 22 2012, 07:20 PM
Post #7


Private
**

Group: Soldiers
Posts: 31
Joined: 18-August 11
Member No.: 8,167



Really make it for bf2142 ?
Go to the top of the page
 
+Quote Post
dodek96_pl
post Jan 23 2012, 05:07 AM
Post #8


Captain
***

Group: Soldiers
Posts: 56
Joined: 13-March 10
From: Poland
Member No.: 7,342



QUOTE (Phan2om @ Jan 22 2012, 08:20 PM) *
Really make it for bf2142 ?

I have no idea what do you mean. I don't know if it works with BF2142. I don't have BF2142 so I won't make the script for that game.


--------------------
Realism Mod-v1.0 BETA ready,download ready! Moddb
Go to the top of the page
 
+Quote Post
Phan2om
post Jan 24 2012, 01:14 AM
Post #9


Private
**

Group: Soldiers
Posts: 31
Joined: 18-August 11
Member No.: 8,167



QUOTE (dodek96_pl @ Jan 23 2012, 06:07 AM) *
QUOTE (Phan2om @ Jan 22 2012, 08:20 PM) *
Really make it for bf2142 ?

I have no idea what do you mean. I don't know if it works with BF2142. I don't have BF2142 so I won't make the script for that game.


It not works with bf 2142 ... because bf2142 has other shader system ... It s very bad ... i sad

its shader post proccession for bf2142 nv3x


CODE
#include "shaders/datatypes.fx"

texture texture0 : TEXLAYER0;
texture texture1 : TEXLAYER1;
texture texture2 : TEXLAYER2;
texture texture3 : TEXLAYER3;
texture texture4 : TEXLAYER4;
texture texture5 : TEXLAYER5;
texture texture6 : TEXLAYER6;

scalar backbufferLerpbias : BACKBUFFERLERPBIAS;
vec2 sampleoffset : SAMPLEOFFSET;
vec2 fogStartAndEnd : FOGSTARTANDEND;
vec3 fogColor : FOGCOLOR;
float glowStrength : GLOWSTRENGTH;
vec3 contrastPolynom : CONTRASTPOLYNOM;
//float brighten : BRIGHTEN;

vec4 colorTransformMat[3] : COLORTRANSFORMMATRIX;

sampler sampler0 = sampler_state { Texture = (texture0); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
sampler sampler1 = sampler_state { Texture = (texture1); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
sampler sampler2 = sampler_state { Texture = (texture2); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
sampler sampler3 = sampler_state { Texture = (texture3); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
sampler sampler4 = sampler_state { Texture = (texture4); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
sampler sampler5 = sampler_state { Texture = (texture5); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };
sampler sampler6 = sampler_state { Texture = (texture6); AddressU = CLAMP; AddressV = CLAMP; MinFilter = POINT; MagFilter = POINT; };

sampler sampler2wrap = sampler_state { Texture = (texture2); AddressU = WRAP; AddressV = WRAP; MinFilter = POINT; MagFilter = POINT; };

sampler sampler0bilin = sampler_state { Texture = (texture0); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler1bilin = sampler_state { Texture = (texture1); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler2bilin = sampler_state { Texture = (texture2); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler3bilin = sampler_state { Texture = (texture3); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler4bilin = sampler_state { Texture = (texture4); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler5bilin = sampler_state { Texture = (texture5); AddressU = CLAMP; AddressV = CLAMP; MinFilter = LINEAR; MagFilter = LINEAR; };

sampler sampler0bilinwrap = sampler_state { Texture = (texture0); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler1bilinwrap = sampler_state { Texture = (texture1); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler2bilinwrap = sampler_state { Texture = (texture2); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler3bilinwrap = sampler_state { Texture = (texture3); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler4bilinwrap = sampler_state { Texture = (texture4); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };
sampler sampler5bilinwrap = sampler_state { Texture = (texture5); AddressU = WRAP; AddressV = WRAP; AddressW = WRAP; MinFilter = LINEAR; MagFilter = LINEAR; };

scalar NPixels : NPIXLES = 1.0;
vec2 ScreenSize : VIEWPORTSIZE = {800,600};
scalar Glowness : GLOWNESS = 3.0;
scalar Cutoff : cutoff = 0.8;


struct APP2VS_Quad
{
vec2 Pos : POSITION0;
vec2 TexCoord0 : TEXCOORD0;
};

struct VS2PS_Quad
{
vec4 Pos : POSITION;
vec2 TexCoord0 : TEXCOORD0;
};

struct VS2PS_Quad2
{
vec4 Pos : POSITION;
vec2 TexCoord0 : TEXCOORD0;
vec2 TexCoord1 : TEXCOORD1;
};

struct PS2FB_Combine
{
vec4 Col0 : COLOR0;
};

VS2PS_Quad vsDx9_OneTexcoord(APP2VS_Quad indata)
{
VS2PS_Quad outdata;
outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
outdata.TexCoord0 = indata.TexCoord0;
return outdata;
}

VS2PS_Quad2 vsDx9_Tinnitus(APP2VS_Quad indata)
{
VS2PS_Quad2 outdata;
outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
outdata.TexCoord0 = indata.TexCoord0;
outdata.TexCoord1 = vec2(indata.TexCoord0.x - sampleoffset.x, indata.TexCoord0.y - sampleoffset.y);
return outdata;
}

PS2FB_Combine psDx9_Tinnitus(VS2PS_Quad2 indata)
{
PS2FB_Combine outdata;

vec4 sample0 = tex2D(sampler0bilin, indata.TexCoord1);
vec4 sample1 = tex2D(sampler1bilin, indata.TexCoord1);
vec4 sample2 = tex2D(sampler2bilin, indata.TexCoord1);
vec4 sample3 = tex2D(sampler3bilin, indata.TexCoord1);
vec4 backbuffer = tex2D(sampler4, indata.TexCoord0);

vec4 accum = sample0 * 0.5;
accum += sample1 * 0.25;
accum += sample2 * 0.125;
accum += sample3 * 0.0675;

accum = lerp(accum,backbuffer,backbufferLerpbias);
//accum.r += (0.25*(1-backbufferLerpbias));

outdata.Col0 = accum;

return outdata;
}

technique Tinnitus
{
pass opaque
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;

VertexShader = compile vs_1_1 vsDx9_Tinnitus();
//PixelShader = compile PS2_EXT psDx9_Tinnitus();
PixelShader = compile ps_1_4 psDx9_Tinnitus();
}
}


//PS2FB_Combine
vec4 psDx9_Soften(VS2PS_Quad2 indata):COLOR
{

vec4 sample0 = tex2D(sampler0bilin, indata.TexCoord0);
//vec4 sample1 = tex2D(sampler1bilin, indata.TexCoord0);
//vec4 sample2 = tex2D(sampler2bilin, indata.TexCoord0);
//vec4 sample3 = tex2D(sampler3bilin, indata.TexCoord0);
vec4 backbuffer = tex2D(sampler4, indata.TexCoord0);

//vec4 accum = sample0;*0.25;// + sample1*0.3;
//return sample0;



vec4 accum;// = lerp(sample3, sample2, 0.5);
//accum = lerp(accum, sample1, 0.5);
//accum = lerp(accum, sample0, 0.5);


//accum = accum + sample1*0.25;
//accum = accum + sample2*0.25;
//accum = accum + sample3*0.25;
//accum = accum + (accum - sample1)*0.5;
//accum = accum + (accum - sample2)*0.2;
//accum = accum + (accum - sample3)*0.1;
//accum = lerp(accum,backbuffer,0.7);
//return accum *0.7;
accum = saturate(backbuffer + sample0 * glowStrength);
//accum = lerp(backbuffer, sample0, 0.1);

//return sample0;
//return backbuffer;
return accum;//outdata;
}

struct VS2PS_ColorTransform
{
vec4 Pos : POSITION;
vec2 TexCoord0 : TEXCOORD0;
vec3 ColorTransformRow0 : TEXCOORD1;
vec3 ColorTransformRow1 : TEXCOORD2;
vec3 ColorTransformRow2 : TEXCOORD3;
vec3 ContrastPolynom : TEXCOORD4;
};


VS2PS_ColorTransform vsDx9_ColorTransform(VS2PS_ColorTransform indata)
{
VS2PS_ColorTransform outdata;
outdata.Pos = vec4(indata.Pos.x, indata.Pos.y, 0, 1);
outdata.TexCoord0 = indata.TexCoord0;
outdata.ColorTransformRow0 = colorTransformMat[0];
outdata.ColorTransformRow1 = colorTransformMat[1];
outdata.ColorTransformRow2 = colorTransformMat[2];
outdata.ContrastPolynom = contrastPolynom;
return outdata;
}

vec4 psDx9_ColorTransform14(VS2PS_ColorTransform indata):COLOR
{
float4 backbuffer = tex2D(sampler0bilinwrap,indata.TexCoord0);
vec3 accum = indata.ColorTransformRow0.xyz * backbuffer.r + indata.ColorTransformRow1.xyz * backbuffer.g + indata.ColorTransformRow2.xyz * backbuffer.b;
vec3 accum2 = accum * accum;
accum = indata.ContrastPolynom.r * accum + indata.ContrastPolynom.g * accum2 + indata.ContrastPolynom.b;
return float4(accum, backbuffer.a);
}

technique ColorTransform
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;

VertexShader = compile vs_1_1 vsDx9_ColorTransform();
PixelShader = compile ps_1_4 psDx9_ColorTransform14();

}
}


scalar time_0_X : FRACTIME;
scalar time_0_X_256 : FRACTIME256;
float sin_time_0_X : FRACSINE;

float interference : INTERFERENCE; // = 0.050000;
float distortionRoll : DISTORTIONROLL; // = 0.100000;
float distortionScale : DISTORTIONSCALE; // = 0.500000;
float distortionFreq : DISTORTIONFREQ; //= 0.500000;




vec4 psDx9_CameraEffect(VS2PS_ColorTransform indata):COLOR
{
float lerpFactor = tex2D(sampler1bilinwrap, indata.TexCoord0).r*0.5;
vec2 temp = (indata.TexCoord0 -0.5);
vec2 fisheyeTexCoord = ((indata.TexCoord0) - (temp*temp*temp)*lerpFactor);
float4 scanline = tex2D(sampler2wrap,vec2(indata.TexCoord0.x,(indata.TexCoord0.y-time_0_X)));

float4 backbuffer1 = tex2D(sampler0bilinwrap, vec2(indata.TexCoord0.x+scanline.r*0.03, indata.TexCoord0.y));
float4 backbuffer = tex2D(sampler0bilinwrap,vec2(fisheyeTexCoord.x+scanline.r*0.03, fisheyeTexCoord.y));

vec3 accum = indata.ColorTransformRow0.xyz * backbuffer.r + indata.ColorTransformRow1.xyz * backbuffer.g + indata.ColorTransformRow2.xyz * backbuffer.b;
vec3 accum2 = accum * accum;
accum = indata.ContrastPolynom.r * accum + indata.ContrastPolynom.g * accum2 + indata.ContrastPolynom.b;
return float4(accum, backbuffer.a);
}
technique CameraEffect
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;

VertexShader = compile vs_1_1 vsDx9_ColorTransform();
PixelShader = compile ps_2_0 psDx9_CameraEffect();
}
}

vec4 psDx9_EMP20(VS2PS_Quad2 indata):COLOR
{

//float4 text = tex2D(sampler1bilin, indata.TexCoord0)
float2 img = indata.TexCoord0;
float4 offset = tex2D(sampler1, vec2(0.0,frac(indata.TexCoord0.y*interference))) -0.5;//*time_0_X_256;
//img.y += time_0_X * interference;//frac(img.y + time_0_X);

//img.x += sin((1-img.y)*distortionFreq) * time_0_X * distortionScale;//
//img.x += sin((img.y));// * (-img.y);
//img.y = frac(img.y + distortionRoll * time_0_X);
img.x = frac(img.x + offset.r*distortionRoll);
//img.y = frac(img.y + offset.cool.gif;

float4 noise1 = tex2D(sampler1, frac(indata.TexCoord0*distortionScale* time_0_X_256));// + time);

float4 backbuffer = tex2D(sampler4bilinwrap, img);

vec3 accum = colorTransformMat[0].xyz * backbuffer.r + colorTransformMat[1].xyz * backbuffer.g + colorTransformMat[2].xyz * backbuffer.b;
//accum = max(accum, vec4(0.5,0.5,0.5,0.0));

//accum = saturate(accum*1.2);
noise1 -= 0.5;
noise1 = max(0.0, noise1.r *2.0);
accum -= noise1;
accum.r += noise1*0.3;
//accum -= 0.5;
//accum = max(accum, 0.0);
//accum = abs(accum) *2.0;
//noise1 = max(0.5, noise1.r);
//accum.g *= noise1;
//accum = lerp(accum, noise1, (1-noise1) * static_interference);

accum = contrastPolynom.r * accum + contrastPolynom.g * pow(accum, 2) + contrastPolynom.b;// * pow(accum, 3) + brighten;

return float4(accum, backbuffer.a);

}

technique Soften
{
pass opaque
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;


//TODO: Shouldn't use the Tinnitus vs. Could use a much simpler vs
VertexShader = compile vs_1_1 vsDx9_Tinnitus();
PixelShader = compile ps_1_4 psDx9_Soften();
}
}


technique EMP
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;

//TODO: Shouldn't use the Tinnitus vs. Could use a much simpler vs
VertexShader = compile vs_1_1 vsDx9_Tinnitus();
PixelShader = compile ps_2_0 psDx9_EMP20();
}
}



vec4 psDx9_Contrast(VS2PS_Quad2 indata):COLOR
{

//vec4 sample0 = tex2D(sampler0bilin, indata.TexCoord0);
float4 backbuffer = tex2D(sampler4, indata.TexCoord0);



//vec4 accum = sample0;

//accum = lerp(accum,backbuffer,0.7);

float sat = 0.0;
vec3 lumVec = vec3(0.3086, 0.6094, 0.0820);
float4x4 color = {1.0,0.0,0.0,0.0,
0.0,1.0,0.0,0.0,
0.0,0.0,1.0,0.0,
0.0,0.0,0.0,1.0};

/*float4x4 luminance = {0.3086,0.3086,0.3086,0.0,
0.6094,0.6094,0.6094,0.0,
0.0820,0.0820,0.0820,0.0,
0.0, 0.0, 0.0, 1.0};
*/
float invSat = 1.0 - sat;
/*float4x4 luminance = {invSat*lumVec.r + sat, invSat*lumVec.r, invSat*lumVec.r, 0.0,
invSat*lumVec.g, invSat*lumVec.g + sat, invSat*lumVec.g, 0.0,
invSat*lumVec.b + sat, invSat*lumVec.b, invSat*lumVec.b + sat, 0.0,
0.0, 0.0, 0.0, 1.0};
*/

float4x4 luminance2 = {invSat*lumVec.r + sat, invSat*lumVec.g, invSat*lumVec.b, 0.0,
invSat*lumVec.r, invSat*lumVec.g + sat, invSat*lumVec.b, 0.0,
invSat*lumVec.r, invSat*lumVec.g, invSat*lumVec.b + sat, 0.0,
0.0, 0.0, 0.0, 1.0};

//color = mul(luminance2, color);
/*
float roffset = 0.1;
float goffset = 0.1;
float boffset = 0.0;

float4x4 offset = {1.0,0.0,0.0,roffset,
0.0,1.0,0.0,goffset,
0.0,0.0,1.0,boffset,
0.0,0.0,0.0,1.0};
*/
//vec4 accum = mul(colorTransformMat,backbuffer);
//backbuffer.a = 1.0;
//accum = mul(offset, backbuffer);
vec4 accum = mul(luminance2, backbuffer);
accum -= 0.5;
accum = backbuffer + accum;
accum.r += 0.05;
accum = saturate(accum);
//vec4 accum = mul(offset, backbuffer);

//return vec4(0.0,0.0,0.0,1.0);
//return backbuffer;

return accum;//outdata;
}


technique Contrast
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;


//TODO: Shouldn't use the Tinnitus vs. Could use a much simpler vs
VertexShader = compile vs_1_1 vsDx9_Tinnitus();
PixelShader = compile ps_1_4 psDx9_Contrast();
}
}

vec4 psDx9_ThermopticCamouflage() :COLOR
{
return vec4(0.0,0.0,0.0,0.0);
}

technique ThermopticCamouflage
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;
VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
PixelShader = compile ps_1_4 psDx9_ThermopticCamouflage();

}
}

vec4 psDx9_Glow(VS2PS_Quad indata) : COLOR
{
return tex2D(sampler0bilin, indata.TexCoord0);
}

vec4 psDx9_GlowMaterial(VS2PS_Quad indata) : COLOR
{
vec4 diffuse = tex2D(sampler0bilin, indata.TexCoord0);
//return (1-diffuse.a);
// temporary test, should be removed
return glowStrength * /*diffuse + */vec4(diffuse.rgb*(1-diffuse.a),1);
}

technique GlowMaterial
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;
SrcBlend = SRCCOLOR;
DestBlend = ONE;


StencilEnable = TRUE;
StencilFunc = NOTEQUAL;
StencilRef = 0x80;
StencilMask = 0xFF;
StencilFail = KEEP;
StencilZFail = KEEP;
StencilPass = KEEP;



VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
PixelShader = compile ps_1_1 psDx9_GlowMaterial();
}
}




technique Glow
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = TRUE;
SrcBlend = SRCCOLOR;
DestBlend = ONE;


VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
PixelShader = compile ps_1_1 psDx9_Glow();
}
}

vec4 psDx9_Fog(VS2PS_Quad indata) : COLOR
{
vec3 wPos = tex2D(sampler0, indata.TexCoord0);
scalar uvCoord = saturate((wPos.zzzz-fogStartAndEnd.r)/fogStartAndEnd.g);//fogColorAndViewDistance.a);
return saturate(vec4(fogColor.rgb,uvCoord));
//vec2 fogcoords = vec2(uvCoord, 0.0);
return tex2D(sampler1, vec2(uvCoord, 0.0))*fogColor.rgbb;
}


technique Fog
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = TRUE;
//SrcBlend = SRCCOLOR;
//DestBlend = ZERO;
SrcBlend = SRCALPHA;
DestBlend = INVSRCALPHA;
//StencilEnable = FALSE;

StencilEnable = TRUE;
StencilFunc = NOTEQUAL;
StencilRef = 0x00;
StencilMask = 0xFF;
StencilFail = KEEP;
StencilZFail = KEEP;
StencilPass = KEEP;

VertexShader = compile vs_1_1 vsDx9_OneTexcoord();
PixelShader = compile ps_2_0 psDx9_Fog();
}
}

// TVEffect specific...

/*scalar time_0_X : FRACTIME;
scalar time_0_X_256 : FRACTIME256;
float sin_time_0_X : FRACSINE;

float interference : INTERFERENCE; // = 0.050000;
float distortionRoll : DISTORTIONROLL; // = 0.100000;
float distortionScale : DISTORTIONSCALE; // = 0.500000;
float distortionFreq : DISTORTIONFREQ; //= 0.500000;
*/
VS2PS_Quad2 vs_TVEffect( APP2VS_Quad indata )
{
VS2PS_Quad2 output;

// RenderMonkeyHACK Clean up inaccuracies
indata.Pos.xy = sign(indata.Pos.xy);

output.Pos = float4(indata.Pos.xy, 0, 1);
output.TexCoord0 = indata.Pos.xy;
output.TexCoord1 = indata.TexCoord0;

return output;
}

PS2FB_Combine ps_TVEffect20(VS2PS_Quad2 indata) {

PS2FB_Combine outdata;

float2 pos = indata.TexCoord0;
float2 img = indata.TexCoord1;

// Interference ... just a texture filled with rand()
float rand = tex2D(sampler2bilinwrap, float2(1.5 * pos) + time_0_X_256) - 0.2;

// Some signed noise for the distortion effect
float noisy = tex2D(sampler1bilinwrap, 0.5 * float2(0.5 * pos.y, 0.1 * time_0_X)) - 0.5;

// Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
float dst = frac(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
dst *= (1 - dst);
// Make sure distortion is highest in the center of the image
dst /= 1 + distortionScale * abs(pos.y);

// ... and finally distort
img.x += distortionScale * noisy * dst;
float4 image = /*float4(0.9, 1.1, 1.1, 0) * */dot(float3(0.3,0.59,0.11), tex2D(sampler0bilin, img));

// Combine frame, distorted image and interference
outdata.Col0 = interference * rand + image * 0.75 + 0.25;

return outdata;
}

PS2FB_Combine ps_TVEffect14(VS2PS_Quad2 indata) {

PS2FB_Combine outdata;

float2 pos = indata.TexCoord0;
float2 img = indata.TexCoord1;

// Interference ... just a texture filled with rand()
float rand = tex2D(sampler2bilinwrap, float2(1.5 * pos) + time_0_X_256) - 0.2;

// Some signed noise for the distortion effect
float noisy = tex2D(sampler1bilinwrap, 0.5 * float2(0.5 * pos.y, 0.1 * time_0_X)) - 0.5;
/*
// Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
float dst = frac(pos.y * distortionFreq + distortionRoll * sin_time_0_X);
dst *= (1 - dst);
// Make sure distortion is highest in the center of the image
dst /= 1 + distortionScale * abs(pos.y);

// ... and finally distort
img.x += distortionScale * noisy * dst;
*/
float4 image = dot(float3(0.3,0.59,0.11), tex2D(sampler0bilin, img));

// Combine frame, distorted image and interference
outdata.Col0 = interference * rand + image * 0.75 + 0.25;

return outdata;
}
technique TVEffect
{
pass p0
{
ZEnable = FALSE;
AlphaBlendEnable = FALSE;

StencilEnable = FALSE;

VertexShader = compile vs_1_1 vs_TVEffect();
#if PSVERSION >= 20
PixelShader = compile ps_2_0 ps_TVEffect20();
#else
PixelShader = compile ps_1_4 ps_TVEffect14();
#endif
}
}



This post has been edited by Phan2om: Jan 24 2012, 01:15 AM
Go to the top of the page
 
+Quote Post
jamesdneal
post Jan 25 2012, 03:18 PM
Post #10


Major
****

Group: Soldiers
Posts: 121
Joined: 1-December 10
From: Mocksville
Member No.: 7,743



definitely going to give this a go. Got a 1-on-1 sniper mod I've been working on and this will be an awesome addition


someone will need to re-upload BadSanta's shader...it was hosted at megaupload so link no workie computer.gif

This post has been edited by jamesdneal: Jan 25 2012, 03:25 PM


--------------------
Go to the top of the page
 
+Quote Post
dodek96_pl
post Feb 18 2012, 02:24 PM
Post #11


Captain
***

Group: Soldiers
Posts: 56
Joined: 13-March 10
From: Poland
Member No.: 7,342



Link fixed, enjoy!


--------------------
Realism Mod-v1.0 BETA ready,download ready! Moddb
Go to the top of the page
 
+Quote Post
frank_beans
post Feb 18 2012, 09:29 PM
Post #12


Master Sergeant
****

Group: Soldiers
Posts: 600
Joined: 9-February 07
From: CA, USA
Member No.: 3,008



i got the shader working, but it appears faster than the zoom animation. how can i delay it in order to match the animation?


--------------------
Go to the top of the page
 
+Quote Post
dodek96_pl
post Feb 19 2012, 01:57 AM
Post #13


Captain
***

Group: Soldiers
Posts: 56
Joined: 13-March 10
From: Poland
Member No.: 7,342



QUOTE (frank_beans @ Feb 18 2012, 10:29 PM) *
i got the shader working, but it appears faster than the zoom animation. how can i delay it in order to match the animation?

I don't know a possible way to do that, BadSanta wrote about it somewhere but I can't remember now and that would involve some work.


--------------------
Realism Mod-v1.0 BETA ready,download ready! Moddb
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd May 2013 - 04:00 PM