Cartoon edge color?

We are newbie of jme3 and we are currently building a game on top of a 3d model imported as OGRExml.

We are required to have colored edges on the volumes of the 3D model. To do that, we are using the cartoon edge filter, that works really fine.

Unfortunately, we have to color the edges differently than black, but we do not really know how to do that. Is there any chance with the filter we are using or we have to use something different?



Thanks a lot!

David

You can copy the cartoon shader and j3md from jMonkeyEngine3.jar (Libraries node in jMP) to your project and modify it. Just use Ctrl-C and Ctrl-V.

look in the cartoonEdge.frag

look for this line



color = (1.0 - edgeAmount);





you’ll need to replace it with something like that



vec4 edgeColor=vec4(1.0,0.0,0.0,1.0);

color
= mix(vec3(1.0 - edgeAmount),edgeColor.rgb,edgeAmount);



here edgeColor is red, but you can set it to what ever you want.

Of course edgeColor should be a uniform instead of an inline variable so you could pass it from java to the shader, but this is for the example.