Jump to content

 
Photo

Google-style relief shading - thoughts?

* * * * * 1 votes

  • Please log in to reply
20 replies to this topic

#1
Brian Moran

Brian Moran

    Contributor

  • Validated Member
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Bay Area, California
  • United States

Google Maps uses a style of relief shading in the "terrain" mode that works pretty well, I think. It seems to use a blend of regular 45-degree, northwest lighting, and a top-lit lighting that highlights the ridge tops and valley floors (anywhere where the slope = 0). The latter can be achieved using either a 90-degree "altitude" in the ArcMap hillshade dialogue (light coming straight down from above), or doing a slope analysis in Spatial Analyst and symbolizing it such that color value decreases with slope value. The two hillshades seem to be blended at about 50-50.

The end result is interesting, but I'm not convinced its worth replicating in my own maps. Has anyone used this style of relief with any success? Does this style have a name, or is anyone else using it successfully besides Google?

#2
Matthew Hampton

Matthew Hampton

    Hall of Fame

  • Moderator
  • PipPipPipPipPipPipPip
  • 1,325 posts
  • Gender:Male
  • Location:Portland, Oregon
  • Interests:Playing in the mountains and rivers.
  • United States

There are quite a variety of methods for creating hillshades. If you are using spatial analyst's hillshading operation it would be called 'analytic hillshading' and there are various flavors of that (multi-direction oblique shading - MDOW, Swiss technique, slope-shading, etc.).

