a bit diffrent toonshader

Posted By: Scorpion

a bit diffrent toonshader - 11/27/07 21:47



Ok, first it begins really boring...a toonshader, just a solid color and a boring outline.


but then i use a post processing shader to replace the colors by a tileable texture and so you will get that funny results.


hope u like it :]

PS: its also possible to combine normal parts with that crazy ones...you just have to take a color that is not replaced...so you can make some really nice effects with it

SORRY i forgot poison-byte! THANK you for the pattern!
Posted By: JibbSmart

Re: a bit diffrent toonshader - 11/27/07 21:57

nice. just yesterday i was thinking about doing the exact same thing (though i'm waiting for the next public beta before i dabble in pp effects, i have been writing down ideas).

my thoughts were to make a black-n-white cartoon effect that uses hatching and cross-hatching effect which is tiled in screen-space, just as your effect is.

julz
Posted By: achaziel

Re: a bit diffrent toonshader - 11/27/07 22:05

lol i'm sure spike is going to love it ^^
Posted By: Scorpion

Re: a bit diffrent toonshader - 11/27/07 22:15

@JulzMighty
but i was faster...

No really a black and white game would be also a good idea, could gove some very interesting results
Posted By: Pappenheimer

Re: a bit diffrent toonshader - 11/27/07 22:40

Can you combine it with entities with normal textures, too?
Or, with ventilator's lightmap?

Then, you could achieve this patchwork look of collage/mashup.
Posted By: Scorpion

Re: a bit diffrent toonshader - 11/27/07 22:48

normal textures, yes, but it is important that the parts, that will be textured are in one solid color, no shadows, also no guard shading
Posted By: ello

Re: a bit diffrent toonshader - 11/28/07 07:28

heya, but you could use another view where you only render a greyscaled lightingsituation and mix it over than...

and btw, nice toon approach
Posted By: Samb

Re: a bit diffrent toonshader - 11/28/07 07:48

ha! I love it!
even more spike could love it! (in your face, spike! )
and thats why I need it. NOW!!!!
Posted By: Scorpion

Re: a bit diffrent toonshader - 11/28/07 12:48

Got already some request to that shader and it's code.
I am working on getting it in an easy to use plug-and-play-script,then i will contribute it.

@ello
yes, ofc^^ and it's much easier with the new pp-system from[buy]A7[/buy]!! *makesomeadvertisement*
Posted By: frazzle

Re: a bit diffrent toonshader - 11/28/07 20:26

As said, the approach is different thus making it unique and it even look good too so great effort again

Cheers

Frazzle
Posted By: Pinkhead

Re: a bit diffrent toonshader - 11/29/07 19:37

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
Posted By: Scorpion

Re: a bit diffrent toonshader - 11/29/07 20:25

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 { }}


Posted By: Joey

Re: a bit diffrent toonshader - 11/29/07 21:48

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.
Posted By: Scorpion

Re: a bit diffrent toonshader - 11/30/07 07:54

hmm...maybe^^
you are right, i will do that...
thx
© 2023 lite-C Forums