[Req] Shader Extraction

Posted By: DLively

[Req] Shader Extraction - 04/26/14 18:21

Hi, I was wondering if anyone who is familiar with shaders could have a look at this old blur shader and extract the coloring out. When I use it this shader, the models tend to either be a nice dark contrasty color, or flash white depending on certain variables I've yet to note.

I dont need the blur part of it - I just like the color effect it gives off... so if anyone could extract that for me, it would be appreciated laugh

Code:
texture entSkin1;
float4x4 matWorldViewProj;

sampler basemap = sampler_state
{
Texture = <entSkin1>;
};

void blur1VS(
uniform float exten,
in float4 inNormal : NORMAL0,
in float4 inPosition : POSITION0,
in float4 inTexcoord : TEXCOORD0,

out float4 outPosition : POSITION0,
out float4 outTexcoord : TEXCOORD0)
{
inPosition.xyz += inNormal/exten;
outTexcoord = inTexcoord;
outPosition = mul(inPosition, matWorldViewProj);
}

void blur1PS (
uniform float alpha,
in float4 inTexcoord : TEXCOORD0,
out float4 outColor : COLOR0)
{

outColor = tex2D(basemap, inTexcoord.xy);
outColor.a=alpha;

}



void mainVS(
in float4 inNormal : NORMAL0,
in float4 inPosition : POSITION0,
in float4 inTexcoord : TEXCOORD0,

out float4 outPosition : POSITION0,
out float4 outTexcoord : TEXCOORD0)
{
outTexcoord = inTexcoord;
outPosition = mul(inPosition, matWorldViewProj);
}

void mainPS(in float4 inTexcoord : TEXCOORD0, out float4 outColor : COLOR0) {
outColor = tex2D(basemap, inTexcoord.xy);
outColor.a=1;
}

technique t1 {
pass p0 {
ZENABLE = TRUE;
zwriteenable=true;

AlphaBlendEnable = true;
VertexShader = compile vs_1_1 mainVS();
PixelShader = compile ps_2_0 mainPS();
}
pass p1 {
ZENABLE = TRUE;
zwriteenable=true;

AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(10);
PixelShader = compile ps_2_0 blur1PS(0.9);
}
pass p2 {
zwriteenable=true;

ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(8);
PixelShader = compile ps_2_0 blur1PS(0.9);
}
pass p3 {
zwriteenable=true;

ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(7);
PixelShader = compile ps_2_0 blur1PS(0.7);
}
pass p4 {
zwriteenable=true;

AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(6);
PixelShader = compile ps_2_0 blur1PS(0.7);
}
pass p5 {
zwriteenable=true;

ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(5);
PixelShader = compile ps_2_0 blur1PS(0.5);
}
pass p6 {
zwriteenable=true;

ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(4);
PixelShader = compile ps_2_0 blur1PS(0.5);
}
pass p7 {
zwriteenable=true;

ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(3);
PixelShader = compile ps_2_0 blur1PS(0.3);
}
pass p8 {
zwriteenable=true;
zwriteenable=true;

ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(2);
PixelShader = compile ps_2_0 blur1PS(0.3);
}
pass p9 {
zwriteenable=true;
ZENABLE = TRUE;
AlphaBlendEnable = true;
VertexShader = compile vs_1_1 blur1VS(1);
PixelShader = compile ps_2_0 blur1PS(0.1);
}



}

Posted By: DLively

Re: [Req] Shader Extraction - 04/26/14 18:27

It seems to "Glitch" if I use an effect, or if any transparency occurs.
Posted By: Ch40zzC0d3r

Re: [Req] Shader Extraction - 04/26/14 18:27

Remove the line
Code:
inPosition.xyz += inNormal/exten;

Posted By: DLively

Re: [Req] Shader Extraction - 04/26/14 18:34

No errors, but no fix frown

I guess it doesn't matter if there are effects or not. It just happens :?
Posted By: DLively

Re: [Req] Shader Extraction - 04/26/14 18:45

Thank you anyway, Got it laugh
Posted By: Emre

Re: [Req] Shader Extraction - 04/27/14 01:18

Originally Posted By: DLively

I guess it doesn't matter if there are effects or not. It just happens :?

Yes exactly. It's just simple blur shader.



if you remove the line as Ch40zzC0d3r said, blur will be gone, nothing will happen about color.

Posted By: DLively

Re: [Req] Shader Extraction - 04/27/14 06:24

Ah, I see laugh Thank you for that fine demonstration, Emre!
Posted By: Kartoffel

Re: [Req] Shader Extraction - 04/27/14 12:39

you should also remove all passes except for one.
if not you're rendering all the geometry multiple times.

edit: didn't test it but try this:

Code:
const texture entSkin1;
const float4x4 matWorldViewProj;

sampler2D basemap = sampler_state
{
	Texture = <entSkin1>;
	
	AddressU = Wrap;
	AddressV = Wrap;
};

void mainVS(
	in float4 inNormal : NORMAL0,
	in float4 inPosition : POSITION0,
	in float4 inTexcoord : TEXCOORD0,
	
	out float4 outPosition : POSITION0,
	out float4 outTexcoord : TEXCOORD0)
{
	outTexcoord = inTexcoord;
	outPosition = mul(inPosition, matWorldViewProj);
}

void mainPS(in float4 inTexcoord : TEXCOORD0, out float4 outColor : COLOR0)
{
	outColor = tex2D(basemap, inTexcoord.xy);
}

technique t1
{
	pass p0
	{
		zEnable = True;
		zWriteEnable = True;
		AlphaBlendEnable = True;
		VertexShader = compile vs_3_0 mainVS();
		PixelShader = compile ps_3_0 mainPS();
	}
}



one thing I should say is that this shader does no lighting calculations at all.
It just outputs the texture color as it is.
Posted By: DLively

Re: [Req] Shader Extraction - 04/27/14 14:06

Yeah I just used an entirely different shader. Thanks laugh
Posted By: lostclimate

Re: [Req] Shader Extraction - 04/30/14 23:14

Lol... Is this the really old crappy model version I put on the wiki a long time ago? If so...there are a lot better ways to do this now...
Posted By: DLively

Re: [Req] Shader Extraction - 05/03/14 13:34

Yeah, I had just started looking around and couldnt find anything to my liking - When I tried this shader for the first time it gltiched out and colored my models nicely... I wanted the color at that point.
Posted By: Hummel

Re: [Req] Shader Extraction - 05/06/14 22:53

Wow, this shader is so GameStudio! (Don't use it. grin )
Posted By: Kartoffel

Re: [Req] Shader Extraction - 05/07/14 04:48

ot: @^ haha, I laughed too hard about this :'D
© 2024 lite-C Forums