Shadowplay

How I produce a filtered weighted multi-directional shaded relief, with full control of the combined light sources in ArcGISPro and Photoshop. Case study the island of Tutuila, American Samoa.

Starting Point

Breathtaking view in a sleepless early sunlit morning on a winter bright day. Warm sun rays on my face. I had leaned back at my seat admiring the landscape from my tiny window. I was travelling from North-Eastern Greece to Athens and the airplane was flying over some of the most impressive mountainous regions, like Mt Olympus and Vikos-Aoos Gorge. What a majestic spectacle. I was trying to analyse the shades on the landscape and with my imagination I was trying to draw a hillshade.

A couple of weeks after that day this article by John Nelson on How To Smash Vintage Hillshade into Modern Imagery came along. I was really amazed and inspired with the concept of the article and with the work on hand-drawn shaded relief from previous map makers. I started to search the internet for techniques on how to imitate or replicate the look and feel of a hand-drawn shaded relief with modern software and I was surprised with the number of resources and papers freely available. At the end of this article I provide a short list with some of the most precious sources I have studied and enjoyed a lot.

After about one year, this video on How to Align Vintage Hillshade with Current-ish Imagery came along. Another great source of inspiration. I loved how a real hand-drawn shaded relief matched with a present imagery. And I was impressed with the relief of Tutuila island itself (how many volcanic craters, calderas or lava flows can you count?)!

Since these days I have experimented a lot with hillshades and I have spent an enormous amount of time in front of my computer (instead of going out and enjoying life)! I have come up to a structured workflow that I have standardised in order to create a custom multidirectional hillshade with full control of the light sources, directions and volumes, upon which I apply some low-pass, high-pass and other filters to make it look more man-made and less computer-made.

Before I start demonstrating my workflow, I want to clarify that this is a totally artistic approach. Even though I have a proficient knowledge and understanding on hillshade smoothing and image filtering, this is not a scientific approach. I am not attempting to precisely replicate the hand-made relief, but instead to produce something artistic and good-looking. If you want to dig into some real scientific approach, I would strongly recommend to study the suggested papers that I list at the end of this article.

I selected the island of Tutuila as my case study because I got very inspired by the video mentioned above and because I find very impressive its geomorphology, not to mention how enchanting I find the hand-made artwork of Tutuila. I was also lucky enough to find the appropriate dataset with a simple internet search.

Collect the data

At the webpage 2012 NOAA American Samoa Lidar DEM: Islands of Tutuila, Aunu’u, Ofu, Olosega, Ta’u and Rose Atoll I found all the necessary tiles of 2012 NOAA Lidar DEM for the American Samoa from where I only downloaded the ones for Tutuila island. I performed a bulk download of all 228 tiles with just one click, thanks to Simple Mass Downloader, a Google Chrome Extension.

I also downloaded the hand-drawn artwork of American Samoa from the Shaded Relief Archive, maintained by Tom Patterson and Bernhard Jenny.

Prepare the data

In ArcGIS Pro I georeference the hand-drawn artwork of American Samoa, following the steps that John Nelson describes in the video, mentioned above.

Shadowplay

I create a mosaic dataset from the Lidar DEM tiles and I resample the derived DEM from 1 meter cell size to 5 meters cell size.

Shadowplay
Shadowplay

Now I am all set to start the actual process. I want to produce a custom multi-directional hillshade by combining different light sources. This video on Multidirectional Hillshade: Deconstructed explains perfectly how one can do it by performing multiple times a simple Hillshade function on the DEM and each time selecting a different pair of Azimuth/Altitude values.

But when I start doing this for my own case study, how can I know which are the appropriate pairs of Azimuth/Altitude values? How can I know the exact Sun Path for my area, provided that it is also located in the Southern Hemisphere, which I have never experienced myself?

Study the sun path

There exists an amazing web application called Sun Calculator which is capable of showing the sun path for any place on Earth and for any given time!

Shadowplay

You simply select the center of the map and the desired date and the app will return a bunch of information, including of course the exact Azimuth and Altitude. As you move the time bar at the top of the app, the sun path moves on the map, giving a different pair of Azimuth/Altitude for each time of the day. Wow!

