|
|
[req]burst speed shader
#229628
09/29/08 07:29
09/29/08 07:29
|
mercuryus
OP
Unregistered
|
mercuryus
OP
Unregistered
|
Hi! This weekend I played EXCITE TRUCK (Wii) with a friend. ( btw. a VERY good made fun racing game!) There is a technique used to simulate a very fast speed of the trucks when the turbo is used: The objects/terrain/sky on the screen borders look like streched. Like a fisheye lense on the borders. I think it's made with a shader. Can someone help me with such a shader? I could use it for a pod race game I'm working on.
|
|
|
Re: [req]burst speed shader
[Re: ]
#229633
09/29/08 07:58
09/29/08 07:58
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
this looks like a simple radial blur masked by a radial gradient. http://www.earthcontrol.de/main.php?loc=...t&deep=ucfxdunno if i ever updated it to a7 edit: yes i'll create a new version this week
www.earthcontrol.dequoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
|
|
|
Re: [req]burst speed shader
[Re: ello]
#229651
09/29/08 10:43
09/29/08 10:43
|
mercuryus
OP
Unregistered
|
mercuryus
OP
Unregistered
|
Thats great! Can you make it "adjustable" like: - effecting start radius (lens bow), because the center of the view should be left "unshaded" - blur depth (effect strength) (for dynamic effect fade-in/out) Are panels effected by your shader also?  (that would be a pity) If I can use your shader with my project I'll send you a donation!
|
|
|
Re: [req]burst speed shader
[Re: ]
#229655
09/29/08 11:24
09/29/08 11:24
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Are panels effected by your shader also?  (that would be a pity) They aren´t if you don´t render them into camera.bmap. You could also check out my shadercollection as I also included a radial blur shader: http://www.coniserver.net/ubb7/ubbthreads.php?ubb=showflat&Number=207861But I guess as it is, it effects the center a little too much. I could change that easily but I think I shouldn´t as ello already offered his help 
Last edited by Slin; 09/29/08 11:27.
|
|
|
Re: [req]burst speed shader
[Re: ello]
#229657
09/29/08 11:47
09/29/08 11:47
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
no problem, slin. isnt there the metapher "the early bird catches the worm" ?
And you have been the early bird  Anyways I just had to give it a try and this is my result:  
Last edited by Slin; 09/29/08 11:47.
|
|
|
Re: [req]burst speed shader
[Re: ello]
#229661
09/29/08 13:11
09/29/08 13:11
|
mercuryus
OP
Unregistered
|
mercuryus
OP
Unregistered
|
hey! That's amazing! You're really fast man! Is it adjustable?
|
|
|
Re: [req]burst speed shader
[Re: ]
#229662
09/29/08 13:20
09/29/08 13:20
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
If you really want it, here is the code:
//////////////////////////////////////////////////
////////////Postprocessing Radial Blur////////////
//////////////////////////////////////////////////
////29.09.2008////////////////by Nils Daumann/////
/////////////slindev.wordpress.com////////////////
//////////////////////////////////////////////////
#define PP_SoftRadialBlur
//a radial blur shader
MATERIAL* PP_SoftRadialBlur_mat =
{
effect =
"
#define NUM_SAMPLES 20
//Variables
float4 vecViewPort;
float4 vecSkill1;
//Texture
texture TargetMap;
sampler2D ColorSampler = sampler_state { texture = <TargetMap>;};
//Pixelshader
float4 PS( float2 texCoord : TEXCOORD0 ) : COLOR0
{
float4 unblurredColor = tex2D(ColorSampler,texCoord);
float blendFactor = saturate(abs(texCoord - vecSkill1.xy)/vecSkill1.w);
float2 deltaTexCoord = (texCoord - vecSkill1.xy);
deltaTexCoord *= 1.0f / NUM_SAMPLES * vecSkill1.z;
float4 Color = 0;
for(int i = 0; i < NUM_SAMPLES; i++)
{
texCoord -= deltaTexCoord;
Color += tex2D(ColorSampler, texCoord);
}
Color /= NUM_SAMPLES;
Color = lerp(unblurredColor,Color,blendFactor);
Color.a = 1.0;
return Color;
}
technique Tech1
{
pass one
{
PixelShader = compile ps_2_0 PS();
}
}
";
}
//change the values of the shader
void PP_SoftRadialBlur_SetValues(var xPosition, var yPosition, var Density, var blendRadius)
{
PP_SoftRadialBlur_mat.skill1 = floatv(xPosition); //between 0 and 1
PP_SoftRadialBlur_mat.skill2 = floatv(yPosition); //between 0 and 1
PP_SoftRadialBlur_mat.skill3 = floatv(Density); //small, around 0.25
PP_SoftRadialBlur_mat.skill4 = floatv(blendRadius);//small, around 0.25
}
//starts the radial blur
void PP_SoftRadialBlur_init(VIEW* View, var xPosition, var yPosition, var Density, var blendRadius)
{
if(d3d_shaderversion >= 2020)
{
PP_SoftRadialBlur_SetValues(xPosition,yPosition,Density,blendRadius);
PP_Add(PP_SoftRadialBlur_mat,View,NULL);
}
}
//removes the effect
void PP_SoftRadialBlur_remove(VIEW* View)
{
//remove the stage
PP_Remove(PP_SoftRadialBlur_mat,View,NULL);
}
To use it, you also need my postprocessing helper file, located on the wikis script page and within my shaderpack.
|
|
|
Re: [req]burst speed shader
[Re: Slin]
#229663
09/29/08 13:24
09/29/08 13:24
|
mercuryus
OP
Unregistered
|
mercuryus
OP
Unregistered
|
Thanx a lot! Can't test it here (@work) but tonight I will. I'll be back...
|
|
|
|