Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AemStones, AndrewAMD, gamers, Kingware), 1,679 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Better blur effect #183434
02/12/08 09:53
02/12/08 09:53
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I'm currently messing with the "complex_blur" PP effect from the Post-Processing Collection, and I can't figure out the equation(s?) behind this array:

Code:

float2 samples[12]
= {
-0.326212, -0.405805,
-0.840144, -0.073580,
-0.695914, 0.457137,
-0.203345, 0.620716,
0.962340, -0.194983,
0.473434, -0.480026,
0.519456, 0.767022,
0.185461, -0.893124,
0.507431, 0.064425,
0.896420, 0.412458,
-0.321940, -0.932615,
-0.791559, -0.597705
};



I hope I'm not doing anything wrong if I do add on to this array (make the array larger (add more numbers), make a smoother blur effect in theory, if I understand the code correctly), but if I'm not, then could someone clue me in on how this works? I've tried all 6 (inverse) trig functions on the numbers, and I'm not seeing a pattern.


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

Joined: Jan 2007
Posts: 1,619
Germany
that gives the positions to the other pixels sourunding the current pixel to lerp with.

Because the coordinates of the image are in the range from 0-1 that are really small numbers. To get a bigger (NOT BETTER!) blur, just multiplicate the used array with a value bigger then 1.

Re: Better blur effect [Re: Scorpion] #183436
02/12/08 13:43
02/12/08 13:43
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
I don't know that shader, but maybe it is a gaussian blur?

Re: Better blur effect [Re: Excessus] #183437
02/13/08 03:15
02/13/08 03:15
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I'm guessing that's it (the Wikipedia link), but the math's way above my level. I guess I can't add any more "layers", as it were, to the effect.

Unless there's a way I could use a special kind of graphing calculator to do it...?


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

Joined: Jan 2007
Posts: 1,619
Germany
you won't get too much passes at least in ps_2_0...so why not just use that blur technique a few times more?

Re: Better blur effect [Re: Scorpion] #183439
02/14/08 06:01
02/14/08 06:01
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Adding more passes doesn't do any good (in fact it just makes it real slow). I suppose I should probably just post the rest of the code, to help clear things up:

Code:

texture entSkin1;

sampler postTex = sampler_state
{
texture = (entSkin1);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};

float4 Blur_PS(float2 texCoord: TEXCOORD0) : COLOR
{
float4 color;

color = tex2D(postTex, texCoord);

for (int i = 0; i < 12; i++)
{
color += tex2D(postTex, texCoord + 0.00625 * samples[i]);
}

return color / 13;
}

technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_2_0 Blur_PS();
}
}

technique tech_01
{
pass pass_00
{
Texture[0] = <entSkin1>;
}
}




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

Joined: Jan 2007
Posts: 1,619
Germany
so as I told you before just change the factor for the positions..make the 0.00625 bigger... as example to 0.01 or something...

Re: Better blur effect [Re: Scorpion] #183441
02/14/08 23:49
02/14/08 23:49
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
That just makes a bigger blur factor, not a clearer blur. What I want is a clearer blur. I guess I could create another array that is equivalent to 1.5X the first array and then multiply the first array by this other array in the for loop ((samples[ i ] * samples2[ i ])) to get more "passes" (even though these aren't really other passes).


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Better blur effect [Re: MrCode] #183442
02/15/08 03:12
02/15/08 03:12
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
...you could increase the size of the first array and add more random offsets of vector length 1.


Quote:

...clearer blur.



...

Last edited by xXxGuitar511; 02/15/08 03:12.

xXxGuitar511
- Programmer
Re: Better blur effect [Re: xXxGuitar511] #183443
02/15/08 04:13
02/15/08 04:13
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline OP
User
MrCode  Offline OP
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
(ignoring the oxymoron "clearer blur"...)

So, I take it I could just add random numbers to the array, and it wouldn't look strange? Because when the for loop is executed, I think it multiplies the sample pixel's distance by the number you specify (in this case 0.00625).


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | 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