So I simply center the map at Tutuila island and I select a date. I actually selected two extreme dates! The one is 21 December 2019 (Winter Solstice) and the other is 21 June 2020 (Summer Solstice). The app is storing the query data at the url, so if you click at the two extremes above you will go directly to the equivalent date if you want to follow along!

By horizontally scrolling the time bar for each date and observing the correspondent Sun path, I come up with five principal Azimuth/Altitude pairs that I think will be good enough to create the multi-directional hillshade. These are depicted at the following table.

NameAzimuthAltitudeWeight
NW312340.5
NE048340.1
SE110250.1
S180800.4
SW250250.25

Don’t think that I selected the Azimuth values randomly. I spent sufficient time observing the hand-drawn hillshade of Tutuila, trying to understand the prominent and less prominent light sources that the map maker had selected.

At my table there is also a Weight column. This describes how intense I think each light source should be. Again I consulted the hand-drawn hillshade of Tutuila. These values will be used at the following steps.

Create a custom multidirectional hillshade

Another huge source of inspiration was the video One Minute Map Hack: Edit a Raster Effect Without Starting Over. Fifty seconds were enough to unlock a vast stream of creativity.

So back in Pro, at the Imagery tab I click on the Function Editor to open a new Raster Function Template

Shadowplay

I drag the DEM Raster from the table of contents and I drop it in the Function Editor. From the Raster Functions List I drag the Hillshade function and I also drop it in the Function Editor. Then I connect the DEM Raster with the Hillshade function.

Shadowplay

When I double-click on the Hillshade function the correspondent dialog appears, where I fill the necessary parameters for the hillshade production. For this hillshade I fill the first Azimuth/Altitude values, according to my table, and I select a value of 2 for the Z Factor to produce a slightly vertically exaggerated relief.

Shadowplay

I repeat the same process four more times. I drop in the Function Editor four more Hillshade functions, to which I assign the values of my table and I give to all of them the same value of 2 for the Z Factor. I also connect all of them with the DEM Raster and I rename them. Renaming is essential for the following step, which is where the real magic happens.

From the Raster Function list I select the Calculator function and I drag and drop it to the Function Editor. I then connect all five individual Hillshade functions with the Calculator function.

Shadowplay

I rename the Calculator function and I double-click on it to open the dialog with its parameters. At the Raster Variables section I select all five hillshades and I assign equivalent names as variables. Then in the Expression section I write a simple formula, which is nothing more than adding the five hillshades multiplied with their weight factor.

The formula is: ( NW * 0.5 ) + ( NE * 0.1 ) + ( SE * 0.1 ) + ( S * 0.4 ) + ( SW * 0.25 )

Shadowplay

The value of each weight was estimated firstly by observing the reference image (the hand-drawn hillshade) and then with a little trial and error. You may need to experiment with these values to come up to the desired result.

When I fill all the parameters, I save the Raster Function Template as a new custom Raster Function. This is essential in order to have it working.

Shadowplay

As you may see, it is stored at the Raster Function list at the Custom tab.

Shadowplay

I simply right-click on my custom function and from the drop-down menu I select Edit and then Open and at the function dialog I click at the Create new layer button at the bottom.

Shadowplay
Shadowplay

The overall process is running (in seconds) and it produces a new raster file on the table of contents which is nothing else but the combined, weighted multi-directional hillshade from all five simple hillshades.

Depending on the pixel type of the new raster, I may need to select a stretch type and to calculate the statistics and now I see it on the map panel!

Shadowplay
Shadowplay

The most amazing advantage of this process is that I can change any value, either in the simple hillshades or in the combined hillshade, and each time I will generate a different result with the least possible effort! Wow!

Export the multidirectional hillshade

The following part of the process includes filtering of the multi-directional hillshade in Adobe Photoshop, so I must appropriately export it from ArcGIS Pro with the Export or convert raster datasets command.

I right-click on the multi-directional hillshade on the table of contents and I select Data > Export Raster to open the Export Raster dialog. 

At the Export Raster dialog I write the name of the output raster to be MULTI_HILL and then I select the Output Format to TIFF and I click at the Use Renderer checkbox at the Renderer Settings. Then I hit the Export button.

Shadowplay
Shadowplay

Pro generated four files at the given directory. These files are:

It is extremely important to not delete the world file, for I will use it again later in the process (see the paragraph “From Photoshop to ArcGIS Pro”). I will not keep the auxiliary and the pyramid files, since I will manually reproduce them later in the process.

