Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (PeroPero), 788 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[Req] Shader Extraction #440493
04/26/14 18:21
04/26/14 18:21
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
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);
}



}


Last edited by DLively; 04/26/14 18:24.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: [Req] Shader Extraction [Re: DLively] #440494
04/26/14 18:27
04/26/14 18:27
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
It seems to "Glitch" if I use an effect, or if any transparency occurs.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: [Req] Shader Extraction [Re: DLively] #440495
04/26/14 18:27
04/26/14 18:27
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Remove the line
Code:
inPosition.xyz += inNormal/exten;


Last edited by Ch40zzC0d3r; 04/26/14 18:29.
Re: [Req] Shader Extraction [Re: Ch40zzC0d3r] #440497
04/26/14 18:34
04/26/14 18:34
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
No errors, but no fix frown

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


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: [Req] Shader Extraction [Re: DLively] #440498
04/26/14 18:45
04/26/14 18:45
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Thank you anyway, Got it laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: [Req] Shader Extraction [Re: DLively] #440504
04/27/14 01:18
04/27/14 01:18
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
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.


Re: [Req] Shader Extraction [Re: Emre] #440507
04/27/14 06:24
04/27/14 06:24
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Ah, I see laugh Thank you for that fine demonstration, Emre!


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: [Req] Shader Extraction [Re: DLively] #440517
04/27/14 12:39
04/27/14 12:39
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
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.


POTATO-MAN saves the day! - Random
Re: [Req] Shader Extraction [Re: Kartoffel] #440525
04/27/14 14:06
04/27/14 14:06
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Yeah I just used an entirely different shader. Thanks laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: [Req] Shader Extraction [Re: DLively] #440746
04/30/14 23:14
04/30/14 23:14
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
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...

Page 1 of 2 1 2

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