POV-Ray : Newsgroups : povray.binaries.images : toon-shading using attenuation Server Time
4 Nov 2024 19:20:11 EST (-0500)
  toon-shading using attenuation (Message 1 to 2 of 2)  
From: Lukas Winter
Subject: toon-shading using attenuation
Date: 22 Mar 2007 05:30:42
Message: <pan.2007.03.22.10.30.36.351543@removeit.geloescht.net>
In povray.general there is a discussion about toon-shading and I'd like to
contribute my solution. The trick is to put a slightly larger copy around
each object with a clear texture but with dense black attenuation and
no_shadow. This has the advantage that black lines only appear at
positions where the object really ends and that it works with non-curved
surfaces (although the line could be a bit brighter). However, finding
a copy that really fits well so that the line has the same thickness
everywhere is often difficult. For blobs or isosurfaces lowering the
threshold is not always enough. It works quite well for basic objects and
CSG. Meshs shouldn't be a problem if you can expand it by moving every
vertex along its normal but I have never tried that.
Here's the code for a sphere:

#default { finish { ambient .2 diffuse 1 }}
//higher diffuse because black attenuation darkens the texture
union
{
	sphere
	{
	  0, 1
	  pigment
	  {
	    color <1, 0, .05>
	  }
	  finish
	  {
	    brilliance 0
	    specular 10000 //can increase render times with anti-aliasing
	    roughness .0015
	  }
	}

	sphere
	{
	  0, 1.03
	  hollow
	  pigment
	  {
	    Clear
	  }
	  interior
	  {
	    fade_power 1111
	    fade_color <0, 0, 0>
	    fade_distance .01
	  }
	  no_shadow
	}
}

And here's a render of a small demo scene:
http://geloescht.net/allerlei/comic_small.png


Post a reply to this message

From: Bill Pragnell
Subject: Re: toon-shading using attenuation
Date: 22 Mar 2007 06:20:01
Message: <web.4602661722cba179731f01d10@news.povray.org>
Lukas Winter <web### [at] removeitgeloeschtnet> wrote:
> contribute my solution. The trick is to put a slightly larger copy around
> each object with a clear texture but with dense black attenuation and
> no_shadow.
You could also use absorbing/emitting media.

> However, finding
> a copy that really fits well so that the line has the same thickness
> everywhere is often difficult. For blobs or isosurfaces lowering the
> threshold is not always enough. It works quite well for basic objects and
> CSG. Meshs shouldn't be a problem if you can expand it by moving every
> vertex along its normal but I have never tried that.
This is basically the same technique that I used to generate the ghostly
edge-glow effect in my last IRTC entry, 'Ghost Light' - still on the IRTC
homepage due to the hiatus. I can vouch for expanding a mesh along its
normals (actually I shrunk mine but it amounts to the same thing), it
worked a treat. I don't know about other modellers, but there's a suitable
tool in Blender that does this.

Nice demo, by the way.

Bill


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.