Non-Photorealistic Rendering: From a general view to Suggestive contours

Giorgio Conte and Massimo De Marchi

EVL Creative Coding CS 488 - University of Illinois at Chicago

November 2014

Abstract

Non-Photorealistic Rendering (NPR) is a very important branch of computer graphics. It was born in 1990s and from that time it has gained more and more popularity among the academic community. NPR con- tains applications in many different contexts which makes this field as interesting as stimulating. In this report, we have focused first our atten- tion on understanding the main steps done in the history of this discipline, then we have investigated some of the most well-known techniques and, in the end, we focused our attention on suggestive contours. After having analyzed the theoretical aspects, we have implemented one image-based algorithm to render this kind of effect.

1 Introduction ples and techniques known to artists for many centuries, that allows to get Computer Graphics is concerned with rid of unnecessary details and that bias the development of tools for generat- the user experience and perception. ing various forms of imagery. Peo- Non-Photorealistic Rendering (NPR) ple and artists are interested in these is the name often used to refer to all tools for the production of images to the techniques that follows this princi- communicate visual information and ples and in the last twenty years has the important point is that appropri- became such a popular topic that lot ate form of imagery for a given task of efforts have been spent to find new depends upon the nature of the com- algorithms. munication. Computer graphics has an amazing success story considering real- istic rendering. Conversely, there is a branch of computer graphics that seeks for something different, namely princi-

1 Photorealism is certainly good for the job of documentation, where the aim is to record scenes or objects in all their details. Crime scene photogra- phy is a perfect example. Should new evidence or theory prompt a reinves- tigation, crime scene photos may be probed for new clues. NPR, such as a sketch of the scene, could record the relative positions of the things present in the site, but any details not drawn Figure 1: NPR vs Photorealism by the artist at that time is going to be permanently lost. Long before computer graphics be- In addition, photorealistic computer came famous and popular, artists knew graphics is uniquely suited to the sit- the distinction between photorealism uation where one would like to cre- and non-photorealism. Looking at fig- ate live-action scenes (e.g. movies) ure 2 you could imagine it as a photo but where its difficult to stage the real while a painting like the one in figure scene. A possible task could be to 3 exhibits a level of abstraction that simulate a special effect such as huge remarkably departs from realism. explosions, or a flood over Chicago lakeshore requiring photorealistic com- puter graphics imagery for convincing effect. Even if we know that these effects are not real, cartoonish NPR could not be exploited to render those scenes be- cause it would destroy the illusion nec- essary for the audience to break of dis- belief and enjoy the story.

Figure 3: Van Gogh, The Starry Night, 1889 Figure 2: Bouguereau, The Little Shepherdess, 1891 NPR may be the appropriate

2 means for communication for some lustrate abstract concepts using very tasks, but basically it depends on the concise image. In figure 5 the artist situation. Since computer graphics communicates an abstract idea of the has traditionally focused his atten- role of higher education in our society. tion mostly on photorealistic render- If we imagine to replace this with a ing, there are still lots of unexplored similar photoreal image, the abstract opportunities for new forms of content concept would not have been as effec- for authors. However, there are also tive as it is. various applications where NPR is rec- ommended, for example when image is used for an explanation such as in fig- ure 4. Given that, very likely the user has the real tool in front of him, a pho- tographic image contains lots of unnec- essary details; instead, the author can better explain the shape and function of the item by disambiguating differ- ent parts using distinct colors and re- move physically accurate shading that reduce the clarity of the image. Silhou- ette and feature lines are often used to increase the objects description.

Figure 5: Sutter

Finally, storytelling is the last ex- ample where stylized and abstract im- age can help to communicate scenes which exist only in the author’s imag- ination. The effect would be totally different with comparable photoreal drawing. Moreover, children, the com- mon audience in this case, generally respond best to brightly colored illus- trations, and somehow find them more Figure 4: Technical illustration of a engaging than photos. mechanical tool

Stylization is frequently used to il-