Now, I want to assess whether the shades of my calculated multi-directional hillshade are as close as possible to the shades of the hand-drawn hillshade.

Shadowplay

To do this, I compare the two different rasters with the Swipe tool at the Appearance tab.

Shadowplay

If I see that they are quite similar I may proceed, otherwise I will have to go back to my saved custom function, alter the parameters and run it until I produce a more satisfactory result.

I had to do this more than twenty times for the purposes of this tutorial, so be patient and careful! 

Create a mask layer out of the coastline

Before I load the exported multi-directional hillshade to Adobe Photoshop, it is a good idea to produce a mask layer for better results. I want to create a mask layer that will mask the hillshade raster at the exact coastline of Tutuila island. From the many ways to do such a thing, I will demonstrate the simplest one!

Remember the resampled mosaic DEM raster I created at the beginning of the process? The one that fed the overall custom function? Well, this will be useful for one more time!

I click on it and I open the Symbology Pane. At the Primary Symbology drop-down list I select Classify, for Method I select Manual Interval and I set the number of Classes to 2. Then at the class break dialog I select the value ≤ 0.0 for the first class and I leave the second class with its default.

Shadowplay

I just told Pro to symbolize the DEM Raster in a binary way, with which everything that is equal or less than 0 represents the sea and everything that is above 0 represents the land!

The selection of colors is also important. I choose an RGB black for the sea and an RGB white for the land. Before I close the pane, I also give an RGB black to the NoData pixels. Keep reading to see why!

Shadowplay

I will use the Export or convert raster datasets command again, only this time I will also click at the Force RGB checkbox at the Renderer Settings.

Shadowplay

The derived binary raster layer is added to the table of contents.

Shadowplay

Pro saves the following files:

  • MASK.tif
  • MASK.tfw
  • MASK.tif.aux
  • MASK.tif.ovr

For the purposes of this tutorial I will only use the actual raster, the MASK.tif file, so I delete the rest from their saved folder.

From ArcGIS Pro to Photoshop

The inspiration of importing layers from ArcGIS Pro to Adobe Photoshop and back primarily came from the blog posts Hand drawn terrain and Textures from Basemaps by Heather Smith. Reading these blogs made me more confident and more creative in integrating Photoshop in my map making procedures.

So let’s switch Worlds. Let’s dive into the World of graphic designers for a while. I turn Photoshop on and I open the MULTI_HILL.tif (the multi-directional hillshade created at the previous steps).

Shadowplay

First action is to turn the overall document’s color mode from Grayscale to RGB (Image > Mode > RGB Color) and then to turn the imported MULTI_HILL to a Smart Object (Select it at the Layers panel and Filter > Convert for Smart Filters). These steps are essential for some filters to work and to store the filters separately without destroying the original MULTI_HILL image.

Shadowplay

Next step is to apply the layer mask. I go to File > Place Embedded and I select the MASK.tif from the folder where it has been saved. This is automatically positioned on top of the MULTI_HILL layer. It is also very important to NOT CROP even a single pixel. First for making sure that the two rasters will perfectly align and second to make sure that when loading the output from Photoshop to Pro the world file will still work.

Shadowplay

Now some magic. I select the MULTI_HILL layer and I click on the Add layer mask button at the bottom of the Layers Panel. I click on the MASK layer and I type on the keyboard CTRL + A and then CTRL + C. This will select the total of the MASK layer’s pixels. Then I click on the mask layer next to the MULTI_HILL layer, by holding down the ALT key and I type CTRL + V. And now I have a pretty mask for the MULTI_HILL layer that hides everything apart from the island of Tutuila.

Shadowplay

For better readability I add a background layer to hide the transparent checkerboard background of the masked pixels.

Shadowplay

Let’s start filtering!

Filtering in Photoshop

The first filter, also one of my favourites, is the Median Filter. I select the MULTI_HILL layer at the Layers panel and I go to Filter > Noise > Median.

Shadowplay

At the dialog of the filter I select a Radius of 2 pixels. If I pay attention to the preview window I will notice that the original MULTI_HILL layer has already started to change. Slopes are getting smoother while ridges remain sharp.

Shadowplay

Next is the Oil Paint Filter. This filter alters the image to make it look like an oil painting and it works like a line integral convolution filter. Again I select the MULTI_HILL layer at the Layers panel and I go to Filter > Stylize > Oil Paint.

