1 registered members (7th_zorro),
1,390
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
pp bloom in gamestudio
#169215
11/24/07 13:44
11/24/07 13:44
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
OP
Serious User
|
OP
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
Here i wrote some post processing shaders, which become combined a bloom effect. 1. The normal screen is rendered 2. All Pixels are darker then a specific value become black 3.Vertical Blur 4.Horizontal Blur 3.The pixel value of this picture is now added to the orginal picture + some color corrections Hope you like it :] PS: that white thing is a unskinned goblet test model^^
|
|
|
Re: pp bloom in gamestudio
[Re: Endgegner]
#169218
11/24/07 15:19
11/24/07 15:19
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Nothing special, but looks good @Endgegner: I think that this is how bloom works. Just have a look at the wiki. I added a bloom shader there. It does everything in one stage which causes lower quality but makes it easier to use it without the latest beta version of A7.
|
|
|
Re: pp bloom in gamestudio
[Re: Slin]
#169219
11/24/07 15:24
11/24/07 15:24
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
OP
Serious User
|
OP
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
it's how "real" bloom works I tried out the new pp-feature with view of the latest A7-beta, so not everyone can really use that code Code:
BMAP* FirstScreen = "#1024x768x32";
var blurStrongness = 40; var blurRadius = 0.3; var blurAlpha = 40; var darken = 90; var greyOut = 90;
MATERIAL* mtlBlackout = { effect = " Texture TargetMap; sampler2D smpSource = sampler_state { texture = <TargetMap>; }; float4 vecViewPort; // contains viewport pixel size in zw components float4 vecSkill1; float4 BlackoutPS( float2 Tex : TEXCOORD0 ) : COLOR0 { float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw); if((Color.r+Color.g+Color.b)/3<vecSkill1.x) { Color.rgb = 0; } return Color; }
technique emboss { pass one { PixelShader = compile ps_2_0 BlackoutPS(); } } technique fallback { pass one { } }"; }
MATERIAL* mtlBlurH = { effect = " float4 vecViewPort; float4 vecSkill1; static 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; static 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 { } }"; }
MATERIAL* mtlAdd = { skin1 = FirstScreen; effect = " float4 vecViewPort; float4 vecSkill1; Texture TargetMap; Texture mtlSkin1; sampler2D smpSource = sampler_state{texture=<TargetMap>;}; sampler2D firstScreen = sampler_state{texture=<mtlSkin1>;}; float4 AddPS( float2 Tex: TEXCOORD0):COLOR0 { float4 Color = tex2D(firstScreen,Tex); Color += vecSkill1.x*tex2D(smpSource,Tex); return lerp(Color,(Color.r+Color.g+Color.b)/3,vecSkill1.z)*vecSkill1.y; } technique Blackout { pass one { PixelShader = compile ps_2_0 AddPS();}} technique fallback { pass one { } }"; }
VIEW* viewBlackout = { material = mtlBlackout; flags = PROCESS_TARGET; } VIEW* viewBlurH = { material = mtlBlurH; flags=PROCESS_TARGET;} VIEW* viewBlurV = { material = mtlBlurV; flags=PROCESS_TARGET;} VIEW* viewAdd = { material = mtlAdd; flags=PROCESS_TARGET;}
void controlBloomSettings() { camera.bmap = FirstScreen; camera.stage = viewBlackout; viewBlackout.stage = viewBlurH; viewBlurH.stage = viewBlurV; viewBlurV.stage = viewAdd; while(1) { mtlBlackout.skill1 = floatv((100-blurStrongness)/100); mtlBlurH.skill1 = floatv(blurRadius/100); mtlBlurV.skill1 = floatv(blurRadius/100); mtlAdd.skill1 = floatv(blurAlpha/100); mtlAdd.skill2 = floatv(darken/100); mtlAdd.skill3 = floatv((100-greyOut)/100); wait(1); } }
PS: I use vars, because only then the panel elements show right results...
|
|
|
Re: pp bloom in gamestudio
[Re: Scorpion]
#169220
11/24/07 15:57
11/24/07 15:57
|
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B
Expert
|
Expert
Joined: Feb 2006
Posts: 2,185
|
wow, this is a real bloom shader, finally someone made one, also, is it possible to convert this to a6 code?
- aka Manslayer101
|
|
|
Re: pp bloom in gamestudio
[Re: HeelX]
#169224
11/24/07 19:05
11/24/07 19:05
|
Joined: Mar 2006
Posts: 2,758 Antwerp,Belgium
frazzle
Expert
|
Expert
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
|
Interesting concept Shorpion This really encourages me to update asap to A7 commercial, but I'm waiting untill most issue are cleared out Cheers Frazzle
Antec® Case Intel® X58 Chipset Intel® i7 975 Quad Core 8 GB RAM DDR3 SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB NVIDIA® GeForce GTX 295 Memory 1795GB
|
|
|
|