3 alism is ambiguous and graphics re- searchers and artists refer to it with different meanings. Moreover many of the techniques that are used in non- photorealistic rendering are not actu- ally rendering techniques; in fact many of the algorithms in the literature are based on image post-processing. Re- search efforts were directed to simulate hand drawn illustrations, namely at- tempt to simulate what an artist might do in order to enhance comprehensi- Figure 6: Dr. Seuss bility of visual information. However, even before the work done by Winken- In this document we would like first bach, in 1990, Takafumi Saito [17] pro- to give a brief overview of some of posed a new rendering technique that the best known techniques and algo- tries to achieve this by implement- rithms present in the literature then ing an algorithms for discontinuities, describe more in the detail an image- edges, contour lines, and curved hatch- space algorithm to render suggestive ing. contours and show the result obtained with the implementation. The re- port is structured as follows. First in section 2 we briefly outline the history of NPR and in section 3 we present some non-photorealistic algo- rithms and techniques found in the lit- erature. In section 4 we describe in de- tails how to render suggestive contours and in section 5 we presents the results obtained. Finally in section 6 we out- line the current research issues and we draw some conclusions in section 7. Figure 7: Saito 1990

2 History of NPR Subsequently many other tech- niques have been proposed among Non-photorealistic rendering is a rela- which Pen & Ink [19], watercolor [6] tively young field that emerges in the and curved brush strokes [10]. 1990s as an alternative to photoreal- ism. The term non-photorealistic ren- dering was probably coined by George Winkenbach and David Salesin in their paper dated 1994 [19] and it has been criticized for many reasons among which the fact that the term photore-

4 would be otherwise tedious to do by hand. One of the main issues was to pursue frame to frame coherence as de- scribed by Meier [15] and Litwinowicz [13] works.

Figure 8: Winkenbach 1994

Figure 11: Meier 1996

Figure 9: Curtis 1997

Figure 12: Litwinowicz 1997

These result were achieved offline, but various works among which Kol- wasky [11], Gooch [8] and Praun [16], thanks also to the evolution of graph- ics hardware, opened the door for real- time . This was important Figure 10: Hertzmann 1998 because for the first time it was pos- sible to create interactive illustrations, All these techniques were focusing otherwise impossible to do by hand. on static imagery, but in the latter part of the decade researchers started to be interested in dynamic NPR, that is al- lowing the production of imagery that

5 Figure 13: Kowalski 1999

Figure 15: Praun 2001

Nowadays, more recent researches are trying to exploit NPR for visual- ization, especially for the production of medical illustrations useful for many applications.

3 Techniques

In this section we would like to present and briefly describe some tech- niques which made the history of Non- Photorealistic rendering.

3.1 Pen and Ink A very interesting and effective tech- nique is called ”pen and ink” and it was presented first by Winkenbach and Salesin in [19], 1994. This was one of the first NPR technique and it has became quite famous in the academic literature. The basic idea is to ren- der object and images as they were Figure 14: Gooch 1998 drawn by an artist just using pen and ink. The pen and ink effect has a very long story, since it first appeared in manuscripts of the Middle Ages, but

6 Figure 16: A collection of stroke textures presented by [19] . only in the last century this kind of ef- dication”. Stroke textures can also be fect has been developed as an art form used to render shadows as it is depicted by itself. Pen-and-ink illustrations are in figure 17. very simple and effective, this simplic- ity makes them especially attractive. 3.2 Moreover, each stroke could also gain more expressiveness by adding small ir- Cel shading or toon shading is a well regularities in its path and pressure. It know technique to render objects with is worth to remind that in this kind the style of cartoon or comic books. of illustrations, the drawer could only This technique is somewhat recent and vary the tone just by changing the den- it started to appear from around the sity of the strokes. beginning of twenty-first century. Ba- To render this effect, the authors have sically, there are two main techniques introduced the notion of ”stroke tex- that are used to create a toon effect: tures” which are a set strokes used a tone-based technique and texture- to produce both texture and tone. based one. The first shading approach In figure 16, some of them are de- is based on the diffuse light taken from picted. Each texture has a given pri- Phong shader. The simple idea is to ority and the author mix those tex- discretize the result computed by dif- tures in a post processing phase, after fuse light with just three or four val- having applied a simple Phong shader. ues. Thus, it is possible to reduce the The tone depends basically on the dif- number of tones rendered and make fuse light. Then to achieve a bet- the scene look like a cartoon. The sec- ter effect they have developed an al- ond method is based on 1D or 2D tex- gorithm that allows the artist to ”in- tures. The principal idea behind this dicate” which area should be rendered procedure is to create a texture with as white. This technique is called ”in- just a bunch of colors. Then, the color of each pixel is taken from this tex-

