Edge or toon shader

i’m relatively new to shader programming and i’m interested in coding an edge shader. any advice on how to start or maybe example code would be helpful.

chris

see the girlpower folder. there is a SobelEdgeDetection.fx file. used in ShadeYourPixels.v4p

oops… :)… no text …

i think you are looking for special rendering-techniques, not computer-vision processing like detecting edges in an image using sobel.

search the web for “non photorealistic rendering”, “silhouette rendering” and “toon shading”, you should find lots of documentation and surely also some realtime-solutions for the tasks you are looking for.

good luck,
michi.

u are right, i just check sobeledge and this is image edge detection but i was looking for something like 3D shading …like phong just with less gradients + edges of the object

…and bump mapping would be of interest too

just in case u have some useful links please post them :)

hi angel,
i just hacked some toon shader with silhouette rendering. you could reduce the number of rendering passes to 3, even 2, combining edge-detection + compositing with the toon-output into one shader.

also you could use an other approach for the silhouette rendering. have a look at the dilate and erose sample that comes with rendermonkey (propably it is in the npr-effect). by the way: they also have a toon sample there.

the patch is not very organized, but the concept should easily be understandable. i#m sorry, i don’t have any time to document things at the moment. but it sholdn’t be too harfd.

hope it works on your machien.

good luck,
michl.

ToonTest.rar (9.0 kB)

cheers michl, works like a charm. good stuff to analyze and learn. this patch should be in the USER SHADER list.

“this patch should be in the USER SHADER list.”

well, one should clean and optimize it a bit. and maybe think about an other solution for the silhouette rendering; regard this patch as a very naive approach.

michl.