|
0 registered members (),
938
guests, and 4
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Is there a REAL Blur shader?
#43176
03/23/05 00:36
03/23/05 00:36
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
I ask this bcz hunting around within the hallowed walls of this forum the only Blur shader reference I could find was actually not a shader and just a camera alpha trick.
I tried this method and the results can be seen, HERE this ref posted started out as something completely different, but at the end are some screens of the blur effect implemented according to camera alpha trick.
Now it looks good, but objects are clearly transparent and show objects behind them bcz of the camera alpha. I tried overlaying different views to see if I could compensate for this, but now I realise that simply setting the alpha on the view allows the view behind (nothing) to show, and when there is nothing you get trails...so although on the outset it appears to create the effect, it is next to useless in terms of using in a title...
So I am looking for some kind of shader that I could apply to create a blur effect, much like the one seen in N4Speed. I hope you guys can shed some light on this for me... 
The Art of Conversation is dead : Discuss
|
|
|
Re: Is there a REAL Blur shader?
[Re: indiGLOW]
#43177
03/23/05 04:44
03/23/05 04:44
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
mister mister... better search another time. there are many blur shaders here. look out blur, bloom and this stuff.. however. here you have a pixelshader for a radial (speedymotion) blur: Code:
float4 noiseps2( float2 texCoord: TEXCOORD0, uniform float cf1, uniform float cf2, uniform float cf3, uniform float alpha ) : COLOR { float4 base=tex2D(basemap,texCoord); float4 result=float4(0,0,0,0); for(float i=0;i<5;i++) { result+=tex2D(basemap,texCoord-texCoord*(i/100)-i/200); } return (result+1-base)/(7+2*sin(vecTime.w/2300)); } the basemap contains the rendered view. you can change the value (i used 5) for the float i loop. depends how fast you want it. you can add different passes with different offsets to create more blur. look out for "poisson" in context with blur. but i think that stuff already is somewhere here. also check out my page - there must be some usefull ressources for you. good luck:)
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: Is there a REAL Blur shader?
[Re: ello]
#43178
03/23/05 19:43
03/23/05 19:43
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Ok Ello, I stand corrected! I expanded my search dates and found more posts that mention blur shaders etc, but the only one that I felt had anything conclusive was infact the one that you posted, with some screens of the work you have clearly already done in this field! - So it seems the person I need to speak to and brain that i need to rape, is yours! lol
Considering I have already been speaking to you on PM this post is now rather redundant, but it did give me reason to actually explore and download some content from your site, which I am still looking at and trying to get as much info as possible. So not a complete waste of a post, although a little egg on my face with the searching. In all honesty what i did find, excluding your post, was not a lot of use to me, and seemed to be mostly people asking how to do it...
Maybe with a little help from you I could get the effect I am looking for and then share it here for everyone. Thanks for the help so far Ello, as always your help and guidance is appreciated.
oh and I just realised I didn't say "I have no idea how to use that code you posted, being a real shader noob", sry 
Last edited by indiGLOW; 03/23/05 19:47.
The Art of Conversation is dead : Discuss
|
|
|
Re: Is there a REAL Blur shader?
[Re: ello]
#43180
03/23/05 23:41
03/23/05 23:41
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Well if I found the correct thread that you imply, it seems unconclusive, I simply dont understand where the code here & there are meant to go, how to use them. I struggle enough when I see a complete shader and have had mixed results applying them... certainly couldnt write one...... I guess these shader things are just out of my depth and I am sure most other people here maybe just look at the code you example, and know how to use it, unfortunatly I am not among those people  Thanks for your help anyway
The Art of Conversation is dead : Discuss
|
|
|
Re: Is there a REAL Blur shader?
[Re: indiGLOW]
#43181
03/24/05 00:21
03/24/05 00:21
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
well, since matt used the same name ("basemap") you can just copy and paste it (replace old pixelshader) to your current fx-file.. look here: Code:
float4x4 matWorldViewProj; float4 vecTime;
struct VS_OUTPUT { float4 Pos: POSITION; float2 texCoord: TEXCOORD0; };
VS_OUTPUT mainVS(float4 Pos: POSITION, float2 iTPos : TEXCOORD0) { VS_OUTPUT Out; // Clean up inaccuracies Pos.xy = sign(Pos.xy); Out.Pos = float4(Pos.xy, 0, 1); Out.texCoord = float2(Pos.x,-Pos.y)*0.5-0.5; return Out; }
texture entSkin1;
sampler basemap = sampler_state { Texture = (entSkin1); ADDRESSU = WRAP; ADDRESSV = WRAP; ADDRESSW = WRAP; MAGFILTER = LINEAR; MINFILTER = LINEAR; MIPFILTER = LINEAR; };
float4 mainPS(float2 Tex: TEXCOORD0) : COLOR {
float4 Color=0; float4 darken={0.025,0.025,0.025,1}; float2 tap1 = {Tex.x+0.008,Tex.y-0.008}; float2 tap2 = {Tex.x-0.008,Tex.y+0.008}; float2 tap3 = {Tex.x+0.008,Tex.y+0.008}; float2 tap4 = {Tex.x-0.008,Tex.y-0.008}; float2 tap5 = {Tex.x+0.008,Tex.y}; float2 tap6 = {Tex.x-0.008,Tex.y}; float2 tap7 = {Tex.x,Tex.y+0.008}; float2 tap8 = {Tex.x,Tex.y-0.008}; float2 tap9 = {Tex.x+0.016,Tex.y-0.016}; float2 tap10 = {Tex.x-0.016,Tex.y+0.016}; float2 tap11 = {Tex.x+0.016,Tex.y+0.016}; float2 tap12 = {Tex.x-0.016,Tex.y-0.016}; float2 tap13 = {Tex.x+0.016,Tex.y}; float2 tap14 = {Tex.x-0.016,Tex.y}; float2 tap15 = {Tex.x,Tex.y+0.016}; float2 tap16 = {Tex.x,Tex.y-0.016}; float2 tap17 = {Tex.x+0.032,Tex.y-0.032}; float2 tap18 = {Tex.x-0.032,Tex.y+0.032}; float2 tap19 = {Tex.x+0.032,Tex.y+0.032}; float2 tap20 = {Tex.x-0.032,Tex.y-0.032}; float2 tap21 = {Tex.x+0.032,Tex.y}; float2 tap22 = {Tex.x-0.032,Tex.y}; float2 tap23 = {Tex.x,Tex.y+0.032}; float2 tap24 = {Tex.x,Tex.y-0.032}; Color = tex2D( basemap, Tex.xy);
Color += tex2D( basemap, tap1); Color += tex2D( basemap, tap2); Color += tex2D( basemap, tap3); Color += tex2D( basemap, tap4); Color += tex2D( basemap, tap5); Color += tex2D( basemap, tap6); Color += tex2D( basemap, tap7); Color += tex2D( basemap, tap8); Color += tex2D( basemap, tap9); Color += tex2D( basemap, tap10); Color += tex2D( basemap, tap11); Color += tex2D( basemap, tap12); Color += tex2D( basemap, tap13); Color += tex2D( basemap, tap14); Color += tex2D( basemap, tap15); Color += tex2D( basemap, tap16); Color += tex2D( basemap, tap17); Color += tex2D( basemap, tap18); Color += tex2D( basemap, tap19); Color += tex2D( basemap, tap20); Color += tex2D( basemap, tap21); Color += tex2D( basemap, tap22); Color += tex2D( basemap, tap23); Color += tex2D( basemap, tap24); return ((Color)*darken)*0.5; } technique simpleBlur { pass noiseps2 { ZENABLE = TRUE; CullMode=0; VertexShader = compile vs_2_0 mainVS(); PixelShader = compile ps_2_0 mainPS(); } } all you need to do is to include this fx-file into a material: Code:
material mat_blur { effect="howdidyounameyourfxfile.fx"; }
and apply this to a quad.mdl for example and if you dont have a gforce5700 then you should probably get the blur you want
|
|
|
Re: Is there a REAL Blur shader?
[Re: Christoph_B]
#43183
03/24/05 03:10
03/24/05 03:10
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Ok Ello I will do as you say and report back, according to info I have read it looks like my 9800Pro should support pixelshader 2, so if its used (and I would have no idea if it is) it should work... Many thanks Ello 
The Art of Conversation is dead : Discuss
|
|
|
Re: Is there a REAL Blur shader?
[Re: indiGLOW]
#43184
03/24/05 03:39
03/24/05 03:39
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Ok with all that done, and assigned to one model in the scene, I just get a black screen now, game does not appear to play.
I am running Dx9.0c with the latest Ati Radeon 9800Pro 128Mb catalyst drivers, according to spec these shaders should run... well as I understand it, any ideas?
The Art of Conversation is dead : Discuss
|
|
|
|