7 Figure 17: An image rendered using strokes textures and shadows. Image taken from [19] . ture using the diffusion coefficient. It 3.3 Stylized highlights is also possible to extend this method A more recent technique used to ren- using a 2D texture. Then, to choose der cartooned scene is called ”stylized the right matching color we could use a highlights” and it was presented by new parameter which, in the vast ma- Anjyo et al. in [1]. This technique jority of the case, is depth. Figures focuses its attention in how to render 18 and 19 explain better the two tech- the specular light in a toon scene. In niques described so far. To get a more particular, the authors explain how to ”realistic” result, it is possible also slightly modify the result of the Blinn’s to render a black contour around the specular model [4] in order to obtain shapes. Many algorithms both object- a better effect. The algorithm pro- space and image-space have been de- posed interactively modifies the initial scribed in the literature, but we would shape through geometric, stylistic and like to point out the one which we de- Boolean transformations. In fact in cel scribe in section 4. shading, the highlight must be a se- mantic notation rather than a part of the physics. The effect achieved by au- thor is represented in figure 20, while a scene rendered using this shading tech- nique is depicted in figure 21.

Figure 18: This picture shows an ex- ample of 2D texture that could be used to render a cel shaded object.

8 Figure 19: This picture represents how to create toon shading using a one di- mensional textures.

3.4 Technical drawings As we were saying before, NPR has became very important also for repre- senting technical illustration. In fact, it has been showed that non photo- realistic images are more useful for explaining how a mechanical piece is done. Using a NPR, it is possible to eliminate all the unnecessary details that bias the user. The lighting model proposed by [8] allows shading to oc- cur only in mid-tones so that edge line are more visible. This technique gives a clearer picture of the shape, struc- Figure 20: This picture shows all the ture and material than the traditional transformation that can be applied us- computer graphics techniques do. Ba- ing [1]. On the lower right it is possible sically, the technique presented aims to to see the final result. render shape with a shading algorithm based on cool-to-warm tones. From a mathematical point view, the color of each pixel is given by the following for- mula:

