I have done this before but cant seem to get this working. I am wanting to apply a toon shader to a model but the model comes into the game all black. So in MED to what skin is the .fx file applied to? Please help.

here is the code....

Quote:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////

//Toonshading
MATERIAL* mtlToonShader =
{
effect = "Toonshading.fx";
}

function ToonshadingValues(r,g,b)
{
mtlToonShader.skill1 = floatv(r); //4 looks okay
mtlToonShader.skill2 = floatv(g); //same as above
mtlToonShader.skill3 = floatv(b); //same as above
}

VIEW* vToonView =
{
material = mtlToonShader;
flags = CHILD | PROCESS_TARGET;
}

float4 vecSkill1; //"Details" for the rgb values
float4 vecViewPort;

Texture TargetMap;
sampler2D smpSource = sampler_state { texture = <TargetMap>; };

float4 dirtyToonPS( float2 Tex : TEXCOORD0 ) : COLOR0
{
half4 Color = tex2D(smpSource,Tex.xy);
Color.r = round(Color.r*vecSkill1.x)/vecSkill1.x;
Color.g = round(Color.g*vecSkill1.y)/vecSkill1.y;
Color.b = round(Color.b*vecSkill1.z)/vecSkill1.z;
return Color;
}

technique postFX
{
pass p1
{
PixelShader = compile ps_2_0 dirtyToonPS();
}
}

technique fallback { pass one { } }





Last edited by Gamesaint762; 02/07/10 01:37.