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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,426 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 5 1 2 3 4 5
Re: pp bloom in gamestudio [Re: frazzle] #169225
11/24/07 22:54
11/24/07 22:54
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
just one (two-part) question:

why are the horizontal and vertical blurs done separately? wouldn't it be faster to use one less view and do them together?

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: pp bloom in gamestudio [Re: JibbSmart] #169226
11/24/07 23:39
11/24/07 23:39
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
no, it uses a lot less texture lookups...it's a little loss in quality, but a big benefit in speed.here is a nice site about it:
http://www.blackpawn.com/texts/blur/default.html

and i did a shader, that does it all in one pass, but the quality is worse. But this way you can use it in A6, too.

Code:
float4x4 matWorldViewProj;
float4 vecSkill1;
float4 vecSkill5;

texture entSkin1;

sampler2D colorMap = sampler_state{Texture=<entSkin1>;};

void bloomVS( in float4 pos :POSITION,
in float2 tex :TEXCOORD0,
out float4 oPos :POSITION,
out float2 oTex :TEXCOORD0)
{
oPos=mul(pos,matWorldViewProj);
oTex=tex;
}

float4 isBlack(uniform float4 lookup)
{
if((lookup.r+lookup.g+lookup.b)/3>vecSkill1.x)
{
return lookup;
}
else
{
return 0;
}
}

float4 bloomPS( in float2 texcrd :TEXCOORD0):COLOR
{
float4 Color = tex2D(colorMap,texcrd);
float4 Blurred = isBlack(Color);
Blurred += isBlack(tex2D(colorMap,texcrd+vecSkill1.y));
Blurred += isBlack(tex2D(colorMap,texcrd-vecSkill1.y));
Blurred += isBlack(tex2D(colorMap,texcrd+vecSkill1.y*2));
Blurred += isBlack(tex2D(colorMap,texcrd-vecSkill1.y*2));

//here you could add 4 more texlookups for the other "side" => looks better,worse performance
/*float2 tempCrd;
tempCrd.x = vecSkill1.y;
tempCrd.y = -vecSkill1.y;
Blurred += isBlack(tex2D(colorMap,texcrd+tempCrd));
tempCrd.x = -vecSkill1.y;
tempCrd.y = vecSkill1.y;
Blurred += isBlack(tex2D(colorMap,texcrd-tempCrd));
tempCrd.x = vecSkill1.y*2;
tempCrd.y = -vecSkill1.y*2;
Blurred += isBlack(tex2D(colorMap,texcrd+tempCrd));
tempCrd.x = -vecSkill1.y*2;
tempCrd.y = vecSkill1.y*2;
Blurred += isBlack(tex2D(colorMap,texcrd-tempCrd));*/

//here you can add as much texlookups as you want...

Blurred/=5;
Color += vecSkill1.z*Blurred;
Color=lerp(Color,(Color.r+Color.g+Color.b)/3,vecSkill5.x)*vecSkill1.w;
Color.w = 1;
return Color;//
}

technique bloom
{
pass p0
{
vertexShader = compile vs_1_0 bloomVS();
pixelShader = compile ps_2_0 bloomPS();
}
}



Have fun!

Re: pp bloom in gamestudio [Re: Scorpion] #169227
11/25/07 02:43
11/25/07 02:43
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline
User
BoH_Havoc  Offline
User

Joined: Jun 2004
Posts: 655
to your left
Quote:

why are the horizontal and vertical blurs done separately? wouldn't it be faster to use one less view and do them together?





First it would be kinda slow as Scorpion already mentioned.
Second you would get a "star-shaped" bloom effect and not a "circular" one as you aren't able to use the blurred scene again in the same pass and blur it again horizontally/vertically

Oh and btw you can do this in A6, but you have to use some workarounds. As you aren't able to use stages as in A7 beta, you have to render PPEed scene to a plane, put a view in front of that plane, render the plane through the view and use this rendertarget in the next step. It works, but you also get some kind of "bloom-motionblur" effect, as you need 3 frames to compute the whole bloom thing (brightpass,hblur,vblur+combine)... sooo.... go for A7


Shade-C EVO Lite-C Shader Framework
Re: pp bloom in gamestudio [Re: BoH_Havoc] #169228
11/25/07 03:52
11/25/07 03:52
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
okay cool.

and yeah, a7 rules.

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: pp bloom in gamestudio [Re: JibbSmart] #169229
11/25/07 13:43
11/25/07 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
Quote:

if((Color.r+Color.g+Color.b)/3<vecSkill1.x)
{
Color.rgb = 0;
}




I think you will get a better quality bloom if you just calculate the luminance instead of making dark parts black. You can calculate luminance like this:
float lum = dot(color, float3(0.299f, 0.587f, 0.114f);
return (float3)lum;

Then just blur it and blend with the original render like you already do.

Re: pp bloom in gamestudio [Re: Excessus] #169230
11/28/07 15:31
11/28/07 15:31
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
thank you, that really looks better :]

Re: pp bloom in gamestudio [Re: Scorpion] #169231
11/28/07 17:07
11/28/07 17:07
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline
Rabbit Developer
Inestical  Offline
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
also you should try to bloom only REAALLY white'n bright colours, since from the shots, it looks pretty bad, even though the effect is correctly rendered


"Yesterday was once today's tomorrow."
Re: pp bloom in gamestudio [Re: Inestical] #169232
11/28/07 18:24
11/28/07 18:24
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
You can control that by a value from 0-1 passed to the shader. So maybe I set it a bit too height in the shots...

Re: pp bloom in gamestudio [Re: Scorpion] #169233
11/28/07 22:53
11/28/07 22:53
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline
Rabbit Developer
Inestical  Offline
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
no, it's too low in the shots


"Yesterday was once today's tomorrow."
Re: pp bloom in gamestudio [Re: Inestical] #169234
11/29/07 11:59
11/29/07 11:59
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline
Member
Gumby22don  Offline
Member
G

Joined: Oct 2006
Posts: 175
That is cool. I wasn't going to comment, but it suddenly occured to me.

I've never touched shaders, but could this sort of thing be used in conjunction with the old "flame" effect that used to go around in the mid 90's? I imagine the right sort of algorithm would give a heat haze sort of effect.

Anyone remember what I'm talking about and think it would work?

Don
have a great day

Page 2 of 5 1 2 3 4 5

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