(1+~(I)·~(N) 1+~(I)·~(N) I = ( 2 )kcool + (1 − 2 )kwarm (1) where I~ is the light vector, N~ is the normal of the surface in that point, kcool is a cold color and kwarm is a warm color. In the example provided by the authors they use a palette that Figure 21: A character and a scene ren- goes from blue to yellow so kcool and dered using ”stylized highlights” shad- kwarm are computed as follows: ing. kcool = kblue + αkd (2) kwarm = kyellow + βkd (3)

9 (a) (b)

(c) (d)

Figure 22: In figure (a) a phong shaded object is rendered while in (b), (c) and (d) the warm cool effect is applied with different configurations.

Where kblue and kyellow are the tones kind of effect, the authors map a col- of the blue and yellow respectively, lection of twenty stripes of varying in- while kd is the color of the object ac- tensity along the axis of maximum cur- cording to the diffuse shading light. α vature. The stripe intensities vary be- and β will determine the prominence of tween 0.0 and 0.5 and the stripes clos- the object color and the strength of the est to the source light are overwritten luminance shift and they are free pa- with white. Within the stripes the col- rameters. In figures 22(a), 22(b), 22(c) ors are blended together in a linear and 22(d) it is possible see the same ob- way. Then the cool-warm effect de- ject rendered with this technique, but scribed before is added, while the edge using different configurations. lines are generated interactively using The same technique has also been used the technique presented in [14]. Figure to render metallic material in a non 23 shows the results obtained with the photorealistic way. Usually drawers technique described. represent a metallic surface by alter- nating dark and light bands. Lines are drawn in the direction of the axis of minimum curvature. To simulate this

10 (a) Achromatic (b) Metal effect with (c) Colored metal ob- (d) Colored metal metallic shading cool-to-warm hue ject object with specular light

Figure 23: This set of pictures shows how different effects can be created with the technique described presented in [8]. In subfigure (a) only the metal effect is rendered while in subfigure (b) also the tone shift is added. In subfigures (c) and (d) the object color is also rendered and in subfigure (d) a specular light is added.

3.5 Painterly plied and the algorithms take care of rendering with brush all the tedious work. The first re- strokes searchers that addressed this challenge are Litwinowicz [13] and Hertzmann Another technique often used to pro- [10]. Basically this technique works duce images for graphic design and il- in way similar to how artists paint, lustrations employs brush strokes to namely starting with rough strokes simulate an hand-painted effect. This and going back over the painting with approach is very useful because it al- smaller strokes to add details. Each lows to reproduce various artistic styles layer is painted with different stroke and give emphasis to what is important size and this helps to emphasized cer- in a given photograph. All the algo- tain details that the artist wants to rithms present in the literature try to be highlighted. In [10] Hertzmann de- address the various challenges of this scribes an algorithm that follows this approach; the first of these is physical approach; more in detail the algorithm simulation, and impressive works have produces the final result adding thin- been done by [6] and [5]. Another chal- ner strokes layer by layer in a pyra- lenge is to provide artists with user- mid manner. Each layer starts upon friendly tools that take care of the me- a blurred version of the original pho- chanical details of image creation while tograph and the brushes are applied providing the user parametric styles to to areas that are as large as the brush produce various effects. This is use- size; according to this method impor- ful especially for , where the tance is given to the area of the im- can select the style to be ap- age that contains most detail since it

11 is where the smaller brush strokes are applied. In order to add expressiveness to the algorithm, Hertzmann modeled the brush strokes as anti-aliased cubic B-splines, arguing that curved strokes better express silhouette and light ef- fects. Figure 25: A frame showing both con- tours (q) and suggestive contours (p), 4 Suggestive Contours as seen by the main camera c. When the camera moves from c to c’, p be- In this section we are going to describe comes a contour, while the contour in first what suggestive contour are, then q slides along the surface to q’. Image the algorithm that we use to create taken from [7]. them. Mathematically speaking, the au- 4.1 Overview thors gave three equivalent definitions of the suggestive contours. Here we re- Suggestive contours [7] is the topic on port the one that, in our opinion, is which we mostly focused our atten- simpler and clearer to be understood. tion. Suggestive contours are lines dif- The definition says: ”the suggestive ferent from creases and traditional con- contour generator is the set of minima tours. In fact, this new kind of line pre- of n · v in the direction of w”. Where sented by the authors are lines drawn n is the normal defined in that point, v in visible parts of the shape that could is the view vector and w is the projec- be traditional contours from points of tion of the view vector on the tangent view close to the real camera position. plane in p. As it was explained in the paper, sug- gestive contours could live consistently with true contours, because they antic- 4.2 Algorithm ipate and extend the true ones. Sug- Two algorithms are presented by the gestive contours are described by the authors to render suggestive contours authors as ”features where a surface consistently. The first is object-based, bends sharply away from the viewer, that means that the algorithm works yet remains visible” so that they are directly using the shape of the objects almost contours and actually they be- and it does not need a post processing come contours in nearby views. Figure phase, while the second one is image- 25 better represents the concepts de- based, that means that it is a filter ap- scribed so far. plied to an image of the rendered scene. For reason of simplicity and effective- ness, we concentrate our effort in the second one. In fact, it is possible to de- tect suggestive contours directly from a rendered image. The solution imple- mented reflects the definition we have reported in the subsection 4.1 and the

12 (a) Original photograph (b) Impressionist style applied

Figure 24: An example of what the algorithm by Hertzmann can produce algorithms works as follows. First, we 5 Results render the entire scene using a diffuse light located in the camera origin and The results achieved using the algo- then, in the rendered image, the al- rithm described before are very good. gorithm detects suggestive contours as To better compare the suggestive con- steep valleys in intensity. Since it is tours with the true contour we ren- not possible to detect the radial direc- dered the same object using the two tion from the rendered image, the algo- different in the same scene. As rithm just find all the valleys. Despite it is possible to see from the image 27, many algorithms have been proposed the effect created allows users to better to solve this problem, the authors sug- understand the shape of the object ren- gest a very simple and effective filter dered. In fact, much more details are and the idea is as follows. For each drawn with respect to the basic con- pixel, the shader retrieves the bright- tour shader. ness of neighbour pixels, we actually do not consider a circle window as it has been suggested by the authors, but 6 Current research we use a square. Across the squared issues window the greatest intensity is pmax. Then the pixel is considered a valley if At the state of the art there are the following two conditions are met: many challenges in the field of Non- Photorealistic Rendering. Gooch in his • pmax − pi exceeds a fixed thresh- paper [9] revised some of the major old d challenges and in this section we are going to look at them. • no more than a certain percent- The first challenge is studying how to age s of the pixels in the window encode what makes something beauti- are strictly darker than p i ful, and Gooch refer to that as ”Algo- Finally we just add the true contours rithm aesthetics”. Part of this chal- and the suggestive contours to render lenge involves the stimulation of visual the final scene. In figure 26 the results area of the brain. obtained by the authors are reported. The second important challenge is how to capture the essence of an im-

13 (a) Image rendered with true contours (b) Image rendered with suggestive con- tours

Figure 26: A comparison between the same object rendered without (a) and with suggestive contours (b) . age through abstraction, like Antoine techniques to track tissue deformation, Saint-Exup´erysays: 3D reconstruction and augmented re- ”You know you’ve achieved ality for robotic assisted surgery are perfection in design, Not discussed and it is also highlighted the when you have nothing importance of integrate pre-operative more to add, But when you data and intra-operative data in order to obtain a good and accurate surgical have nothing more to take away.” navigation framework. The fourth challenge is referred by This is a very important goal be- Gooch as ”interaction that enables cause it allows to easily recognize the right-brain thinking”, namely enable most salient information. A closely re- user with poor artistic skills to cre- lated challenge is represented by the ate compelling visuals and let artist new area of Visual analytics which express themselves without having faces the problem to map salient fea- system parameters get into the way. ture in the data with suitable visual The fifth challenge is about CG im- representations. There are many fields agery evaluation, and this can be done of study which can take advantage through a sort of ”Turing test”. from visual analytics such as medical Finally one of the toughest chal- visualization. lenges is to explore new artistic me- An interesting topic that combines dia, and many techniques are moving medical aspects and non photorealistic toward this direction such as Anal- rendering is the one proposed by Lee et ysis/Synthesis [18] and Evolutionary al. in [12]. In this paper the authors Art. proposed a real time rendering tool Evolutionary art is a recent research to help surgeons in minimally inva- topic which try to apply artificial in- sive interventions. In particular, some

14 (a) (b)

(c) (d)

Figure 27: In figure (a) a monkey model is rendered using simple contours while in figure (b) the same model is rendered using also suggestive contours. Another comparison is shown with a face model in figure (c) and figure (d). telligence algorithms and techniques 7 Conclusion in the NPR field. The topic was in- troduced first in [3] and within this Non-photorealistic rendering is a very context Baniasadi and Ross have pre- interesting topic and it can be declined sented in [2] a new approach using and applied to very different contexts. genetic algorithms. With this sys- In fact, as we have described applica- tem, a source image is taken as in- tions ranges from art to scientific visu- put, and a genetic program is evolved alization. This wide range of applica- that will re-render the image with non- tions make the NPR field a very im- photorealistic effects. The effect ren- portant branch of computer graphics. dered is depicted in figures 28(a) and NPR is able to collect and to embed 28(b). lots of different ideas from many con- texts and this makes it a very appeal-

15 (a) Input image (b) Brush effect

Figure 28: An example of evolutionary art ing field of research. [3] Perry Barile, Vic Ciesielski, and The results obtained from the imple- Karen Trist. Non-photorealistic mentation of the algorithm for sugges- rendering using genetic program- tive contours are very satisfactory, be- ming. In Simulated Evolution cause we are able to correctly repro- and Learning, pages 299–308. duce the proposed technique. The ef- Springer, 2008. fect obtained is stunning, especially if [4] James F Blinn. Models of light re- compared to the ”true” contour tech- flection for computer synthesized nique. Since their birth, NPR tech- pictures. In ACM SIGGRAPH niques have always attempt to imitate Computer Graphics, volume 11, great artworks of the past, but the ul- pages 192–198. ACM, 1977. timate challenge is to proof that NPR can be be an artistic medium on its [5] Fractal Design Corporation. Frac- own and it can create the art of the tal design painter. future. [6] Cassidy J Curtis, Sean E Ander- son, Joshua E Seims, Kurt W References Fleischer, and David H Salesin. Computer-generated watercolor. [1] K-i Anjyo and Katsuaki Hi- In Proceedings of the 24th annual ramitsu. Stylized highlights for conference on Computer graphics cartoon rendering and animation. and interactive techniques, pages Computer Graphics and Applica- 421–430. ACM Press/Addison- tions, IEEE, 23(4):54–61, 2003. Wesley Publishing Co., 1997. [2] Maryam Baniasadi and [7] Doug DeCarlo, Adam Finkelstein, Brian J Ross. Exploring non- Szymon Rusinkiewicz, and An- photorealistic rendering with thony Santella. Suggestive con- genetic programming. Genetic tours for conveying shape. ACM Programming and Evolvable Transactions on Graphics (TOG), Machines, pages 1–29, 2013. 22(3):848–855, 2003.

16 [8] Amy Gooch, Bruce Gooch, Peter Computerized Medical Imaging Shirley, and Elaine Cohen. A non- and Graphics, 34(1):33–45, 2010. photorealistic lighting model for automatic technical illustration. [13] Peter Litwinowicz. Processing im- In Proceedings of the 25th annual ages and video for an impres- conference on Computer graphics sionist effect. In Proceedings of and interactive techniques, pages the 24th annual conference on 447–452. ACM, 1998. Computer graphics and interac- tive techniques, pages 407–414. [9] Amy A Gooch, Jeremy Long, ACM Press/Addison-Wesley Pub- Li Ji, Anthony Estey, and Bruce S lishing Co., 1997. Gooch. Viewing progress in non- photorealistic rendering through [14] Lee Markosian, Michael A Kowal- heinlein’s lens. In Proceedings of ski, Daniel Goldstein, Samuel J the 8th International Symposium Trychin, John F Hughes, and on Non-Photorealistic Animation Lubomir D Bourdev. Real-time and Rendering, pages 165–171. nonphotorealistic rendering. In ACM, 2010. Proceedings of the 24th annual conference on Computer graphics [10] Aaron Hertzmann. Painterly ren- and interactive techniques, pages dering with curved brush strokes 415–420. ACM Press/Addison- of multiple sizes. In Proceed- Wesley Publishing Co., 1997. ings of the 25th annual conference [15] Barbara J Meier. Painterly ren- on Computer graphics and inter- dering for animation. In Proceed- active techniques, pages 453–460. ings of the 23rd annual conference ACM, 1998. on Computer graphics and inter- [11] Michael A Kowalski, Lee active techniques, pages 477–484. Markosian, JD Northrup, ACM, 1996. Lubomir Bourdev, Ronen Barzel, [16] Emil Praun, Hugues Hoppe, Loring S Holden, and John F Matthew Webb, and Adam Hughes. Art-based rendering of Finkelstein. Real-time hatching. fur, grass, and trees. In Proceed- In Proceedings of the 28th annual ings of the 26th annual conference conference on Computer graphics on Computer graphics and inter- and interactive techniques, page active techniques, pages 433–438. 581. ACM, 2001. ACM Press/Addison-Wesley Publishing Co., 1999. [17] Takafumi Saito and Tokiichiro Takahashi. Comprehensible ren- [12] Su-Lin Lee, Mirna Lerotic, dering of 3-d shapes. In ACM Valentina Vitiello, Stamatia SIGGRAPH Computer Graphics, Giannarou, Ka-Wai Kwok, volume 24, pages 197–206. ACM, Marco Visentini-Scarzanella, 1990. and Guang-Zhong Yang. From medical images to minimally [18] Javier Villegas and An- invasive intervention: Computer gus Graeme Forbes. Analy- assistance for robotic surgery. sis/synthesis approaches for

17 creatively processing video sig- Salesin. Computer-generated pen- nals. In Proceedings of the ACM and-ink illustration. In Proceed- International Conference on ings of the 21st annual conference Multimedia, pages 37–46. ACM, on Computer graphics and inter- 2014. active techniques, pages 91–100. ACM, 1994. [19] Georges Winkenbach and David H

18