Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, AndrewAMD), 14,749 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Better blur effect [Re: MrCode] #183444
02/15/08 08:19
02/15/08 08:19
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Happy Birthday Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
just imagine a raster.

and now imagine a circle in it..
now add all coordinates of the quads, which are in that circle to the array.

btw: a faster way to blur ist to blur h and v in diffrent passes...

Re: Better blur effect [Re: MrCode] #183445
02/16/08 18:56
02/16/08 18:56
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
I saw you using values close to 1.00
a thing is: 1.00 is the size of a whole image.
shader texture positions aren't counted in pixels, but floating point values from 0 to 1.
0 is the left, 0.5 the half, and 1 the right of the image.
your blurring taps are moved so far, that they are getting out of range, at least, they leave the original pixel.
for blurring, use values from 0 to 0.01 as someone said before


Check out the throwing game here: The throwing game
Re: Better blur effect [Re: Scorpion] #183446
02/18/08 08:18
02/18/08 08:18
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Quote:

a faster way to blur ist to blur h and v in diffrent passes




How would I do this? I mean, how would I go about setting the values? Would I use a parametric trig function (x(t)= sin([pixel's x coord (t)] y(t)= sin([pixel's y coord (t)]) to get the values I need for the array(s)?


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Better blur effect [Re: MrCode] #183447
02/18/08 14:03
02/18/08 14:03
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Happy Birthday Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
you are using pp! so you can use this two shaders (i wrote them for the bloom shader...)

Code:
MATERIAL* mtlBlurH =
{
effect = "
float4 vecViewPort;
float4 vecSkill1;
const int blurRadius = 5;//number of px

Texture TargetMap;
sampler2D smpSource = sampler_state{texture=<TargetMap>;};

float4 BlurHPS( float2 Tex: TEXCOORD0):COLOR0
{
float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw);
float2 tempTex;
tempTex.y = Tex.y;
for(int i=-blurRadius;i<=blurRadius;i++)
{
tempTex.x = Tex.x+i*vecSkill1;
Color += tex2D(smpSource,tempTex.xy-vecViewPort.zw);
}
return Color/(blurRadius*2+1);
}

technique Blackout { pass one { PixelShader = compile ps_2_0 BlurHPS();}}
technique fallback { pass one { } }";
}

MATERIAL* mtlBlurV =
{
effect = "
float4 vecViewPort;
float4 vecSkill1;
const int blurRadius = 5;//number of px

Texture TargetMap;
sampler2D smpSource = sampler_state{texture=<TargetMap>;};

float4 BlurVPS( float2 Tex: TEXCOORD0):COLOR0
{
float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw);
float2 tempTex;
tempTex.x = Tex.x;
for(int i=-blurRadius;i<=blurRadius;i++)
{
tempTex.y = Tex.y+i*vecSkill1.x;
Color += tex2D(smpSource,tempTex.xy-vecViewPort.zw);
}
return Color/(blurRadius*2+1);
}

technique Blackout { pass one { PixelShader = compile ps_2_0 BlurVPS();}}
technique fallback { pass one { } }";
}



Re: Better blur effect [Re: Scorpion] #183448
02/18/08 16:21
02/18/08 16:21
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline
User
BoH_Havoc  Offline
User

Joined: Jun 2004
Posts: 655
to your left
Before blurring you should also downsample the image to 1/4 of its original size. This way the shader is much faster and the result looks much more blurry.


Shade-C EVO Lite-C Shader Framework
Re: Better blur effect [Re: BoH_Havoc] #183449
02/18/08 16:26
02/18/08 16:26
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Quote:

Before blurring you should also downsample the image to 1/4 of its original size. This way the shader is much faster and the result looks much more blurry.



How do you do that?

Re: Better blur effect [Re: Slin] #183450
02/18/08 16:33
02/18/08 16:33
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline
User
BoH_Havoc  Offline
User

Joined: Jun 2004
Posts: 655
to your left
just render the scene to a bmap 1/4 of the screenresolution. This could look like this for example:

VIEW* s_view_blurRender = {bmap = "#256x192x32";}

If you want to use this blurred image with other shaders (for example a Depth of Field shader), don't forget to rescale it to its original size. You can do that in the shader. This could look like this:

float4 rescaledBlur = tex2D(blurMap,texcoord/4);

[edit] heh, just noticed, i downsample by 1/16, not 1/4. sorry, my fault ^^

Last edited by BoH_Havoc; 02/18/08 16:35.

Shade-C EVO Lite-C Shader Framework
Re: Better blur effect [Re: BoH_Havoc] #183451
02/18/08 16:36
02/18/08 16:36
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
o.O I always thought that it would just cut it out from the viewsize

Re: Better blur effect [Re: Slin] #183452
02/18/08 16:48
02/18/08 16:48
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline
User
BoH_Havoc  Offline
User

Joined: Jun 2004
Posts: 655
to your left
Well, it works for me, so i can say it definately does not get cut


Shade-C EVO Lite-C Shader Framework
Page 2 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1