• Home
  • Tutorials
  • Cartoon Edges in RAT
    • Cartoon Edges in RAT stefanoTabacco
      Cartoon Edges in RAT
      The standard 'Cel' shader template that comes with SLIM is very good for smooth surfaces such as subds and NURBs, but does not work well with polygons, because they have very hard edges that the shader cannot detect, this tutorial will help you make them look good.
      (For this tutorial you will need to have installed both ST_FakeSubSurfScatt.slim and ST_cel.slim, both included in the zip)

      The standard 'Cel' shader template that comes with SLIM is very good for smooth surfaces such as subds and NURBs, but does not work well with polygons,because they have very hard edges that the shader cannot detect.

      In fact, it is, I think, impossible to find these edges with the standard RenderMan shading language, but they can be easily found by an image/movie manipolation program such as Photoshop,After Effects etc..(i will next refer to this programs as PS)

      So the goal of my very simple templates is to produce an image that PS can easily 'convert to edges'.

      in ST_Cel.slim there are 3 templates :
      • ST_Celly (surface)
      • ST_findEdges(color)
      • ST_Depth(float)
      ST_Celly is a template that can alternatively render two different colors named 'Cel Shader' and 'Cel finder'



      if you render with 'which=Cel Shader' you will aproximately get the same result as if you applied the standard SLIM 'Cel'.

      One note: if you want to get the two tone effect connect a 'ColorSpline' as coloration and connect an 'ST_Diffloat' as Cspline pattern like this:



      I applied this ST_Celly to all the geometry


      res. 640x480

      save this image because we must use it !

      this is a good color pass but there is no edge visible and so the cartoon effect looks no good;

      anyway we still have some steps to go :

      in ST_celly set which=Cel finder

      the swatch wiill now render the color at the bottom of the template named secondary ouput.

      So connect an 'ST_findEdges' as secondary ouput ; now in the swatch you should see a strange RGB color combination



      render your image now (it should be better if you render this at twice (or more) the original resolution)


      res. 1280x960

      Now import this image in PS and do:
      1. Filter -->Find Edges
      2. edit-->Threshold (value 230)
      (NOTE: these parameters works good for almost all situations, so I created a photoshop action that does them)

      my result (after i scaled by 50% the image size) is this:


      res. 640x480

      So , multiplying this image over the color pass we saved before:



      A bit better



      Notes:
      • The ST_findEdges does calculations on the bounding box of your object ,so be sure it is oriented 'correctly'
      • The ST_findEdges is certaintly not perfect; works good with hard edges, but with smooth sufaces sometimes you will find edges that you don't want. Decreasing contrast will help

      • connecting a Fresnel color as add of ST_findEdges will enhance edges and give beautiful effects expecially on smooth surfaces
      • it is sometimes useful to decrease contrast with depth, otherwise far from camera geometry will tend to give too much black edges. This can be done connecting a ST_Depth float as contrast of ST_findEdges

      i think this is all, sorry for my english.

      Have fun

      Stefano

      Photoshop Actions


      Download this photoshop actions and use it with your cel edges shader.
      Adversitment
      • Latest Articles

      • Top Stories

      • Similar Stories

      • Related Stories

      • Last Coolthreads