Artistic media overlay         One of the best ways to quickly add artistic feel is to create the look of paper or canvas


When doing an artistic render, one of the best ways to quickly add artistic feel is to create the look of paper or canvas. The goal is to make the render appear as though it exists not on a screen, but on a piece of media, enhancing the feel of a scene that is done by hand.

This is part of the non-photorealistic rendering collection, a series of articles to teach some of the basis of NPR techniques, basic implementations, and thoughts on developing more complex techniques in OGRE.

Simple Overlay

The easiest way to achieve this effect is to add an image to a screen wide overlay. Now, you need the overlay to be in front in order to have any effect on objects rendered in the scene. Adding white to the scene would just wash out the render, regardless of the alpha. The way to control the application is to start with a black image and give it tiny values of alpha in the look of the media you wish to replicate. This way, pixels occurring in the darker areas of the media (the depressions in a piece of rough paper or canvas) will receive a bit of extra darkening regardless of what is rendered behind. Black objects will still look black. White objects will have a little bit of texture added. The desired behavior will be achieved.

If you wanted to do a piece of notebook paper, you would have to have blue and red lines in the appropriate places alone with some black holes if you like. The lines will have to be of a darker color than usual, and just like the black areas on a regular overlay, you use the alpha to lighten the amount of shade that would be received by a white pixel.

Complex Overlay

If you are trying to recreate the effect of chalk on concrete or lead on paper, you can get even more benefit from using media overlays. The goal of the overlay is to add the texture of the media that is supposedly being drawn on. In many shading techniques of NPR, there will also be texture in the strokes. To say these two operations should happen independently would be to say the texture of a stroke of chalk has nothing to do with the texture of the concrete it's drawn on. Clearly, there's an opportunity to add detail and a sense of correctness to stroke behavior and the texture of objects that are drawn.

To start, I recommend that whatever you use to define strokes have very little inherent texture. The basic pattern of the shade can remain without problem. The size and shape can also be data you spoon-feed to your shaders and materials. But the texture should come from the overlay. The reason for this is that if you have two sources of texture, you will be adding redundant data to the scene. Since the stroke has no knowledge of where it will exist on the media, the media should be used to drive the eventual texture of the stroke.

To implement this, recognize how the texturing of the stroke occurs versus if you had flat media. In raised areas of the media, there will be more contact with the lead/brush etc. Thus the brightest areas of the media will become the darkest shaded. The more shaded areas are going to be in less contact with the material and receive less shade. To create your algorithm, use the negative alpha values of your media overlay image as the driver for how much stroke is received. Modulate appropriately to get the shades as dark as they need to be. You can also use another layer of a png or just a separate image holding this "height map" if you have a complicated surface, like asphalt.

Pay attention to the particular type of material. Chalk, for instance, breaks off as you rub it onto the surface. Instead of being deposited on the higher portions of the surface, it will deposit more into the deeper recesses of the surface, leaving the highest parts exposed. If you rub it lightly, it will deposit only on the higher parts, thus there is a change in the behavior at some point as you move from a light stroke to a heavy stroke with a lot of pressure. A good technique will catch this transition. Play around with your real materials to understand how they behave and which way to drive the algorithm.

You can also add some anisotropy by depositing more shade on the windward side of the bumps in your "paper." The effect will likely be hardly noticeable except at high resolutions and may be difficult to implement, so I suggest you work on this only if you need an extra dimension to differentiate strokes of if you have a lot of free time.