Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 6 of 7 1 2 3 4 5 6 7
Re: 23 Post Processing Shaders for A6 Com/Pro [Re: Slin] #109920
04/07/07 13:59
04/07/07 13:59
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Quote:


Color = tex2D( postTex, Tex.xy);
// the entire screen get's rendered at it's normal position once
Color += tex2D( postTex, Tex.xy+0.001);
// the entire screen get's rendered again, but this time it's moved a little bit,
which causes a blur if done 2 or 3 or more times.

Color += tex2D( postTex, Tex.xy+0.003);
Color += tex2D( postTex, Tex.xy+0.005);
Color = Color / 3.5; // as you can count, the entire screen get's rendered 4 times,
if you divide it to 4, colors will be normal. However if you divide it through less than 4,
the multiplication of colors will be visible. Which causes the "some sort of bloom" effect.






If you don't want a blur at all, do as Slin suggests. However because you may want a tiny blur for a more 'bloom-like' result and because it gives a nice 'anti-aliasing' too, you could play with the values 0.001 , 0.003 and 0.005.

Code:
  
texture postTex1;

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

float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0 {

float4 Color;Color = tex2D( g_samSrcColor, Tex.xy);
Color += tex2D( g_samSrcColor, Tex.xy+0.001);
Color += tex2D( g_samSrcColor, Tex.xy+0.0011);
Color += tex2D( g_samSrcColor, Tex.xy+0.0012);
Color = Color / 2.5;
return Color;
}

technique PostProcess {
pass p1 {
VertexShader = null;
PixelShader = compile ps_2_0 MyShader();
}
}



This one for example has less blur, but higher overexposured 'gloominess'. The lower the 0.001 to 0.005 values, the less blur, it's the amount the entire screen get's shifted and rendered on top of the other rendered screens.

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: 23 Post Processing Shaders for A6 Com/Pro [Re: PHeMoX] #109921
04/07/07 14:24
04/07/07 14:24
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Code:
texture postTex1;

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

float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0 {
float4 Color;
Color = tex2D( postTex, Tex.xy);
Color += tex2D( postTex, Tex.xy+0.001);
Color += tex2D( postTex, Tex.xy+0.003);
Color += tex2D( postTex, Tex.xy+0.005);
Color = Color / 3.5;
return Color;
}

technique PostProcess {
pass p1 {
VertexShader = null;
PixelShader = compile ps_2_0 MyShader();
}
}


To put it simple: that is not a bloom shader.

A bloom shader should filter out the bright parts of the image, blur them and blend them back with the original scene. This just fetches 4 colors: the original pixel, and 3 pixels downright of it (moving away farther for each). Then it averages the color. It's just some weird kind of blur filter..

Re: 23 Post Processing Shaders for A6 Com/Pro [Re: Excessus] #109922
04/07/07 14:36
04/07/07 14:36
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Be my guest and rewrite it to a real bloom shader if you like, I would be very thankful -> I would learn even more about shaders or i could do some research myself or look at the code of Rhuarc. (I know this isn't a true bloom shader, as I said in my topic where I contributed these shaders, I think I'm referring to Rhuarc's bloom there, but it isn't as fast as this, actually when it comes to speed, that bloom is quite horrible. At my system it went from 400fps to 130-160fps with just the shader active.).

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: 23 Post Processing Shaders for A6 Com/Pro [Re: PHeMoX] #109923
04/07/07 14:49
04/07/07 14:49
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Yes I'll do that after my exams. I already have something lying around. The shader code is complete, but it requires you to render onto a view entity which I couldn't get aligned with the screen correctly.. Maybe I'll try it with a dll that renders it to a screen aligned quad. If you want I can send this to you.

Re: 23 Post Processing Shaders for A6 Com/Pro [Re: PHeMoX] #109924
04/07/07 15:15
04/07/07 15:15
Joined: Nov 2003
Posts: 1,659
San Francisco
JetpackMonkey Offline
Serious User
JetpackMonkey  Offline
Serious User

Joined: Nov 2003
Posts: 1,659
San Francisco
Thanks Phemox & Slin,

Both of those are a lot closer to what I am looking for. Slin, about using the Sylex Bloom-- I'm not sure why, but it just renders a black screen-- maybe I need Pro to use it?

By the way, I;d also really like that ATI tone mapping shader for something else, it's beautiful-- but too dark and saturated for my project.. would you mind helping brighten it up and reducing the saturation?



