|
9 registered members (TipmyPip, alibaba, qin, Volkovstudio, VoroneTZ, alx, titanicpiano14, paulk, 1 invisible),
7,173
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: cartoon looking,
[Re: MoRRoW]
#285550
08/19/09 00:32
08/19/09 00:32
|
Joined: Aug 2007
Posts: 157 England
DeD
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 157
England
|
ok i made the fx file, i looked at some other shader files from the shader collection from au resources,
i made the toon.wdl file with the code below, but i save it as shader.wdl. (dont think the name matters here)
//Toon Shading with Outline material Toon_mat { effect = "Toon.fx"; }
function Toon_set_Value(r,g,b,threshold) { Toon_mat.skill1 = floatv(r); //4 looks okay Toon_mat.skill2 = floatv(g); //same as above Toon_mat.skill3 = floatv(b); //same as above Toon_mat.skill4 = floatv(threshold); //0.01 }
I then made the toon.fx file with this code.
////Makes Details invisible and the colors a bit more intensive, ////which gives the Level a toon like look this is combined with a sobel edge filter ////which causes some kind of outlining
float4 vecSkill1; //"Color Details" in xyz and threshold in w float4 vecViewPort;
Texture entSkin1; sampler2D smpSource = sampler_state { texture = <entSkin1>; };
float4 dirtyToonPS( float2 Tex : TEXCOORD0 ) : COLOR0 { half4 color = tex2D(smpSource,Tex.xy); color.r = round(color.r*vecSkill1.r)/vecSkill1.r; color.g = round(color.g*vecSkill1.g)/vecSkill1.g; color.b = round(color.b*vecSkill1.b)/vecSkill1.b; const float threshold = vecSkill1.w;
const int NUM = 9; const float2 c[NUM] = { float2(-0.0078125, 0.0078125), float2( 0.00 , 0.0078125), float2( 0.0078125, 0.0078125), float2(-0.0078125, 0.00 ), float2( 0.0, 0.0), float2( 0.0078125, 0.007 ), float2(-0.0078125,-0.0078125), float2( 0.00 , -0.0078125), float2( 0.0078125,-0.0078125), };
int i; float3 col[NUM]; for (i=0; i < NUM; i++) { col[i] = tex2D(smpSource, Tex.xy + 0.2*c[i]); } float3 rgb2lum = float3(0.30, 0.59, 0.11); float lum[NUM]; for (i = 0; i < NUM; i++) { lum[i] = dot(col[i].xyz, rgb2lum); } float x = lum[2]+ lum[8]+2*lum[5]-lum[0]-2*lum[3]-lum[6]; float y = lum[6]+2*lum[7]+ lum[8]-lum[0]-2*lum[1]-lum[2]; float edge =(x*x + y*y < threshold)? 1.0:0.0; color.rgb *= edge; return color; }
technique postFX { pass p1 { PixelShader = compile ps_2_0 dirtyToonPS(); } }
saved that as toon.fx
and then in my main script i included.... include <shader.wdl>;
but then when i had the pp_set(camera,Toon_mat); into my main function. i get a error... bad perameter unknown function.
another thing there is know cam, code in my main script. as im useing the car script template.
D.E.D
I use lite c
|
|
|
|
Entire Thread
|
cartoon looking,
|
DeD
|
08/18/09 20:01
|
Re: cartoon looking,
|
DeD
|
08/18/09 20:54
|
Re: cartoon looking,
|
MoRRoW
|
08/18/09 22:41
|
Re: cartoon looking,
|
DeD
|
08/18/09 22:47
|
Re: cartoon looking,
|
MoRRoW
|
08/18/09 23:03
|
Re: cartoon looking,
|
DeD
|
08/18/09 23:08
|
Re: cartoon looking,
|
DeD
|
08/18/09 23:21
|
Re: cartoon looking,
|
MoRRoW
|
08/18/09 23:57
|
Re: cartoon looking,
|
DeD
|
08/19/09 00:32
|
Re: cartoon looking,
|
MoRRoW
|
08/19/09 04:35
|
Re: cartoon looking,
|
DeD
|
08/19/09 06:08
|
Re: cartoon looking,
|
Cowabanga
|
08/19/09 11:49
|
Re: cartoon looking,
|
DeD
|
08/19/09 18:03
|
Re: cartoon looking,
|
DeD
|
08/19/09 18:08
|
Re: cartoon looking,
|
DeD
|
08/23/09 21:28
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|