Cartoon Shader sample Help

Hi guys

great engine by the by quick question about the Cartoon Shader

Looking through the latest version samples I noticed that there is no color in the Cartoon shader sample, even though the screen shot has the dragon colored. I’m guessing this may be is a new version bug. Any words of wisdom to help fix the bug would be greatly appreciated.

The only effect I’ve been able to get is when I replaced the dragon with a red ball, the sample codes returned a yellow ball??

Ok the only Shader parameters in lightingGen that I couldn’t find shader input for was:

uniform float4 mspos_light

is this the culprit? if so what is the new version equivalent? If not I believe the problem is somewhere within lightingGen.

[edit]
I looked deeper into the light gen code and the problem is at line:

l_color0=vtx_color;

but why this line is so simple.

l_color0=vtx_color;

All this line means is: transfer the vertex color over to the l_color which can be used in the fragment shader.
That means: The cartoon shader uses the vertex colors to define the color. You can also use a texture on the model, but for that you’ll have to write a few lines that it reads from the texture instead of the vertex color.

thanks for the response.

When I get the vertex color do I need to do any calculations to it. It seems that somehow the vtx_color is getting messed up.

Odd. We’ve encountered in our project the same problem, vertex colors which are messed up. As a workaround we are now using textures instead of vertex colors.
Though, the problem here does not occur on the older GeForce cards (I have a 5200 FX without the problem) but on the newer GeForce it does occur. What card do you have?

nvidia quadro fx 1500m, hmm ok so maybe textures are the way to go.

I’d rather see this bug fixed. Does anyone know why this bug could be there in the new versions and not in the old? drwr/Josh, perhaps you could shine more light on this problem? It appears only to happen on the newer cards, which is very odd. Has any big shadersystem rewrite happened in the latest versions?

pro-rsoft,

how would I change the code in order to use a texture instead of vertex?

I know I need

uniform sampler2D tex_0
float2 vtx_texcoord0 : TEXCOORD0

then shouldn’t i be avle to do

l_color = tex2D(tex_0, vtx_texcoord0);

to get the texture color, but it errors out saying
“error C1115: unable to find compatible overloaded function “tex2D””. Thank you for your help.

You need to call tex2D in the fragment shader, not in the vertex shader.