
The trick is to cull front faces and draw the back faces using wireframe mode with lines thicker than 1. You'll end with the default render but with additional black (or colored lines) where front and back faces are connected with each other. The default irrlicht source allows you to cull backfaces or don't do it - I haven't seen any way to cull front faces (besides inverting normals). Did I tell you, I hate vector math?
If there is a different approach to do it, let me know!
The zip file includes a diff/patch file to apply to the Irrlicht source (revision 863) to allow front face culling. I didn't touch the software drivers for this - nor the DX8 source. Would be nice if someone with more DX/OGL knowledge could check my modifications - just grabbed them from 5 minute google sessions and they seem to work.
Materials get a new attribute - FrontfaceCulling. It works the same way as BackfaceCulling but it has the higher priority.
OpenGL: If you set both to true (nothing should be drawn), BackfaceCulling is ignored.
Direct3D: If you set both, everything should be culled (untested).
This is mainly because I wasn't sure what would be better and I did the Direct3D one first.
The zip file also includes a text file with a simple function to draw "back face wire frames" ( RenderBFWF() ) of specific scene nodes.
To get contours for a toon shader, draw your SceneNode as you always do and then call the RenderBFWF() function. The parameters allow you to modify the line thickness and their color.
Important: Line thickness won't work in DirectX mode. As far as I know that's a known Irrlicht limitation at the moment. Slap me, if I'm wrong.
For those looking for a toon shader: This isn't a complete implementation of a "toon shader". You still have to do the lighting/color manipulation. or just use smooth textures or whatever you want.
----------
If you want to modify or use my code or even print it out to test your new document shredder ... do whatever you want, but I'd like to know if it becomes anything really useful.
Download: FileFront.com