Shadowplay

The filter dialog opens and I have a number of parameters to adjust. For Stylization I select the value of 2.4 and for Cleanliness I select the value of 3.6. I experimented to end up with these values. I leave the rest of the values at 0 and I disable the Lighting option.

Shadowplay

Look how smoother it is starting to be.

On top of the Oil Paint Filter I add one more time a Median Filter with Radius 2 pixels. I do this to smooth even more the MULTI_HILL layer.

Next is a very wild one, the High Pass Filter! Whilst the previous filters are used for smoothing and noise removal (also known as low-pass filters) the High pass filter is used for edge detection. I select the MULTI_HILL layer at the Layers panel and I go to Filter > Other > High Pass.

Shadowplay

Look how the filter detected the edges of the MULTI_HILL layer. I select a radius of 2 pixels and I click OK.

Shadowplay

Now this filter needs an appropriate blending mode to blend correctly with the rest of the filters and with the image itself. So I right click on the filter at the Layers panel and I open its Blending Options. From the drop-down list I select the Soft Light blending mode for a smoother result.

Shadowplay

Since I want to produce something that looks more like a man-made hillshade, it would be a good idea now to slightly blur the image. I will do this with the classic Gaussian Blur filter. So, once again I select the MULTI_HILL layer at the Layers panel and I go to Filter > Blur > Gaussian Blur.

Shadowplay

I really want a subtle blurring, so I will select a radius of 1.2 pixels.

Shadowplay

Lastly I need to Add Noise or grains on the hillshade. I select the MULTI_HILL layer at the Layers panel and I go to Filter > Noise > Add Noise.

Shadowplay

For the amount of noise I select a value of 3.6%

Shadowplay

Am I done yet? Before I finish, I want to make some refinements to the overall brightness and contrast of the hillshade and I am going to do this by adjusting the Levels. I select the MULTI_HILL layer and I click on the Create new fill or adjustment layer button at the bottom of the Layers panel and I select a Levels adjustment layer. At the Levels panel I can make any adjustment according to my taste.

Shadowplay

To sum up here is my recipe:

Shadowplay
FilterParameters
Add NoiseAmount 3.6, Distribution: Gaussian
Gaussian BlurRadius 1.0 or 1.2
High PassRadius 2.0 + Blending Mode: Soft Light
MedianRadius 2.0
Oil PaintStylization 2.4, Cleanliness 3.6, Scale 0.1, Bristle Detail 0.0, Lighting: disabled
MedianRadius 2.0

AdjustmentParameters
LevelsRGB: Black 0, Midtones 0.87, White 243 + Output Levels: Black 50, White 240

Keep in mind that all filters are Smart Filters. This means that I can deactivate them or change any of their parameters or even remove some of them or add new ones without harming the original image.

Also, the order of the filters is important. Try to change the order and see how this will produce a different result.

Keep in mind that this is not a recipe for all cases. Filtering is depended on the resolution of the initial image, the desired scale, the geomorphology of the study area and the taste of each individual map maker. So don’t strictly follow my own recipe, but instead try to experiment and come up with your own.

From Photoshop to ArcGIS Pro

Time to go back! In Photoshop I go to File > Save As to save the filtered image in my workspace folder.

Shadowplay

I select TIFF without layers as the export format and I type MULTI_HILL for the name of my exported file. I fill the options at the TIFF Options dialog and I click OK.

Shadowplay

I save the MULTI_HILL in a separate folder in my workspace. At the same folder I also copy and paste the relative files of the first TIFF exported from Pro at the beginning of the process (see the paragraph “Export the multidirectional hillshade”).

Shadowplay

I don’t need the auxiliary or the pyramids files, so I delete them and I end up with only the TIFF file its associated world file.

Now I go to Pro, I make sure the map’s coordinate system has not changed and I add the new MULTI_HILL raster layer.

Shadowplay

I must perform a few more actions, such as defining the projection and building pyramids.

I open the Define Projection tool where for Input Dataset I select the MULTI_HILL raster layer and for Coordinate System I select the coordinate system of the map, inherent from the original Lidar DEM dataset and I click Run.

Shadowplay

Then I open the Build Pyramids tool where again I select the MULTI_HILL raster layer as the Input Raster Dataset. I leave all other parameters at their default values and I click Run.