Code:

texture postTex1;
texture postTex2;

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

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


float4 main(float2 tc: TEXCOORD0) : COLOR{
float fExposureLevel= 3.0f; // FROM 2
float4 original = tex2D(originalImageSampler, tc);
float4 blur = tex2D(blurImageSampler, tc);
float4 color = lerp(original, blur, 0.3f);
tc -= 0.5f; // Put coordsin -1/2 to 1/2 range
// Square of distance from origin (center of screen)
float vignette = 1 -dot(tc, tc);
// Multiply by vignette to the fourth
color = color * vignette*vignette*vignette*vignette;//*vignette;
color *= fExposureLevel; // Apply simple exposure level
return pow(color, 1.95f); // Apply gamma and return FROM 1.95
}

// Just one pass:
technique PostProcess {
pass p1 {
VertexShader = null;
PixelShader = compile ps_2_0 main();
}
}


Thanks again!

Re: 23 Post Processing Shaders for A6 Com/Pro [Re: JetpackMonkey] #109925
04/07/07 20:37
04/07/07 20:37
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
For the Sylex Bloom, just call this from a function:

SLX3ViewRegister(20,"camera");//Register Camera

SLX3ViewSetPostProcessingEffect(20,0,SLX3_PPE_4XDOWNSAMPLE);
SLX3ViewSetPostProcessingEffect(20,1,SLX3_PPE_BRIGHTPASS);
SLX3ViewSetPostProcessingEffect(20,2,SLX3_PPE_HBLOOM);
SLX3ViewSetPostProcessingEffect(20,3,SLX3_PPE_VBLOOM);
SLX3ViewSetPostProcessingEffect(20,4,SLX3_PPE_COMBINE);
SLX3ViewSetPostProcessingEffect(20,5,0);
SLX3ViewSetPostProcessing(20,1);//activate Postprocessing for the view with ID 20

SLX3EffectSetValue(SLX3_PPE_HBLOOM,0,2);//2 is the horizontal bloom strenght
SLX3EffectSetValue(SLX3_PPE_VBLOOM,0,2);//2 is the vertical bloom strenght


Slin

Re: 23 Post Processing Shaders for A6 Com/Pro [Re: Slin] #109926
04/08/07 01:00
04/08/07 01:00
Joined: Nov 2003
Posts: 1,659
San Francisco
JetpackMonkey Offline
Serious User
JetpackMonkey  Offline
Serious User

Joined: Nov 2003
Posts: 1,659
San Francisco
hey works great! thanks, Slin!

:D:D:D:D

Re: 23 Post Processing Shaders for A6 Com/Pro [Re: Excessus] #109927
04/08/07 22:58
04/08/07 22:58
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Quote:

Yes I'll do that after my exams. I already have something lying around. The shader code is complete, but it requires you to render onto a view entity which I couldn't get aligned with the screen correctly.. Maybe I'll try it with a dll that renders it to a screen aligned quad. If you want I can send this to you.




That would be awesome! Please understand that my shader knowledge is quite limited eventhough I have experience with HLSL. The quad aligning might have to do with the x value of the view entity ... I'd definately like to take a look at it if it's possible, thanks in advance.

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: 23 Post Processing Shaders for A6 Com/Pro [Re: PHeMoX] #109928
04/11/07 11:49
04/11/07 11:49
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
just wanted to tell you guys that my provider finally set up my dsl line.
=> I can finally continue working on that shaders as i needed some ressources from teh_interwebz.
Hope to show you some results soon


Shade-C EVO Lite-C Shader Framework
Re: 23 Post Processing Shaders for A6 Com/Pro [Re: BoH_Havoc] #109929
04/11/07 23:46
04/11/07 23:46
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
Alright here we go:

a REAL Depth of Field shader which uses a depthmap and all that stuff for you guys :














Specials thanks to:
ello: for writing somewhere on the forums how to get the depth of a model through a vertex shader!
xXxGuitar511: for helping me out with my view-dependent-material-change-script-thingy!




Now the bad part: you get the script/shader not before tomorrow...i'm too tired to create a testlevel and write a few notes on how to use this shader. So bare with me a little longer

Goodnight


Shade-C EVO Lite-C Shader Framework
Page 6 of 7 1 2 3 4 5 6 7

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