3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
cartoon looking,
#285504
08/18/09 20:01
08/18/09 20:01
|
Joined: Aug 2007
Posts: 157 England
DeD
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 157
England
|
hi whats the best way to make a levle look cartoon. i mean what kind of texturs an shaders would you recomend.
D.E.D
I use lite c
|
|
|
Re: cartoon looking,
[Re: DeD]
#285522
08/18/09 20:54
08/18/09 20:54
|
Joined: Aug 2007
Posts: 157 England
DeD
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 157
England
|
i waas reading about the toon shader in another post, but when i add the mtl.wdl to my script, the toon shader is not in the list of actions.
can you help me?
D.E.D
I use lite c
|
|
|
Re: cartoon looking,
[Re: MoRRoW]
#285534
08/18/09 22:47
08/18/09 22:47
|
Joined: Aug 2007
Posts: 157 England
DeD
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 157
England
|
ok i look at that page, how do i use that code in my project?
D.E.D
I use lite c
|
|
|
Re: cartoon looking,
[Re: DeD]
#285537
08/18/09 23:03
08/18/09 23:03
|
Joined: Jun 2009
Posts: 44 NRW,Germany
MoRRoW
Newbie
|
Newbie
Joined: Jun 2009
Posts: 44
NRW,Germany
|
After you created the toon.fx you have to #include it into your project,and because it is an post-process shader i think you want to add it to your camera, so you have to add the following to your main function function main() { pp_set(camera,Toon_mat); .... } Iīm not an expert in this Task but for me it works.
Itīs late and i have to work tomorrow so Iīm away.Play around a little bit.Will look for this thread tomorrow.
Last edited by MoRRoW; 08/18/09 23:05.
If you are unable to learn new stuff,you have to learn to learn new stuff! A7 7.80 Commercial
|
|
|
Re: cartoon looking,
[Re: DeD]
#285540
08/18/09 23:21
08/18/09 23:21
|
Joined: Aug 2007
Posts: 157 England
DeD
OP
Member
|
OP
Member
Joined: Aug 2007
Posts: 157
England
|
im havin trouble makin the toon.fx file, i put the code from that page an save it as toon.fx an declair it in my main script, but when i run it, it give me a load of errors. i dont think im makin the fx file right.
Last edited by DeD; 08/18/09 23:56.
D.E.D
I use lite c
|
|
|
Re: cartoon looking,
[Re: DeD]
#285546
08/18/09 23:57
08/18/09 23:57
|
Joined: Jun 2009
Posts: 44 NRW,Germany
MoRRoW
Newbie
|
Newbie
Joined: Jun 2009
Posts: 44
NRW,Germany
|
You donīt need to apply.The shader is already applied to your Camera. function main() { pp_set(camera,Toon_mat); <-------the shader with Material Toon_Mat is applied to the Camera.
} And donīt forget to define the Material before Calling it with this: 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 } Needs to be above main function.
Your Edit:Paste the code in SED save it as Toon_.fx and include. Donīt forget what I wrote above about defining the Material.
Bye
Last edited by MoRRoW; 08/19/09 00:00.
If you are unable to learn new stuff,you have to learn to learn new stuff! A7 7.80 Commercial
|
|
|
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
|
|
|
Re: cartoon looking,
[Re: DeD]
#285567
08/19/09 04:35
08/19/09 04:35
|
Joined: Jun 2009
Posts: 44 NRW,Germany
MoRRoW
Newbie
|
Newbie
Joined: Jun 2009
Posts: 44
NRW,Germany
|
What Version of GStudio are you using?
If you are unable to learn new stuff,you have to learn to learn new stuff! A7 7.80 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|