I'm not too sure what to call Google's shading - but it definitely uses multiple directions (not too sure if they use oblique weighting - to my eye it doesn't look like they do).

There are a variety of resources online to investigate further techniques.

Two that instantly jump to mind are T. Patterson's Shaded Relief and Relief Shading from the Institute of Cartography in Switzerland.

co-cartographic creator of boringmaps.com


#3
sitesatlas

sitesatlas

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Madrid, Spain
  • Spain

In the Google terrain maps, it seems like all sides of mountains are shaded to some extent and while that can be done with multiple light sources, my guess is that it was achieved by simply assigning shades of grey to the slope values. There is more shading on the southeast-facing surfaces, so maybe the slope shading was combined with the traditional northwest height shading.

For comparison, I'm attaching two images of Switzerland showing relief (height) shading and slope shading. The Google terrain map of Switzerland is here.

Attached Files


Michael Borop
World Sites Atlas
http://www.sitesatlas.com

#4
E Nile

E Nile

    Contributor

  • Validated Member
  • PipPip
  • 22 posts
  • United States

Another option is one Robert Mark from USGS did a few years ago:

http://pubs.usgs.gov...22/of92-422.pdf

#5
MapMedia

MapMedia

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,029 posts
  • Gender:Male
  • Location:Davis, California
  • United States

Yes, it is a blending method for sure, but like all Google work, its method is forever hidden, therefore a fun nut for us cartofiles to crack.

As an aside, ESRI's World Relief layer is less detailed, but also includes some use of slope or azimuth light blending, I would guess (370, 60) with smoothing at low elevations:

Attached Files



#6
Eric

Eric

    Newbie

  • New Member
  • Pip
  • 1 posts
  • United States

...The end result is interesting, but I'm not convinced its worth replicating in my own maps. Has anyone used this style of relief with any success? Does this style have a name, or is anyone else using it successfully besides Google?


I can't give you any info on the providence of the style, but can give some suggestions if you're wanting to give it a shot...
We created a hillshade that replicates it pretty well -- with much more detail. Ended up creating a bunch of raster layers in ArcMap, exported to TIFF and composited in Photoshop to allow WYSIWYG tweaking with dramatic ease. It also allowed us to remove detail from the areas that are most likely to have other content layered upon it using masks. Easy. Effective. The result is pretty good, too.

We did make one improvement, drawing from an approach used to simulate natural lighting in 3d rendering workflows. Shadows aren't black and sunlight isn't white, so we added a bit of purple shading to the shadows, and a bit of orange to the highlights--and when I say "a bit", I mean a very little bit. Just enough to give a hint of color. Makes a big difference, and helps the result not feel so "lunar" (shades of gray).

Sorry, no example to show at the moment. Soon. Wish I could be of more help. Good luck.

Eric Geddes, GIS Specialist
City of San Luis Obispo, California

#7
Matthew Hampton

Matthew Hampton

    Hall of Fame

  • Moderator
  • PipPipPipPipPipPipPip
  • 1,325 posts
  • Gender:Male
  • Location:Portland, Oregon
  • Interests:Playing in the mountains and rivers.
  • United States

Great suggestion Eric! I'll have to give that a shot when I get back to the shop.

BTW, welcome to the Cartotalk forum. I saw some of your work down in San Diego last week at the ESRI UC and thought it was really nice. Congrats!

co-cartographic creator of boringmaps.com


#8
Dale Sanderson

Dale Sanderson

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 136 posts
  • Gender:Male
  • Location:Headwaters Hill, CO
  • United States

The end result is interesting, but I'm not convinced its worth replicating in my own maps. Has anyone used this style of relief with any success? Does this style have a name, or is anyone else using it successfully besides Google?


I do use a similar method for shaded-relief in my street maps. "Traditional" shaded-relief (lighting from the northwest) conveys the lay of the land well, but it leaves flat areas a neutral gray. In my opinion, this doesn't work well with detailed street maps, because most development tends to happen in flatter areas, so the gray terrain reduces the legibility of information which (in my maps) is more important than shaded-relief (such as roadlines and roadnames). However, I do think it's helpful to indicate slopes on street maps, so I experimented with lighting from directly overhead. This achieved the goal of showing slopes, but then it was difficult to "read" the terrain, and to get a mental "feel" for the lay of the land. So then I tried using Photoshop to blend the two methods (traditional and overhead), and came up with something I'm pleased with, similar to Google's style. It's a subtle shaded-relief layer that I think gives a good feel for the landscape without muddling the more important navigational info. Here are a few recent examples:
Estes Park CO
Grand Junction CO
Muscatine IA
Trinidad CO
Dale Sanderson
professionally: cartographics manager for Dex One
personally: cartophile and road-geek (my website)

#9
Holograph

Holograph

    Contributor

  • Validated Member
  • PipPip
  • 20 posts
  • United States

I was able to closely reproduce Google's relief with Manifold and PaintShop. (Those are the only tools I have, since I'm a rank amateur and can't justify the expense of proper tools). The shaded relief was produced in Manifold using a pure white palette, with lighting at 315° azimuth, 75° elevation. I mapped the surface colors to the relief in Paintshop Pro, using a series of arithmetic operations that implements a shading algorithm I've used ever since I began experimenting with maps. I have a feeling that my color-mapping formula may supply some of the effects that seem to be due to multiple lighting sources, but which in my case are just a subtle form of specular highlight.

This is the first time I've tried to upload attachments, so if they don't show up, it is due to my fumbling.
Attached File  Google_Maps.png   567.29KB   284 downloads Attached File  Sample_relief.png   117.37KB   338 downloads

#10
François Goulet

François Goulet

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 689 posts
  • Gender:Male
  • Location:Mille-Isles, Qc
  • Interests:Cartography, History, Graphic Design and almost everything else...
  • Canada

Nice result, very similar!

#11
MapMedia

MapMedia

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,029 posts
  • Gender:Male
  • Location:Davis, California
  • United States

I was able to closely reproduce Google's relief with Manifold and PaintShop. (Those are the only tools I have, since I'm a rank amateur and can't justify the expense of proper tools). The shaded relief was produced in Manifold using a pure white palette, with lighting at 315° azimuth, 75° elevation. I mapped the surface colors to the relief in Paintshop Pro, using a series of arithmetic operations that implements a shading algorithm I've used ever since I began experimenting with maps. I have a feeling that my color-mapping formula may supply some of the effects that seem to be due to multiple lighting sources, but which in my case are just a subtle form of specular highlight.

This is the first time I've tried to upload attachments, so if they don't show up, it is due to my fumbling.
Attached File  Google_Maps.png   567.29KB   284 downloads Attached File  Sample_relief.png   117.37KB   338 downloads


What was your source data?
Which hillshade settings and Photoshop effects/adjustments were made?

#12
Holograph

Holograph

    Contributor

  • Validated Member
  • PipPip
  • 20 posts
  • United States

What was your source data?
Which hillshade settings and Photoshop effects/adjustments were made?


The process is going to sound convoluted, perhaps even silly, but keep in mind that I am an amateur whose priorities are to use inexpensive tools at the cost of extra labor. The tools were Manifold and Paintshop Pro. I can tell you the steps, and you can see if they translate to whatever tools you use.

The sample was a 1:200,000 scale Transverse Mercator, in the neighborhood of Williamsport, PA, USA.

The source data was the 1/3 arc-second National Elevation Dataset. I exaggerated the elevations by a factor of 4. In Manifold, I did that by applying Surface/ Effects/ Filter... and set the matrix so that the central pixel is multiplied by 4, all others are zero, and the scale is 1.

Next, I projected the surface elevation data to the map projection, and clipped it to the view I wanted. Doing the projection first seems to give better results with the shaded relief. Clipping just reduces the amount of data.

The shaded relief was created with Manifold's built-in shading. In order to use it for my color-mapping stages in Paintshop Pro, I need to coax Manifold to use a predictable algorithm, which I do by forcing it to use a white palette. In Manifold, this is accomplished with the View / Display Options dialog. I load a prepared single-color palette:

<?xml version="1.0" encoding="UTF-8"?>

<theme>

	<type>color</type>

	<interval>true</interval>

	<colors>

		<color>#ffffff</color>

	</colors>

	<colorMin>#ffffff</colorMin>

	<colorMax>#ffffff</colorMax>

	<colorDef>#000000</colorDef>

	<values>

		<value>500</value>

	</values>

</theme>

and then enable shading, setting the azimuth to 315° and the altitude to 75°. The prepared palette is essential, since without it, Manifold does an automatic contrast adjustment that leads to unpredictable results. Also, my color mapping technique in Paintshop Pro depends on knowing the color value of horizontal flat regions.

After creating the relief, I usually rescale the surface so that the dimensions match the dimensions of the image that I want to obtain. That helps smooth out the graininess of the surface when the elevation data is higher resolution than the image.

I then create a layout, using a custom page size that yields the image dimensions. Manifold seems to use 96 dpi on my system, so I compute the page size based on that resolution. I convert the layout to an image by using the Tools / Make image... dialog, then export the resulting image to the file system as a PNG. That gives me a grayscale image of the shaded relief.

To create the terrain colors, I hide the surface and just export the basic map background, which in this case was a RGB background color {209, 219, 194}, along with the hydrography from the National Hydrography Dataset. I used the flowlines, areas, and waterbodies from the dataset.

There are probably easier ways to drap the surface colors on the relief, but since my budget is low, I use Paintshop Pro and make use of its image arithmetic to compute the colors for a given grayscale value. There are two separate color calculations: one for colors shaded darker than the color of horizontally flat areas, and one for colors shaded lighter than the flat areas.

I'm sure that Manifold's shading algorithm is the simple one based on the angle of incidence to the surface (I forget the name of the algorithm, but it is well known and easy to implement). That means that horizontally flat pixels aren't pure white, but are slightly shaded because of the 75° angle of the light. The pixels that are exactly perpendicular (normal) to the light source will be pure white.

Because I want the result to exactly match my basic surface colors on horizontally flat regions, the color computation needs to take into account that in the relief image, the RGB value of horizontal regions are not {255,255,255}, but are in fact {246,246,246}.

Basically, the shading computations implement these two pixel color equations:

P1 = P0 * [ 1 - f *(G0 - G) /G0 ], or in other words, the shadow-color RGB channel P0 is scaled linearly based on the grayscale relief value G, from the original color, down to black; where f is a scaling factor that prevents the color from going all the way to black. Any pixels that are brighter than G0, the grayscale value of horizontal pixels, are unchanged.

P2 = (255 - P0) * f * (G - G0), or in other words, highlights are scaled linearly from the original color to white, based on the grayscale relief value; where f is a scaling factor that tones down the highlights. Any pixels darker than G0 are unchanged. Bright highlights give a glossy look to the relief, as if it were an image of a plastic relief map.

The result is simply the sum P1 + P2.

Mechanically, I accomplish this in Paintshop Pro with a series of image arithmetic operations:

1. Import the grayscale relief image (#1).

2. Import the color map image (#2).

3. Create a uniform grayscale gray image using G0 = horizontal gray value, giving image #3. Typical G0 = 246. The value will depend on the elevation angle of the light when the shaded relief was created.

4. Subtract #1 (relief) from #3 (gray) giving #4.

5. Subtract #3 (gray) from #1 relief giving #5.

6. Multiply #2 color map by #4 with divisor = G0 (246) , giving #6.

7. Multiply #6 by 10/15 giving #7. [Create a gray image with g = 10, then multiply it and #6 with divisor 15]. The ratio 10/15 represents the scaling factor f in the first equation. It can be adjusted experimentally to give the most pleasing results.

8. Subtract #7 from #2 color map, giving #8.

9. Create a solid white image #9.

10. Subtract #2 color map from #9, giving #10.

11. Multiply #10 by #5, giving #11.

12. Multiply #11 by 10/200 giving #12. [Create a gray image with g = 10, then multiply with divisor 200]. The ratio 10/200 represents the scaling factor f in the second equation. It can be adjusted experimentally to give the most pleasing results.

13. Add #7 and #12, giving #13 - the shaded relief.

edit: corrected formula P1

#13
Crischan

Crischan

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 199 posts
  • Gender:Male
  • Location:Eberswalde, Germany
  • Interests:Spatial Information Design
  • Germany

I haven't used Paintshop Pro for a decade now, but I am pretty sure you can shorten your approach significantly and at the same time get live previes of your modificatiions! I amrunning in the open source world with GRASS being my primary GIS (mainly for remote sensing) and GIMP being my image editor.
After making the hillshade in GRASS (exaggerating 4x, azimuth 315°, sun angle 75°) and exporting it to the GIMP, I have this:
Attached File  shade_in.jpg   157.07KB   154 downloads
Then I use the color curves tool to adjust the contrast. After setting a point at x=246,y=246 to fix this point I can happily edit the curve by dragging it, inserting more points to fine tune the resulting adjustment. All the while I get a live preview which I can switch on and off to check how my adjustment compares to the original image. I bet that Paintshop Pro has such a tool too, as any image editor must have which doesn't call itself MS Paint... ;)
So applying this:
Attached File  curves.jpg   55.17KB   98 downloads
gives this:
Attached File  shade_curves.jpg   167.13KB   136 downloads
and finally adding another layer with the National Landcover and setting the layer mode to "Multiply" (again, if it isn't MS Paint it should have it...) gives this final result, which is pretty nice:
Attached File  lc_blend.jpg   194.67KB   176 downloads
Crischan Wygoda
http://wygoda.net

#14
Malcolm RH

Malcolm RH

    Newbie

  • Validated Member
  • Pip
  • 6 posts
  • United States

I know this post is about Google-style, and it seems that the blending of slope and aspect shading does really nicely (seriously, nice work Holograph, Chrischan, etc.).

...BUT...

I have a bone to pick with 315 degree azimuths, and this seems like a well informed audience that may have opinions.

If you or your audience has spent time in high latitudes, you probably won't like what google-style looks like in the far north. I know that we are supposed to have an easier time if the azimuth is 315 degrees, but when this is so far from the truth, I think it just gives more confusion.

Compare satellite and terrain images in google for Dawson, YT - their shading is completely flipped. Confusing, eh?

How about at exactly 45 degrees north, Mammoth, WY? - satellite and terrain are still really opposite.

So for the area around Mammoth WY, I created shading using a simple google-style method:
Attached File  stdshade.jpg   151.75KB   108 downloads
yeah, it looks okay, but it bothers me to see south facing slopes so dark!

So what if I just hillshade with an azimuth of 180 degrees (still a 75 degree sun angle)?
Attached File  southshade.jpg   153.04KB   111 downloads
In my opinion this looks better, and similar to google-style since we have such a high sun angle.

But what if I take it a step further, using a realistic sun angle for the latitude and creating real shadows? can you understand this shading?
Attached File  septrad.jpg   114.09KB   106 downloads
I simulated incoming solar radiation in kilowatt-hours per meter squared for every hour of the 15th of september. Seems a little complex, but it is easy, I create them all the time in SAGA for science purposes. Most realistic for sure - I love how we no longer have as many artificial looking lines from the DEM. But is it the easiest to interpret?

Alternatively you could model the radiation of an entire year, but I think it gets washed out a little, and it takes way more processor time.
Attached File  annradmz.jpg   108.93KB   105 downloads

Let me know your thoughts on this. I want to kill the 315 degree rule, but don't want people to say my maps look inside out!

#15
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

Let me know your thoughts on this. I want to kill the 315 degree rule, but don't want people to say my maps look inside out!


I don't want to offend you, but.....you'll never kill that rule. Because it works. It works at high latitudes, at low latitudes, and on the moon. Tests have proven it.
And now for my own unpopular opinion: I think Google's relief is awful. Just compare it with any well-done 315 relief shading. Google has reverted shaded relief portrayal to the 19th century, before many successive generations of cartographers figured out what works and what doesn't. Just my opinion, of course. ;)

Charles Syrett
Map Graphics
http://www.mapgraphics.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->