Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
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
2 registered members (AbrahamR, AndrewAMD), 1,278 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
Rate Thread
green bloomblur #290546
09/19/09 18:56
09/19/09 18:56
Joined: Jul 2005
Posts: 44
france
M
Mach Offline OP
Newbie
Mach  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 44
france
Hi !

I need help to modify a shader. Indeed, I use a modified pp_bloomblur effect in my game. It's work but I want to apply a green render to the view, like a night vision. But I don't know how to do this. I try a green transparent panel but it's not render like I want. Look this picture of cod4 , it's just the green effect I want to add:



Code:
Texture TargetMap;
sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear;	};

float4 vecViewPort;
float4 vecSkill1;

float4 postprocessing_bloomblur( float2 Tex : TEXCOORD0 ) : COLOR0 
{
	float facBlur = vecSkill1.x/20.;
   float4 Color = tex2D( g_samSrcColor, Tex.xy);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur*2);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur*3);
	return Color *2;
}

technique PostProcess 
{
	pass p1 
	{
		AlphaBlendEnable = false;
		VertexShader = null;
		PixelShader = compile ps_2_0 postprocessing_bloomblur();
	}
}




Leader "Mach Creation"
A7.80.1 Pro
Re: green bloomblur [Re: Mach] #290562
09/19/09 22:50
09/19/09 22:50
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline
Member
Enduriel  Offline
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
change all the Color to Color.g for green channel only and give the rest 0 like .r and .b and .a, I think this should do it

Last edited by Enduriel; 09/19/09 22:51.
Re: green bloomblur [Re: Enduriel] #290566
09/19/09 23:43
09/19/09 23:43
Joined: Nov 2004
Posts: 55
Michigan
S
splashmaker Offline
Junior Member
splashmaker  Offline
Junior Member
S

Joined: Nov 2004
Posts: 55
Michigan
Like Enduriel said, but in code form:

Code:
Color.g = (Color.r + Color.g + Color.b) / 3;
return(float4(0, Color.g, 0, 1));



Re: green bloomblur [Re: splashmaker] #290576
09/20/09 08:08
09/20/09 08:08
Joined: Jul 2005
Posts: 44
france
M
Mach Offline OP
Newbie
Mach  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 44
france
Thanks, It's work fine !

This is the shader code for the nightvision.fx if you want to use it :

Code:
Texture TargetMap;
sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear;	};

float4 vecViewPort;
float4 vecSkill1;

float4 postprocessing_nightvision( float2 Tex : TEXCOORD0 ) : COLOR0 
{
	float facBlur = vecSkill1.x/20.;
	float4 Color = tex2D( g_samSrcColor, Tex.xy);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur*2);
	Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw*facBlur*3);
	Color *=2;
	Color.g = (Color.r + Color.g + Color.b) / 3;
	return(float4(0, Color.g, 0, 1));
}

technique PostProcess 
{
	pass p1 
	{
		AlphaBlendEnable = false;
		VertexShader = null;
		PixelShader = compile ps_2_0 postprocessing_nightvision();
	}
}




Leader "Mach Creation"
A7.80.1 Pro

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