Shadowplay

And I am done! I just completed the whole process from ArcGIS Pro to Photoshop and back. I may now use again the Swipe tool to compare my result with the hand-drawn shaded relief.

Shadowplay
Shadowplay

Of course nothing can top the charm of an actual hand-drawn shaded relief. What I have produced here is far from precisely replicating a human hand. But I think it is a good, fast and easy process to give a more vintage man-made touch to a cold computer-made digital hillshade.

I hope you enjoyed reading this article, as much as I enjoyed writing it!

Kindest regards from Crete, Greece

Spiros

🙂

P.S. At the shortlist of resources that follows, spend some time to read specifically the paper which intoduces the “Cartographic Relief Shading with Neural Networks“. This is a great advance in replicating a hand-drawn hillshade. I was really amazed with this work. Figure 1 at the section “Supplementary Material: Shaded relief images for expert evaluation” depicts the island of Tutuila and compares the original hand-drawn work with the produced one. Mind-blowing!

A shortlist of precious resources

Loissios, Dimitrios & Tzelepis, Nikolaos & Nakos, Byron. (2007). A METHODOLOGY FOR CREATING ANALYTICAL HILL-SHADING BY COMBINING DIFFERENT LIGHTING DIRECTIONS

Jenny, Bernhard & Patterson, Tom. (2020). Aerial perspective for shaded relief. Cartography and Geographic Information Science. 10.1080/15230406.2020.1813052. 

Roman Geisthövel (2017) Automatic Swiss Style Rock Depiction

Lorenz Hurni (2008) Cartographic Mountain Relief Presentation 150 Years of Tradition and Progress at ETH Zurich, Institute of Cartography, ETH (PDF)

Jenny, B., Heitzler, M., Singh, D., Farmakis-Serebryakova, M., Liu, J. C., and Hurni, L. (2020). Cartographic Relief Shading with Neural Networks. IEEE InfoVis/IEEE Transactions on Visualization and Computer Graphics. DOI: 10.1109/TVCG.2020.3030456

Mike Cammarano Depicting Terrain with Shaded Relief Maps, Stanford University

Kennelly, Patrick & Patterson, Tom & Jenny, Bernhard & Huffman, Daniel & Marston, Brooke & Bell, Sarah & Tait, Alex. (2020). Elevation models for reproducible evaluation of terrain representation. Cartography and Geographic Information Science. 10.1080/15230406.2020.1830856. 

Patterson, Tom. (2002). Getting Real: Reflecting on the New Look of National Park Service Maps Cartographic Perspectives. 10.14714/CP43.536. 

Kennelly, Patrick & Kimerling, A.. (2004). Hillshading of Terrain Using Layer Tints with Aspect-Variant Luminosity. Cartography and Geographic Information Science. 31. 67-77. 10.1559/1523040041649416. 

Patrick J. Kennelly (2009) Hillshading Techniques To Enhance Terrain Maps

Tait, Alex. (2002). Photoshop 6 Tutorial: How to Create Basic Colored Shaded Relief. Cartographic Perspectives. 12-17. 10.14714/CP42.550. 

Tzvetkov, Jordan. (2018). Relief visualization techniques using free and open source GIS tools. Polish Cartographical Review. 50. 61-71. 10.2478/pcr-2018-0004. 

Räber, Stefan & Jenny, Bernhard & Hurni, Lorenz. (2009). Swiss Style Relief Shading Methodology: Knowledge base for further development and application in digital cartography

Jenny, Bernhard & Hurni, Lorenz. (2006). Swiss-Style Colour Relief Shading Modulated by Elevationand by Exposure to Illumination. Cartographic Journal, The. 43. 198-207. 10.1179/000870406X158164. 

Jenny, Bernhard. (2020). Terrain generalization with line integral convolution. Cartography and Geographic Information Systems. 10.1080/15230406.2020.1833762. 

Leonowicz, Anna & Jenny, Bernhard & Hurni, Lorenz. (2010). Terrain Sculptor: Generalizing Terrain Models for Relief Shading. Cartographic Perspectives. 10.14714/CP67.114. 

Barnes, D. (2002). Using ArcMap to Enhance Topographic Presentation. Cartographic Perspectives, (42), 5-11. https://doi.org/10.14714/CP42.549