Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,459 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: a bit diffrent toonshader [Re: frazzle] #169819
11/29/07 19:37
11/29/07 19:37
Joined: Jan 2007
Posts: 126
Germany
Pinkhead Offline
Member
Pinkhead  Offline
Member

Joined: Jan 2007
Posts: 126
Germany
You are my hero! But i whould be nice, to have the code or a downloadable version, or you going to use the shaders for you own?

M.G


I'm 14, NOW! RollingStone Fullversion Rolling Stone won by u19! -> German - Winnerlist
Re: a bit diffrent toonshader [Re: Pinkhead] #169820
11/29/07 20:25
11/29/07 20:25
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
NO, I will never share the code MUHAHAHAHAHAHA!

...

ofc you can have it
this is the shadercode, assign it to a view material and set it to camera stage.
If you don't have the beta, you have to rewrite it to get it on a screen-aligned-quad

Code:
float4 vecViewPort; // contains viewport pixel size in zw components
float4 vecSkill1;

const float4 replaceColor1 = {0.5,0.5,0.5,1.0};
const float4 replaceColor2 = {1.0,0.0,0.0,1.0};
const float4 replaceColor3 = {0.0,1.0,0.0,1.0};
const float4 replaceColor4 = {0.0,0.0,1.0,1.0};
const float aberration = 0.1;

Texture TargetMap;
Texture mtlSkin1;
Texture mtlSkin2;
Texture mtlSkin3;
Texture mtlSkin4;

sampler2D smpSource = sampler_state { texture = <TargetMap>; };
sampler2D pattern1 = sampler_state { texture = <mtlSkin1>; AddressU=Wrap; AddressV=Wrap;};
sampler2D pattern2 = sampler_state { texture = <mtlSkin2>; AddressU=Wrap; AddressV=Wrap;};
sampler2D pattern3 = sampler_state { texture = <mtlSkin3>; AddressU=Wrap; AddressV=Wrap;};
sampler2D pattern4 = sampler_state { texture = <mtlSkin4>; AddressU=Wrap; AddressV=Wrap;};

float compare(float4 Color1,float4 Color2)
{
return(abs(Color1.r-Color2.r)+abs(Color1.g-Color2.g)+abs(Color1.b-Color2.b));
}

float4 replacePS(float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw);
if(compare(Color,replaceColor1)<aberration)
return tex2D(pattern1,Tex.xy*(vecViewPort.xy/vecSkill1.x));
else if(compare(Color,replaceColor2)<aberration)
return tex2D(pattern2,Tex.xy*(vecViewPort.xy/vecSkill1.y));
else if(compare(Color,replaceColor3)<aberration)
return tex2D(pattern3,Tex.xy*(vecViewPort.xy/vecSkill1.z));
else if(compare(Color,replaceColor4)<aberration)
return tex2D(pattern4,Tex.xy*(vecViewPort.xy/vecSkill1.w));
else
return Color;
}

technique replace {pass one{PixelShader = compile ps_2_0 replacePS();}}
technique fallback {pass one { }}



Re: a bit diffrent toonshader [Re: Scorpion] #169821
11/29/07 21:48
11/29/07 21:48
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
that works faster if you just project the texture in view space upon the model instead of first coloring it and later on replacing the color. then you can have the texture stored in the model file and don't need to store it in your script.

Re: a bit diffrent toonshader [Re: Joey] #169822
11/30/07 07:54
11/30/07 07:54
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
hmm...maybe^^
you are right, i will do that...
thx

Page 2 of 2 1 2

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